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

> Documentación sobre el formato ORC

# ORC

| Entrada | Salida | Alias |
| ------- | ------ | ----- |
| ✔       | ✔      |       |

<div id="description">
  ## Descripción
</div>

[Apache ORC](https://orc.apache.org/) es un formato de almacenamiento columnar ampliamente utilizado en el ecosistema de [Hadoop](https://hadoop.apache.org/).

<div id="data-types-matching-orc">
  ## Correspondencia de tipos de datos
</div>

La siguiente tabla compara los tipos de datos ORC compatibles y sus correspondientes [tipos de datos](/es/reference/data-types/index) de ClickHouse en las consultas `INSERT` y `SELECT`.

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

* Los demás tipos no son compatibles.
* Los arrays pueden anidarse y pueden tener un valor de tipo `Nullable` como argumento. Los tipos `Tuple` y `Map` también pueden anidarse.
* Los tipos de datos de las columnas de una tabla de ClickHouse no tienen por qué coincidir con los campos de datos ORC correspondientes. Al insertar datos, ClickHouse interpreta los tipos de datos según la tabla anterior y luego [convierte](/es/reference/functions/regular-functions/type-conversion-functions#CAST) los datos al tipo de dato definido para la columna de la tabla de ClickHouse.

<div id="example-usage">
  ## Ejemplo de uso
</div>

<div id="inserting-data">
  ### Inserción de datos
</div>

Usa un archivo ORC con los siguientes datos, llamado `football.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 │
    └────────────┴────────┴───────────────────────┴─────────────────────┴─────────────────┴─────────────────┘
```

Inserte los datos:

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

<div id="reading-data">
  ### Lectura de datos
</div>

Lea los datos en formato `ORC`:

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

<Tip>
  ORC es un formato binario que no puede mostrarse en la terminal de forma legible para humanos. Use `INTO OUTFILE` para generar archivos ORC.
</Tip>

<div id="format-settings">
  ## Configuración de formatos
</div>

| Configuración                                                                                                                                                                             | Descripción                                                                                              | Predeterminado |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------- |
| [`output_format_arrow_string_as_string`](/es/reference/settings/formats#output_format_arrow_string_as_string)                                                                             | Usar el tipo String de Arrow en lugar de Binary para las columnas String.                                | `false`        |
| [`output_format_orc_compression_method`](/es/reference/settings/formats#output_format_orc_compression_method)                                                                             | Método de compresión usado para el formato ORC de salida. Valor predeterminado                           | `none`         |
| [`input_format_arrow_case_insensitive_column_matching`](/es/reference/settings/formats#input_format_arrow_case_insensitive_column_matching)                                               | Ignorar mayúsculas y minúsculas al hacer coincidir las columnas de Arrow con las columnas de ClickHouse. | `false`        |
| [`input_format_arrow_allow_missing_columns`](/es/reference/settings/formats#input_format_arrow_allow_missing_columns)                                                                     | Permitir columnas ausentes al leer datos Arrow.                                                          | `false`        |
| [`input_format_arrow_skip_columns_with_unsupported_types_in_schema_inference`](/es/reference/settings/formats#input_format_arrow_skip_columns_with_unsupported_types_in_schema_inference) | Permitir omitir columnas con tipos no compatibles durante la inferencia de esquema del formato Arrow.    | `false`        |

Para intercambiar datos con Hadoop, puede usar el [motor de tablas HDFS](/es/reference/engines/table-engines/integrations/hdfs).
