ORC
Load ORC files into a warehouse with Stream Load, Broker Load, or a table-valued function. Choose the method based on the file location and whether you need asynchronous loading or SQL transformations.
Before you start
Create or select the target database, and use a warehouse SQL user with the required table and load permissions. Copy the Stream Load request URL from Connection Methods. Replace <endpoint> with its scheme, host, and port, and preserve HTTPS when it is required. Replace <username> with your warehouse SQL username. The curl commands prompt for your password.
For object storage, HDFS, or Kafka, confirm that your warehouse can reach the source and use its supported authentication settings. HDFS and private-network access depend on your deployment. Each SQL snippet is a separate example. Replace source paths, connection properties, and job labels before running it.
Supported import methods
The following table lists the import methods available in VeloDB Cloud for ORC format and their applicable scenarios:
| Import method | Applicable scenario | Documentation link |
|---|---|---|
| Stream Load | Push ORC files from a local machine or client over HTTP | Stream Load |
| Broker Load | Asynchronously batch import ORC files from object storage or HDFS | Broker Load |
| INSERT INTO FROM S3 TVF | Read ORC files on S3 through a table-valued function | S3 TVF |
| INSERT INTO FROM HDFS TVF | Read ORC files on HDFS through a table-valued function | HDFS TVF |
Usage examples
This section shows typical usage of the ORC format by import method. In every example, replace placeholders such as <username>, <endpoint>, and bucket with the actual values for your environment.
Load with Stream Load
Use this method to push a local ORC file to VeloDB Cloud over HTTP:
curl --location-trusted -u "<username>" \
-H "format: orc" \
-T example.orc \
"<endpoint>/api/example_db/example_table/_stream_load"
Key points:
- Specify the data format as ORC through the request header
-H "format: orc". - Use
-Tto specify the path of the local ORC file to import. - The URL must specify the target database and target table.
Load with Broker Load
Use this method to batch import ORC files from object storage (such as S3) or HDFS:
LOAD LABEL example_db.example_label
(
DATA INFILE("s3://bucket/example.orc")
INTO TABLE example_table
FORMAT AS "orc"
)
WITH S3
(
"s3.endpoint" = "https://<s3-endpoint>",
"s3.region" = "<region>",
"s3.access_key" = "<access-key>",
"s3.secret_key" = "<secret-key>"
);
Key points:
- Use
FORMAT AS "orc"to explicitly declare the data file format. - Fill in the storage path of the ORC file in
DATA INFILE. - Provide the access credentials and other connection information for the object storage in
WITH S3 (...).
Load with a TVF
Use this method to query a remote ORC file directly through a table-valued function (TVF) and write the result into a table:
INSERT INTO example_table
SELECT *
FROM S3
(
"uri" = "s3://bucket/example.orc",
"format" = "orc",
"s3.endpoint" = "https://<s3-endpoint>",
"s3.region" = "<region>",
"s3.access_key" = "<access-key>",
"s3.secret_key" = "<secret-key>"
);
Key points:
- Specify the data format with
"format" = "orc"in the TVF parameters. - Use
"uri"to specify the path of the ORC file in object storage or HDFS. - You can add column pruning, filtering, or transformation logic in the
SELECTclause before writing to the target table.
FAQ
Q1: Is it required to explicitly specify the format parameter when importing ORC files?
Yes. Whether you use Stream Load, Broker Load, or a TVF, you must explicitly declare format as orc. Otherwise, the data is parsed in the default format (such as CSV), which causes the import to fail.
Q2: How do you choose between Stream Load, Broker Load, and TVF when importing ORC files?
- For local or client-side files with a small data volume, prefer Stream Load.
- For large batches of files on remote object storage or HDFS, prefer Broker Load.
- When you need to perform column pruning, filtering, or transformation during the import, prefer TVF (
INSERT INTO ... SELECT FROM S3/HDFS).
Q3: Which connection settings must you replace?
Replace the bucket, endpoint, region, and credentials with values for your source. The snippets use access keys as an example. Use the authentication method supported by your deployment and source. See the loading method reference for the full parameter list.
Common errors
- Authentication or connection failure: Check the generated warehouse endpoint, TLS requirements, SQL user permissions, and network access. For remote files, also check source credentials and reachability.
- Filtered rows or parsing errors: Check the input format, delimiters, field mappings, and target column types. Inspect the returned load error before retrying. Raising the filter tolerance can discard data.
- Unexpected duplicate rows: These examples use independent loads. Check the table model and existing rows before rerunning a sample.