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

> ORC 포맷 문서

# ORC

| 입력 | 출력 | 별칭 |
| -- | -- | -- |
| ✔  | ✔  |    |

<div id="description">
  ## 설명
</div>

[Apache ORC](https://orc.apache.org/)는 [Hadoop](https://hadoop.apache.org/) 생태계에서 널리 사용되는 열 지향 스토리지 포맷입니다.

<div id="data-types-matching-orc">
  ## 데이터 타입 매핑
</div>

아래 표는 `INSERT` 및 `SELECT` 쿼리에서 지원되는 ORC 데이터 타입과, 이에 대응하는 ClickHouse [데이터 타입](/ko/reference/data-types)을 비교합니다.

| ORC 데이터 타입 (`INSERT`)                 | ClickHouse 데이터 타입                                                                         | ORC 데이터 타입 (`SELECT`) |
| ------------------------------------- | ----------------------------------------------------------------------------------------- | --------------------- |
| `Boolean`                             | [UInt8](/ko/reference/data-types/int-uint)                                                | `Boolean`             |
| `Tinyint`                             | [Int8/UInt8](/ko/reference/data-types/int-uint)/[Enum8](/ko/reference/data-types/enum)    | `Tinyint`             |
| `Smallint`                            | [Int16/UInt16](/ko/reference/data-types/int-uint)/[Enum16](/ko/reference/data-types/enum) | `Smallint`            |
| `Int`                                 | [Int32/UInt32](/ko/reference/data-types/int-uint)                                         | `Int`                 |
| `Bigint`                              | [Int64/UInt32](/ko/reference/data-types/int-uint)                                         | `Bigint`              |
| `Float`                               | [Float32](/ko/reference/data-types/float)                                                 | `Float`               |
| `Double`                              | [Float64](/ko/reference/data-types/float)                                                 | `Double`              |
| `Decimal`                             | [Decimal](/ko/reference/data-types/decimal)                                               | `Decimal`             |
| `Date`                                | [Date32](/ko/reference/data-types/date32)                                                 | `Date`                |
| `Timestamp`                           | [DateTime64](/ko/reference/data-types/datetime64)                                         | `Timestamp`           |
| `String`, `Char`, `Varchar`, `Binary` | [String](/ko/reference/data-types/string)                                                 | `Binary`              |
| `List`                                | [Array](/ko/reference/data-types/array)                                                   | `List`                |
| `Struct`                              | [Tuple](/ko/reference/data-types/tuple)                                                   | `Struct`              |
| `Map`                                 | [Map](/ko/reference/data-types/map)                                                       | `Map`                 |
| `Int`                                 | [IPv4](/ko/reference/data-types/int-uint)                                                 | `Int`                 |
| `Binary`                              | [IPv6](/ko/reference/data-types/ipv6)                                                     | `Binary`              |
| `Binary`                              | [Int128/UInt128/Int256/UInt256](/ko/reference/data-types/int-uint)                        | `Binary`              |
| `Binary`                              | [Decimal256](/ko/reference/data-types/decimal)                                            | `Binary`              |

* 기타 타입은 지원되지 않습니다.
* 배열은 중첩할 수 있으며, 인수 값으로 `Nullable` 타입을 사용할 수 있습니다. `Tuple` 및 `Map` 타입도 중첩할 수 있습니다.
* ClickHouse 테이블 컬럼의 데이터 타입은 해당 ORC 데이터 필드와 일치할 필요가 없습니다. 데이터를 삽입할 때 ClickHouse는 위 표에 따라 데이터 타입을 해석한 다음, 이를 ClickHouse 테이블 컬럼에 설정된 데이터 타입으로 [형 변환](/ko/reference/functions/regular-functions/type-conversion-functions#CAST)합니다.

<div id="example-usage">
  ## 사용 예시
</div>

<div id="inserting-data">
  ### 데이터 삽입
</div>

다음 데이터가 들어 있는 `football.orc`라는 ORC 파일을 사용합니다:

```text theme={null}
    ┌───────date─┬─season─┬─home_team─────────────┬─away_team───────────┬─home_team_goals─┬─away_team_goals─┐
 1. │ 2022-04-30 │   2021 │ Sutton United         │ Bradford City       │               1 │               4 │
 2. │ 2022-04-30 │   2021 │ Swindon Town          │ Barrow              │               2 │               1 │
 3. │ 2022-04-30 │   2021 │ Tranmere Rovers       │ Oldham Athletic     │               2 │               0 │
 4. │ 2022-05-02 │   2021 │ Port Vale             │ Newport County      │               1 │               2 │
 5. │ 2022-05-02 │   2021 │ Salford City          │ Mansfield Town      │               2 │               2 │
 6. │ 2022-05-07 │   2021 │ Barrow                │ Northampton Town    │               1 │               3 │
 7. │ 2022-05-07 │   2021 │ Bradford City         │ Carlisle United     │               2 │               0 │
 8. │ 2022-05-07 │   2021 │ Bristol Rovers        │ Scunthorpe United   │               7 │               0 │
 9. │ 2022-05-07 │   2021 │ Exeter City           │ Port Vale           │               0 │               1 │
10. │ 2022-05-07 │   2021 │ Harrogate Town A.F.C. │ Sutton United       │               0 │               2 │
11. │ 2022-05-07 │   2021 │ Hartlepool United     │ Colchester United   │               0 │               2 │
12. │ 2022-05-07 │   2021 │ Leyton Orient         │ Tranmere Rovers     │               0 │               1 │
13. │ 2022-05-07 │   2021 │ Mansfield Town        │ Forest Green Rovers │               2 │               2 │
14. │ 2022-05-07 │   2021 │ Newport County        │ Rochdale            │               0 │               2 │
15. │ 2022-05-07 │   2021 │ Oldham Athletic       │ Crawley Town        │               3 │               3 │
16. │ 2022-05-07 │   2021 │ Stevenage Borough     │ Salford City        │               4 │               2 │
17. │ 2022-05-07 │   2021 │ Walsall               │ Swindon Town        │               0 │               3 │
    └────────────┴────────┴───────────────────────┴─────────────────────┴─────────────────┴─────────────────┘
```

데이터를 삽입하세요:

```sql theme={null}
INSERT INTO football FROM INFILE 'football.orc' FORMAT ORC;
```

<div id="reading-data">
  ### 데이터 읽기
</div>

`ORC` 포맷을 사용해 데이터를 읽습니다:

```sql theme={null}
SELECT *
FROM football
INTO OUTFILE 'football.orc'
FORMAT ORC
```

<Tip>
  ORC는 터미널에서 사람이 읽을 수 있는 형태로 표시되지 않는 바이너리 형식입니다. ORC 파일로 출력하려면 `INTO OUTFILE`을 사용하세요.
</Tip>

<div id="format-settings">
  ## 포맷 설정
</div>

| 설정                                                                                                                                                                                        | 설명                                                   | 기본값     |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | ------- |
| [`output_format_arrow_string_as_string`](/ko/reference/settings/formats#output_format_arrow_string_as_string)                                                                             | String 컬럼에 Binary 대신 Arrow String 타입을 사용합니다.         | `false` |
| [`output_format_orc_compression_method`](/ko/reference/settings/formats#output_format_orc_compression_method)                                                                             | 출력 ORC 포맷에서 사용하는 압축 방식입니다.                           | `none`  |
| [`input_format_arrow_case_insensitive_column_matching`](/ko/reference/settings/formats#input_format_arrow_case_insensitive_column_matching)                                               | Arrow 컬럼을 ClickHouse 컬럼과 매칭할 때 대소문자를 구분하지 않습니다.      | `false` |
| [`input_format_arrow_allow_missing_columns`](/ko/reference/settings/formats#input_format_arrow_allow_missing_columns)                                                                     | Arrow 데이터를 읽을 때 누락된 컬럼을 허용합니다.                       | `false` |
| [`input_format_arrow_skip_columns_with_unsupported_types_in_schema_inference`](/ko/reference/settings/formats#input_format_arrow_skip_columns_with_unsupported_types_in_schema_inference) | Arrow 형식의 스키마 추론 중 지원되지 않는 타입의 컬럼을 스키핑할 수 있도록 허용합니다. | `false` |

Hadoop과 데이터를 교환하려면 [HDFS 테이블 엔진](/ko/reference/engines/table-engines/integrations/hdfs)을 사용할 수 있습니다.
