Skip to content

Feat/orc reader liborc - #1017

Open
ShreyasGS wants to merge 8 commits into
daphne-project:mainfrom
ShreyasGS:feat/orc-reader-liborc
Open

ShreyasGS wants to merge 8 commits into
daphne-project:mainfrom
ShreyasGS:feat/orc-reader-liborc

Conversation

@ShreyasGS

@ShreyasGS ShreyasGS commented Jul 24, 2026 •

Copy link
Copy Markdown

Summary

ORC reader for DAPHNE, using Apache ORC's C++ library directly. Supports DenseMatrix<double>, DenseMatrix<int64_t>, and Frame with mixed value types. Refs #985.

What this does

  • Reads ORC files into DenseMatrix and Frame, matching the file-I/O extension signature from An Infrastructure for Extendable Input/Output File Format Support in DAPHNE #993.
  • Frame columns typed ValueTypeCode::STR decode from ORC STRING.
  • Column projection via options["columns"] — a comma-separated list of ORC file column names. Only listed columns are decoded (via liborc's include()), in user-specified order. Duplicate names, missing names, and whitespace edge cases are handled with clear errors.
  • Predicate push-down via options["predicate"] — a single-clause predicate <col> <op> <literal> (ops: =, !=, <, <=, >, >=; literals: integer, float, single-quoted string). Builds an orc::SearchArgument for stripe-level skipping and applies a per-row filter for correctness. When set, the caller passes *res == nullptr and the reader allocates the result at the true matching-row count.
  • Nulls, VARCHAR/CHAR, and unsupported value types are errors.

Tests

44 Catch2 test cases in `test/runtime/local/io/ReadOrcTestpaths, string reads, projection, predicates. All passinside the DAPHNE dev container.

Build

Apache ORC is built from source with position-independent code and installed to .deps/orc/ (git-ignored).

Adds .deps/ to gitignore so locally-built Apache ORC artifacts
at .deps/orc/ do not end up in commits.
Initial reader for the Apache ORC file format (refs daphne-project#985).

Includes:
- src/runtime/local/io/ReadOrc.h — header-only reader matching PR
  daphne-project#993's reader signature. Dispatched from Read.h's existing if/else
  chain until daphne-project#993 lands.
- Read.h: .orc dispatch for Read<DenseMatrix<VT>> and Read<Frame>.
- CMake: liborc wired in as a static dep at .deps/orc/, built from
  apache/orc v2.0.0 against the container's system protobuf.
- 12 Catch2 tests plus pyarrow-generated fixtures.

Build notes for reviewers:
- Apache ORC is built locally at .deps/orc/ (gitignored):
    git clone --branch v2.0.0 https://github.com/apache/orc.git .deps/orc-src
    cd .deps/orc-src && mkdir build && cd build
    cmake -DCMAKE_INSTALL_PREFIX=$(pwd)/../../orc \
          -DBUILD_JAVA=OFF -DBUILD_TOOLS=OFF -DBUILD_CPP_TESTS=OFF \
          -DBUILD_POSITION_INDEPENDENT_LIB=ON \
          -DPROTOBUF_HOME=/usr/local ..
    make -j$(nproc) install
- The daphne-dev container should include this step for reproducible
  builds upstream.

Refs: daphne-project#985
Refs: daphne-project#993
Frame columns of ValueTypeCode::STR now decode from ORC STRING into
std::string. VARCHAR/CHAR still throw via the type-kind mismatch path.
DenseMatrix<string> stays rejected at Read.h.
Reader honours options["columns"], a comma-separated list of ORC file column names. Only listed columns are decoded via liborc's include(). User-requested order is preserved as output column order. Duplicates and missing names throw. Whitespace is trimmed. Absence of the key preserves whole-file behaviour.
Reader honours options["predicate"], a single-clause predicate of the form <col> <op> <literal>. Builds an orc::SearchArgument for stripe-level skipping and does a per-row filter for correctness. Ops: =, !=, <, <=, >, >=. Literals: integer, float, single-quoted string. When the predicate is set the caller must pass *res == nullptr; the reader allocates the final DenseMatrix/Frame at the true matching-row count.
@ShreyasGS
ShreyasGS force-pushed the feat/orc-reader-liborc branch from a758a06 to 2d9d208 Compare August 1, 2026 21:46
Style cleanup for consistency with the rest of the codebase.

- Replace U+2014 em dashes with ASCII hyphens across ReadOrc.h,
  ReadOrcTest.cpp, gen_orc_test_data.py, and OrcIO.md. No sibling
  file in src/ or doc/ uses em dashes.
- Retitle OrcIO.md headings to Title Case for consistency with
  HDFSUsage.md and BinaryFormat.md.
- Move .deps/ under the '# dependencies' block in .gitignore next
  to thirdparty/*.
- Add Apache 2.0 header to gen_orc_test_data.py to match the
  convention of the other Python files in the repo.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant