notfilippo commented on issue #11513: URL: https://github.com/apache/datafusion/issues/11513#issuecomment-2245251759
> Now, i have add_one() function that can take 64-bit integer values and add +1 to them. The +1 operation is perfectly valid operation for i64 -- it's valid for sql long/bigint type. It's valid also for my_duration(nanos), but it's not valid for my_duration(micros), since it produces unaligned value (not divisible by 1000). @findepi -- If I understand correctly your example is about a the logical type `my_duration({micro | nano})` with the underlying physical type `int64`. In this case the type `my_duration(micro)` is logically different from `my_duration(nano)` (both logically different from an `int64`). Functions that have specialised implementations for `my_duration`, specified in their signature, would have to handle either case differently. Instead, functions such as `add_one(int64)` would have a signature accepting only logical `int64`s and not `my_duration`. Hypothetically, if `add_one` was to be edited to support `my_duration` (by accepting any numeric type) it would either have to provide a specific implementation for the `my_duration` logical type or it would've to materialise the array to a known numeric type like `int64`. The materialisation wouldn't necessarily match the underlying physical type and for this example I think it would make sense to materialise as an `int64` array with the number of nanoseconds (physical type) multiplied by the unit of the duration. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org