Repository navigation
Add more scalar literal types to the Python and JNI bindings - #10079
Conversation
Python (`vx.scalar` and anything that accepts an expression): - `datetime.time` as `vortex.time`, `datetime.date` as `vortex.date` and `datetime.datetime` as `vortex.timestamp`, taking the unit (and timezone) from a dtype hint and defaulting to microseconds (days for dates). Timezone-aware values store the UTC instant and take their zone name from `zoneinfo.ZoneInfo`, pytz or `datetime.timezone.utc`; pandas.Timestamp nanoseconds are kept for nanosecond timestamps. - `decimal.Decimal`, inferring precision and scale or rescaling exactly to a decimal dtype hint. - `uuid.UUID` as `vortex.uuid`. - Conversions that would lose precision raise ValueError instead of truncating. - Fix list and dict values with a list/struct dtype hint: the list was never returned, and struct fields were not cast to the field dtypes, which panicked. Both now cast each element/field to its dtype. - Document `vx.scalar`. JNI (`dev.vortex.api.Expression`): - `literalTime`/`nullLiteralTime` and `literalGeometry` (WKB decoded into the native spatial extension type). - `literalU8/U16/U32/U64`, `literalF16`, and U8-U64 and F16 null literals. - `literalList`, `literalFixedSizeList`, `literalStruct` and `literalMap` (plus null variants), assembled from literal expressions with a type prototype literal for element, key and value dtypes. - `Expression.spatial(SpatialFunction, ...)` for area, collect, contains, convex hull, distance, envelope, intersects, length and make-line, with the function codes pinned by the tag parity test. Signed-off-by: Robert Kruszewski <robert@spiraldb.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012A8yJW1z27J5b5N5TW2QMe
e4b8d80 to
bbc829f
Compare
Merging this PR will improve performance by 10.25%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | WallTime | scalar_subtract_neon |
12.1 µs | 11 µs | +10.25% |
| Simulation | bench_compare_primitive[(10000, 2)] |
< 1 ns | < 1 ns | N/A |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing claude/sleepy-tesla-7juwu4 (bbc829f) with develop (0ff1d1a)
Footnotes
-
409 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
Python (
vx.scalarand anything that accepts an expression):datetime.timeasvortex.time,datetime.dateasvortex.dateanddatetime.datetimeasvortex.timestamp, taking the unit (and timezone) from a dtype hint and defaulting to microseconds (days for dates). Timezone-aware values store the UTC instant and take their zone name fromzoneinfo.ZoneInfo, pytz ordatetime.timezone.utc; pandas.Timestamp nanoseconds are kept for nanosecond timestamps.decimal.Decimal, inferring precision and scale or rescaling exactly to a decimal dtype hint.uuid.UUIDasvortex.uuid.vx.scalar.JNI (
dev.vortex.api.Expression):literalTime/nullLiteralTimeandliteralGeometry(WKB decoded into the native spatial extension type).literalU8/U16/U32/U64,literalF16, and U8-U64 and F16 null literals.literalList,literalFixedSizeList,literalStructandliteralMap(plus null variants), assembled from literal expressions with a type prototype literal for element, key and value dtypes.Expression.spatial(SpatialFunction, ...)for area, collect, contains, convex hull, distance, envelope, intersects, length and make-line, with the function codes pinned by the tag parity test.part of #9913