Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Parquet] TimestampPrecision / TimestampUnit mismatch in read / write files, particular for unit tests #11607

Open
zuyu opened this issue Nov 20, 2024 · 3 comments
Labels
bug Something isn't working triage Newly created issue that needs attention.

Comments

@zuyu
Copy link
Contributor

zuyu commented Nov 20, 2024

Bug description

enum class TimestampPrecision : int8_t {
kMilliseconds = 3, // 10^3 milliseconds are equal to one second.
kMicroseconds = 6, // 10^6 microseconds are equal to one second.
kNanoseconds = 9, // 10^9 nanoseconds are equal to one second.
};

enum class TimestampUnit : uint8_t {
kSecond = 0 /*10^0 second is equal to 1 second*/,
kMilli = 3 /*10^3 milliseconds are equal to 1 second*/,
kMicro = 6 /*10^6 microseconds are equal to 1 second*/,
kNano = 9 /*10^9 nanoseconds are equal to 1 second*/
};

Proposed Fixes

  • Introduce a new kNotSet as the default value, and requires setting both TimestampPrecision and TimestampUnit if reading / writing a timestamp column. Otherwise, an assertion VELOX_UNREACHABLE() would trigger.
  • For timestamp-related unit tests, need to align the values for both TimestampPrecision and TimestampUnit.
@zuyu zuyu added bug Something isn't working triage Newly created issue that needs attention. labels Nov 20, 2024
@Yuhta
Copy link
Contributor

Yuhta commented Nov 20, 2024

I would say just align them. Adding kNotSet will make the thing unnecessarily complicated.

@zuyu
Copy link
Contributor Author

zuyu commented Nov 21, 2024

@Yuhta How about TimestampUnit::kSecond, remove it or add TimestampPrecision::kSecond? I prefer to removing it, as it equals to that nanos is 0.

@Yuhta
Copy link
Contributor

Yuhta commented Nov 21, 2024

@zuyu We can remove it if neither Presto or Spark support it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Newly created issue that needs attention.
Projects
None yet
Development

No branches or pull requests

2 participants