system.schema_inference_cache 시스템 테이블
system.schema_inference_cache 시스템 테이블
system.schema_inference_cache 는 모든 캐시된 파일 스키마에 대한 정보를 담고 있어요.
출처: 문서
본문
ClickHouse Cloud에서의 조회 — 이 시스템 테이블의 데이터는 ClickHouse Cloud에서 각 노드에 로컬로 저장돼요. 따라서 모든 데이터의 완전한 뷰를 얻으려면 clusterAllReplicas 함수가 필요해요. 자세한 내용은 여기 를 참고하세요.
Description
모든 캐시된 파일 스키마에 대한 정보를 포함해요.
Columns
-
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)) — 스키마 추론 모드예요.
Example
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"]}
data.jsonl 을 user_files_path 디렉터리에 두세요. 이것은 ClickHouse 구성 파일에서 찾을 수 있어요. 기본값은:
/var/lib/clickhouse/user_files/
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 Vertical
Row 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))