-
Notifications
You must be signed in to change notification settings - Fork 839
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
Confusion over Date64 array values #5288
Comments
https://lists.apache.org/thread/q036r1q3cw5ysn3zkpvljx3s9ho18419 TLDR, its for compatibility with some language's native libraries. It is certainly an odd one
This would be consistent with how we handle decimals FWIW, validating always is too much of a performance hit, not to mention complex to implement |
Right, I see. So I guess for the sake of backward compatibility, arrow-rs would maintain its current behaviour for Date64 (essentially treating it like a timestamp, being able to extract a non-zero hour/minute/second from it and displaying the time as part of pretty print), but some changes can be made to clarify things for users:
|
Could probably go so far as to state that most use-cases should prefer Date32 or Timestamp depending on their use-case |
Which part is this question about
Date64 array values.
Describe your question
Docs for Date64 type states:
arrow-rs/arrow-schema/src/datatype.rs
Lines 150 to 152 in a61e824
Schema.fbs
docs: https://github.com/apache/arrow/blob/37a8bf04bc713858a5b247d4424c1e8505e61947/format/Schema.fbs#L245-L253This seems to suggest that Date64 should NOT store time, and should only represent days since UNIX epoch, akin to Date32 (but as milliseconds, not days).
What is the point of Date64 type, then? It would be the same as Date32 but multiplied by 86400000 assuming it's used according to spec.
The bold is important, as there are examples where you can set values that are not evenly divisible by the factor, and the printing code even shows the time as well:
arrow-rs/arrow-cast/src/pretty.rs
Lines 476 to 487 in a61e824
The C++ implementation seems to have a validate function, see apache/arrow#12014
But I can still set 'invalid' values via PyArrow as this full validation is optional:
So I'm just wondering, even if we implement some sort of validation on these values (there is this old issue on the arrow repo: apache/arrow#26853), if this is not made mandatory, then what is the point of having that restriction on Date64 type?
Do we need to implement this optional validation on arrow-rs too, and also fix the print code to not show the time for Date64? Or just embrace that Date64 will also store time, contrary to the docs (both in arrow-rs and the official arrow repo)?
Additional context
This might be a wider arrow discussion, I'm not sure if it's been had before, feel free to link if so.
Came across this whilst looking into #5266
As I wasn't sure, given the case of a Date64 array, whether extracting the millisecond part should always return 0 (assuming the array contains valid values) or should return the actual milliseconds part (though that would technically mean the value is invalid?)
The text was updated successfully, but these errors were encountered: