メインコンテンツへスキップ
メインコンテンツへスキップ

system.schema_inference_cache

Querying in ClickHouse Cloud

The data in this system table is held locally on each node in ClickHouse Cloud. Obtaining a complete view of all data, therefore, requires the clusterAllReplicas function. See here for further details.

キャッシュされたすべてのファイルスキーマに関する情報を保持します。

列:

  • 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"]}
ヒント

data.jsonluser_files_path ディレクトリに配置してください。これは ClickHouse の設定ファイルを確認することで特定できます。デフォルトは次のとおりです:

<user_files_path>/var/lib/clickhouse/user_files/</user_files_path>

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))

関連項目