> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8a08bda2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> キャッシュされているすべてのファイルスキーマに関する情報を含むシステムテーブル。

# system.schema_inference_cache

<Info>
  **ClickHouse Cloud でのクエリ**

  このシステムテーブルのデータは、ClickHouse Cloud の各ノードにローカルに保持されています。したがって、すべてのデータを完全に把握するには、`clusterAllReplicas` 関数を使用する必要があります。詳細については、[こちら](/ja/reference/system-tables/overview#system-tables-in-clickhouse-cloud)を参照してください。
</Info>

<div id="description">
  ## 説明
</div>

キャッシュされているすべてのファイルスキーマの情報が含まれます。

<div id="columns">
  ## カラム
</div>

* `storage` ([String](/ja/reference/data-types)) — ストレージ名: File、URL、S3、または HDFS。
* `source` ([String](/ja/reference/data-types)) — ファイルソース。
* `format` ([String](/ja/reference/data-types)) — フォーマット名。
* `additional_format_info` ([String](/ja/reference/data-types)) — スキーマの識別に必要な追加情報。たとえば、フォーマット固有の設定です。
* `registration_time` ([DateTime](/ja/reference/data-types)) — スキーマが cache に追加された時刻を示すタイムスタンプ。
* `schema` ([Nullable(String)](/ja/reference/data-types)) — キャッシュされたスキーマ。
* `number_of_rows` ([Nullable(UInt64)](/ja/reference/data-types)) — 指定したフォーマットにおけるファイル内の行数。これは、データファイルに対する単純な count() のキャッシュや、スキーマ推論時にメタデータから取得した行数のキャッシュに使用されます。
* `schema_inference_mode` ([Nullable(String)](/ja/reference/data-types)) — スキーマ推論モード。

<div id="example">
  ## 例
</div>

次の内容を含むファイル `data.jsonl` があるとします。

```json theme={null}
{"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"]}
```

<Tip>
  `data.jsonl` を `user_files_path` ディレクトリに配置します。これは、ClickHouse の設定ファイルを確認すると
  見つかります。デフォルトは次のとおりです。

  ```sql theme={null}
  <user_files_path>/var/lib/clickhouse/user_files/</user_files_path>
  ```
</Tip>

`clickhouse-client` を開き、`DESCRIBE` クエリを実行します。

```sql theme={null}
DESCRIBE file('data.jsonl') SETTINGS input_format_try_infer_integers=0;
```

```response theme={null}
┌─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` テーブルの内容を確認してみましょう：

```sql theme={null}
SELECT *
FROM system.schema_inference_cache
FORMAT Vertical
```

```response theme={null}
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))
```

<div id="see-also">
  ## 関連項目
</div>

* [入力データからの自動スキーマ推論](/ja/concepts/features/interfaces/schema-inference)
