설명
모든 캐시된 파일 스키마 정보를 포함합니다.
컬럼
storage(String) — 스토리지 이름: File, URL, S3 또는 HDFS.source(String) — 파일 소스.format(String) — 포맷 이름.additional_format_info(String) — 스키마를 식별하는 데 필요한 추가 정보입니다. 예를 들어 포맷별 설정이 있습니다.registration_time(DateTime) — 스키마가 캐시에 추가된 시각의 타임스탬프입니다.schema(Nullable(String)) — 캐시된 스키마입니다.number_of_rows(Nullable(UInt64)) — 지정된 포맷에서 파일에 포함된 행 수입니다. 데이터 파일에 대한 단순 count() 결과를 캐시하고, 스키마 추론 중 메타데이터의 행 수를 캐시하는 데 사용됩니다.schema_inference_mode(Nullable(String)) — 스키마 추론 모드입니다.
예시
다음과 같은 내용이 담긴 파일 data.jsonl이 있다고 가정하겠습니다:
{"id" : 1, "age" : 25, "name" : "Josh", "hobbies" : ["football", "cooking", "music"]}
{"id" : 2, "age" : 19, "name" : "Alan", "hobbies" : ["tennis", "art"]}
{"id" : 3, "age" : 32, "name" : "Lana", "hobbies" : ["fitness", "reading", "shopping"]}
{"id" : 4, "age" : 47, "name" : "Brayan", "hobbies" : ["movies", "skydiving"]}clickhouse-client를 열고 DESCRIBE 쿼리를 실행하십시오.
DESCRIBE file('data.jsonl') SETTINGS input_format_try_infer_integers=0;┌─name────┬─type────────────────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┐
│ id │ Nullable(Float64) │ │ │ │ │ │
│ age │ Nullable(Float64) │ │ │ │ │ │
│ name │ Nullable(String) │ │ │ │ │ │
│ hobbies │ Array(Nullable(String)) │ │ │ │ │ │
└─────────┴─────────────────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┘system.schema_inference_cache 테이블의 내용을 살펴보겠습니다:
SELECT *
FROM system.schema_inference_cache
FORMAT VerticalRow 1:
──────
storage: File
source: /home/droscigno/user_files/data.jsonl
format: JSONEachRow
additional_format_info: schema_inference_hints=, max_rows_to_read_for_schema_inference=25000, schema_inference_make_columns_nullable=true, try_infer_integers=false, try_infer_dates=true, try_infer_datetimes=true, try_infer_numbers_from_strings=true, read_bools_as_numbers=true, try_infer_objects=false
registration_time: 2022-12-29 17:49:52
schema: id Nullable(Float64), age Nullable(Float64), name Nullable(String), hobbies Array(Nullable(String))