ORC command-line import
Import ORC files through the command line: files are read from explicit paths, parsed and mapped, then written to TDengine. This does not monitor directories or expand wildcards. projection selects columns by case-sensitive root field names; misspelled names may be ignored.
Entry point: run taosx run on the host that holds the source files and has read permission. Prepare the target and verify results in the taosExplorer Data Browser or taos CLI.
First verify the format and types with a small file that has finished writing.
1. Prepare the file and mapping
Follow Shared preparation and mapping to prepare sample.orc and mapping.json. Check the ts, device, and temperature columns, millisecond time units, and source file records.
An authorized TDengine TSDB administrator must create the following in the taosExplorer Data Browser or taos CLI:
CREATE DATABASE orc_demo PRECISION 'ms';
CREATE STABLE orc_demo.temperatures (ts TIMESTAMP, temperature DOUBLE)
TAGS (device VARCHAR(32));
2. Run the import
Run taosx run --help first to confirm the program. Replace all user, password, and host placeholders in the target DSN with authorized information.
- Linux
- Windows
Run in Linux Bash from the working directory above:
taosx run -f 'orc:./sample.orc?batch_size=1000&projection=ts,device,temperature' -p '@./mapping.json' -t 'taos+ws://<用户>:<密码>@<目标主机>:6041/orc_demo'
Run the corresponding command in Windows PowerShell. The current directory must also contain both files. If the program is not in PATH, use its actual installation path:
taosx.exe run -f 'orc:./sample.orc?batch_size=1000&projection=ts,device,temperature' -p '@./mapping.json' -t 'taos+ws://<用户>:<密码>@<目标主机>:6041/orc_demo'
For command argument direction and credential requirements, see Shared preparation.
3. Parameters in this example
batch_size=1000 specifies rows read per batch and is also the direct DSN default. It does not limit the total import volume. When unprocessed_batches is unset, the runtime pipeline allows 64 pending batches. This is not a file count or disk cache; retain the default for the first run.
projection selects columns by root field name. This example must retain all three columns referenced by the model. Names are case-sensitive. Misspelled names may be ignored rather than immediately causing a column-selection error. First use source file tools to confirm the actual names of all three columns. Acceptance of the command arguments does not prove that the selected columns are correct. The column list does not reorder columns into the specified order.
Numeric projection uses the ORC type IDs of root fields, not column positions starting at 0. Nested types consume IDs, so do not copy Parquet column index settings directly or treat nested field IDs as independent output columns. Use column names for the first run; do not mix names and indices.
Multiple files can be listed in the source path, separated by commas, for example orc:./part-001.orc,./part-002.orc?batch_size=1000. First confirm that each file is readable and has a consistent structure. Do not use paths containing separators such as commas without testing them first. Multiple files are read concurrently with no guaranteed global order across files. *.orc in a path is not automatically expanded. For complete types, defaults, and conditions, see ORC read parameters.
4. Verification
Run the following in the taosExplorer Data Browser or taos CLI, then follow the Shared verification method to check this run's device and window:
SELECT ts, temperature, device FROM orc_demo.t_d001 ORDER BY ts LIMIT 20;
SELECT COUNT(*), MIN(ts), MAX(ts) FROM orc_demo.temperatures;
5. Troubleshooting
| Symptom or log keyword | Checks and next steps |
|---|---|
open orc file error | On the host running taosx run, check the current directory, each full path, and the runtime identity's read permission. Do not check a same-named directory on the browser host. |
build orc async reader error | Use source file tools to confirm that this is a complete ORC file, not same-named text, a file still being written, or a truncated file. Keep the original; changing the extension does not repair it. |
| Missing field or type error | Compare the source schema, column name case, projected fields, and mapping references. Correct the selected columns first, then check types. |
receive failed ack | Correlate it with write errors in the same run. It does not establish that the source file has not been read. |
Command exit or a file-read-completed message does not replace query verification.
For other task, write, and runtime issues, see Troubleshooting by symptom.
6. Stopping, recovery, and limitations
For interruptions and reruns, follow Rerun boundaries. Trial-import ORC nested types and special type conversions separately. A readable file does not mean that all its columns can be written.