What Is ORC Data Type?


Heather Bennett

The ORC (Optimized Row Columnar) data type is a file format designed for storing and processing large volumes of data in a highly efficient manner. It was developed by Hortonworks and later adopted by the Apache Software Foundation as an open-source project.

What are the advantages of using ORC?

ORC offers several advantages over other file formats such as CSV or JSON. One of the key benefits is its superior compression capabilities.

By using a combination of columnar storage and advanced compression techniques, ORC can significantly reduce the size of data on disk. This not only saves storage space but also improves query performance by reducing disk I/O.

Another advantage of ORC is its ability to support predicate pushdown, which allows filtering to be performed directly on the storage layer. This means that only relevant data is read from disk, resulting in faster query execution times.

Columnar Storage

One of the core principles behind ORC is columnar storage. Unlike row-based formats, where all columns are stored together, ORC stores each column separately. This allows for better compression ratios and more efficient query processing.

When data is stored in a columnar format, it becomes easier to compress similar values together. For example, if a column contains repeated values or a small set of distinct values, they can be compressed more effectively than in a row-based format.

Advanced Compression Techniques

In addition to columnar storage, ORC utilizes advanced compression techniques to further reduce the size of data on disk. It supports various compression algorithms such as Snappy, Zlib, and LZO.

The choice of compression algorithm depends on factors such as data type and desired level of compression. For example, Snappy provides fast compression and decompression speeds but may not achieve the highest level of compression ratio compared to Zlib.

How to use ORC?

To use ORC, you need to have a compatible data processing framework or tool. Several popular frameworks, including Apache Hive and Apache Spark, provide built-in support for ORC.

When working with ORC files, you can create tables or datasets that are stored in the ORC format. These tables can then be queried using SQL-like syntax or processed using APIs provided by the respective framework.

Creating an ORC Table

The syntax for creating an ORC table may vary depending on the framework you are using. In Hive, for example, you can create an ORC table using the following syntax:

CREATE TABLE my_table (
  column1 INT,
  column2 STRING

This creates a new table named “my_table” with two columns: “column1” of type INT and “column2” of type STRING. The data will be stored in the ORC format.

Loading Data into an ORC Table

Once you have created an ORC table, you can load data into it using various methods provided by your chosen framework. For example, in Apache Spark, you can load data from a CSV file into an ORC table as follows:

val myData = spark.read.format("csv").load("path/to/mydata.csv")

This loads data from a CSV file located at “path/to/mydata.csv” into a DataFrame called “myData”. The data is then written to the “my_table” table in the ORC format.


The ORC data type is a powerful file format for storing and processing large volumes of data efficiently. Its columnar storage and advanced compression techniques make it an ideal choice for data-intensive applications.

By utilizing ORC, you can optimize storage space, improve query performance, and take advantage of features such as predicate pushdown. With support from popular data processing frameworks, integrating ORC into your data pipeline becomes seamless.

Discord Server - Web Server - Private Server - DNS Server - Object-Oriented Programming - Scripting - Data Types - Data Structures

Privacy Policy