Skip to content

GH-50915: [FORMAT] Allow TIMESTAMP logical type to annotate FIXED_LEN_BYTE_ARRAY(12) - #50916

Open
divjotarora wants to merge 8 commits into
apache:mainfrom
divjotarora:flba-12
Open

GH-50915: [FORMAT] Allow TIMESTAMP logical type to annotate FIXED_LEN_BYTE_ARRAY(12)#50916
divjotarora wants to merge 8 commits into
apache:mainfrom
divjotarora:flba-12

Conversation

@divjotarora

@divjotarora divjotarora commented Aug 19, 2026

Copy link
Copy Markdown

Rationale for this change

See apache/parquet-format#600 for rationale.

What changes are included in this PR?

This PR adds support for using TimestampType to annotate FIXED_LEN_BYTE_ARRAY(12) values.

Are these changes tested?

Yes, via unit tests and an e2e test that reads the file added in parquet-testing (apache/parquet-testing#123).

Are there any user-facing changes?

No

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #50915 has been automatically assigned in GitHub to PR creator.

Comment thread cpp/src/parquet/arrow/schema_internal.cc
Comment thread cpp/src/parquet/reader_test.cc
Comment thread cpp/src/parquet/statistics.cc Outdated

@emkornfield emkornfield left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions and comments I think the biggest one is scope and whether we should have an option to convert this value to a proper arrow type. Wemight also want to make it configurable the target of the arrow type

@github-actions github-actions Bot added the awaiting review Awaiting review label Aug 20, 2026
Comment thread cpp/src/parquet/arrow/arrow_reader_writer_test.cc Outdated
@github-actions github-actions Bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Sep 3, 2026
Comment thread cpp/src/parquet/arrow/reader_internal.cc Outdated
Comment thread cpp/src/parquet/arrow/reader_internal.cc Outdated
Comment thread cpp/src/parquet/arrow/schema_internal.cc Outdated
Comment thread cpp/src/parquet/properties.h Outdated
Comment thread cpp/src/parquet/arrow/reader_internal.cc Outdated
Comment thread cpp/src/parquet/arrow/reader_internal.cc Outdated

@emkornfield emkornfield left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the conversion code always assumes a 1:1 mapping between arrow timestamp granularity and parquet granularity. I think in the common path when schema is inferred this is workable, but IIRC users can also supply there own schema (we should add test coverage for this path).

Comment thread cpp/src/parquet/properties.h Outdated
Comment thread cpp/src/parquet/properties.h Outdated
@divjotarora

Copy link
Copy Markdown
Author

I think the conversion code always assumes a 1:1 mapping between arrow timestamp granularity and parquet granularity. I think in the common path when schema is inferred this is workable, but IIRC users can also supply there own schema (we should add test coverage for this path).

There doesn't seem to be an API at this level to supply a custom schema. The Arrow timestamp unit is derived from the Parquet logical type during schema conversion and that's passed down to the data converters. Based on this, I don't think any scaling is needed in this PR. To ensure correctness, I added a defensive check that fails the conversion if the Arrow and Parquet units differ.

Comment thread cpp/src/parquet/arrow/reader_internal.cc Outdated
Comment thread cpp/src/parquet/arrow/reader_internal.cc Outdated

@emkornfield emkornfield left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more thing to look at. I need to double check if there is a better idiom to express the conversion we want to do here, but we should at least look at using the visitor.

Comment thread cpp/src/parquet/arrow/arrow_reader_writer_test.cc Outdated

@emkornfield emkornfield left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one more missing test case I think.

@emkornfield

Copy link
Copy Markdown
Contributor

@divjotarora looks like parquet-reader-test is failing (didn't look at root cause)

@divjotarora

Copy link
Copy Markdown
Author

@emkornfield The new FLBA 12 timestamp test is failing, but it's due to:

unknown file: Failure
C++ exception with description "IOError: Failed to open local file '/arrow/cpp/submodules/parquet-testing/data/flba12_timestamp.parquet'
/arrow/cpp/src/arrow/io/file.cc:106  ::arrow::internal::FileOpenReadable(file_name_)
/arrow/cpp/src/arrow/io/file.cc:307  file->impl_->Open(path). Detail: [errno 2] No such file or directory" thrown in the test body.

AFAICT this is expected as the test is referencing a parquet-testing file that's not merged in. I think this will pass once we merge apache/parquet-testing#123 and update the submodule hash in this repo. I've verified that it passes locally be overriding PARQUET_TEST_DATA

@emkornfield emkornfield left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look reasonable we can fix CI once vote passes and artifacts are merged.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants