Skip to content

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

Open
divjotarora wants to merge 1 commit 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 1 commit 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.


return ::arrow::fixed_size_binary(physical_length);
case LogicalType::Type::TIMESTAMP:
return ::arrow::fixed_size_binary(physical_length);

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 this should probably be configurable. We should probably have a mode that takes returns the arrow timestamp type (and either errors on overflow or converts to MIN/MAX representable values., maybe a different config value?)

ASSERT_EQ(kNumRows, levels_read);
ASSERT_EQ(kNumRows, values_read);
min_value.assign(reinterpret_cast<const char*>(values[kMinRow].ptr), 12);
max_value.assign(reinterpret_cast<const char*>(values[kMaxRow].ptr), 12);

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.

would it also make sense to make sure our comparator is consistent with these values?

const bool a_neg = (a.ptr[11] & 0x80) != 0;
const bool b_neg = (b.ptr[11] & 0x80) != 0;
if (a_neg != b_neg) return a_neg;
for (int i = 11; i >= 0; --i) if (a.ptr[i] != b.ptr[i]) return a.ptr[i] < b.ptr[i];

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.

do the two step integer comparison?

@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

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.

2 participants