Repository navigation
Conversation
… creation from same-size int32/64. Use inline visitor in PandasConverter
Change-Id: Ia9e2005448c2ec5280a5a8507bc37ee276555807
|
Rebased |
There was a problem hiding this comment.
Should this and the above use InvalidConversion?
There was a problem hiding this comment.
Does it make sense to have a constant NANOS_PER_DAY?
There was a problem hiding this comment.
And generally speaking to have a header with some constants for readability with things like npy_shift.
| } else if (PyDate_CheckExact(objects[i])) { | ||
| return ConvertDates(); | ||
| // We could choose Date32 or Date64 | ||
| return ConvertDates<Date64Type>(); |
There was a problem hiding this comment.
Thinking about this again, I wonder if Date32Type is the better choice here. It's smaller and still compatible with pandas and numpy. I think from a user's perspective they don't actually care, they just want it to be fast, correct and easily interoperable with existing systems. If 32 bit dates can satisfy those constraints just as easily as 64 bits, it might make more sense to go with 32.
There was a problem hiding this comment.
Yeah, this makes things more in line with Feather, too. Changing it
| template <typename Type> | ||
| typename std::enable_if<std::is_base_of<TimeType, Type>::value, Status>::type Visit( | ||
| const Type& type) { | ||
| return Status::NotImplemented("time type"); |
There was a problem hiding this comment.
Maybe this should say "Don't know how to serialize Arrow time type to NumPy" or something that's a little more indicative of where the failure is happening.
|
|
||
| # Shift to seconds since epoch | ||
| return datetime.datetime.utcfromtimestamp( | ||
| int(ap.Value(self.index)) * 86400).date() |
There was a problem hiding this comment.
Is it necessary to cast this to int here?
There was a problem hiding this comment.
Yeah, I got burned here because ap.Value returns int32_t and multiplying by 86400 caused an overflow
|
Nothing major, just thinking a bit about the 32 vs 64 choice for |
Change-Id: I8528eb0ea1ae95c30e3a2636ca1b5ad86e087730
Change-Id: Idc98f25c0da2565975d56f44748f666ca201f84a
|
OK, I'll merge this once the build runs |
|
|
||
| if (type == Type::DATE64) { | ||
| if (type == Type::DATE32) { | ||
| // Date64Type is millisecond timestamp stored as int64_t |
There was a problem hiding this comment.
Comment does not match the called code.
Would appreciate a close look from @xhochy, @cpcloud. Also did some inline visitor cleaning for nicer code reuse