title_wip

Enabled by default.

**Examples**

```
SET input_format_try_infer_datetimes = 0, input_format_try_infer_dates = 0
DESC format(JSONEachRow, $$
                                {"date" : "2021-01-01"}
                                {"date" : "2022-01-01"}
                         $$)
```

```
┌─name─┬─type─────────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┐
│ date │ Nullable(String) │              │                    │         │                  │                │
└──────┴──────────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┘
```

```
SET input_format_try_infer_dates = 1
DESC format(JSONEachRow, $$
                                {"date" : "2021-01-01"}
                                {"date" : "2022-01-01"}
                         $$)
```

```
┌─name─┬─type───────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┐
│ date │ Nullable(Date) │              │                    │         │                  │                │
└──────┴────────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┘
```

```
DESC format(JSONEachRow, $$
                                {"date" : "2021-01-01"}
                                {"date" : "unknown"}
                         $$)
```

```
┌─name─┬─type─────────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┐
│ date │ Nullable(String) │              │                    │         │                  │                │
└──────┴──────────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┘
```

#### input\_format\_try\_infer\_exponent\_floats[​](#input-format-try-infer-exponent-floats "Direct link to input_format_try_infer_exponent_floats")

If enabled, ClickHouse will try to infer floats in exponential form for text formats (except JSON where numbers in exponential form are always inferred).

Disabled by default.

**Example**

```
SET input_format_try_infer_exponent_floats = 1;
DESC format(CSV,
$$1.1E10
2.3e-12
42E00
$$)
```

```
┌─name─┬─type──────────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┐
│ c1   │ Nullable(Float64) │              │                    │         │                  │                │
└──────┴───────────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┘
```

## Self describing formats[​](#self-describing-formats "Direct link to Self describing formats")

Self-describing formats contain information about the structure of the data in the data itself,
it can be some header with a description, a binary type tree, or some kind of table.
To automatically infer a schema from files in such formats, ClickHouse reads a part of the data containing
information about the types and converts it into a schema of the ClickHouse table.

### Formats with -WithNamesAndTypes suffix[​](#formats-with-names-and-types "Direct link to Formats with -WithNamesAndTypes suffix")

ClickHouse supports some text formats with the suffix -WithNamesAndTypes. This suffix means that the data contains two additional rows with column names and types before the actual data.
While schema inference for such formats, ClickHouse reads the first two rows and extracts column names and types.

**Example**

```
DESC format(TSVWithNamesAndTypes,
$$num    str    arr
UInt8    String    Array(UInt8)
42    Hello, World!    [1,2,3]
$$)
```

```
┌─name─┬─type─────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┐
│ num  │ UInt8        │              │                    │         │                  │                │
│ str  │ String       │              │                    │         │                  │                │
│ arr  │ Array(UInt8) │              │                    │         │                  │                │
└──────┴──────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┘
```

### JSON formats with metadata[​](#json-with-metadata "Direct link to JSON formats with metadata")

Some JSON input formats ([JSON](/docs/interfaces/formats/JSON), [JSONCompact](/docs/interfaces/formats/JSONCompact), [JSONColumnsWithMetadata](/docs/interfaces/formats/JSONColumnsWithMetadata)) contain metadata with column names and types.
In schema inference for such formats, ClickHouse reads this metadata.

**Example**

```
DESC format(JSON, $$
{
    "meta":
    [
        {
            "name": "num",
            "type": "UInt8"
        },
        {
            "name": "str",
            "type": "String"
        },
        {
            "name": "arr",
            "type": "Array(UInt8)"
        }
    ],

    "data":
    [
        {
            "num": 42,
            "str": "Hello, World",
            "arr": [1,2,3]
        }
    ],

    "rows": 1,

    "statistics":
    {
        "elapsed": 0.005723915,
        "rows_read": 1,
        "bytes_read": 1
    }
}
$$)
```

```
┌─name─┬─type─────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┐
│ num  │ UInt8        │              │                    │         │                  │                │
│ str  │ String       │              │                    │         │                  │                │
│ arr  │ Array(UInt8) │              │                    │         │                  │                │
└──────┴──────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┘
```

### Avro[​](#avro "Direct link to Avro")

In Avro format ClickHouse reads its schema from the data and converts it to ClickHouse schema using the following type matches:

|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Avro data type ClickHouse data type|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `boolean` [Bool](/docs/sql-reference/data-types/boolean)| `int` [Int32](/docs/sql-reference/data-types/int-uint)| `int (date)` \* [Date32](/docs/sql-reference/data-types/date32)| `long` [Int64](/docs/sql-reference/data-types/int-uint)| `float` [Float32](/docs/sql-reference/data-types/float)| `double` [Float64](/docs/sql-reference/data-types/float)| `bytes`, `string` [String](/docs/sql-reference/data-types/string)| `fixed` [FixedString(N)](/docs/sql-reference/data-types/fixedstring)| `enum` [Enum](/docs/sql-reference/data-types/enum)| `array(T)` [Array(T)](/docs/sql-reference/data-types/array)| `union(null, T)`, `union(T, null)` [Nullable(T)](/docs/sql-reference/data-types/date)| `null` [Nullable(Nothing)](/docs/sql-reference/data-types/special-data-types/nothing)| `string (uuid)` \* [UUID](/docs/sql-reference/data-types/uuid)| `binary (decimal)` \* [Decimal(P, S)](/docs/sql-reference/data-types/decimal) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |

\* [Avro logical types](https://avro.apache.org/docs/current/spec.html#Logical+Types)

Other Avro types are not supported.

### Parquet[​](#parquet "Direct link to Parquet")

In Parquet format ClickHouse reads its schema from the data and converts it to ClickHouse schema using the following type matches: