kosiew commented on code in PR #23723:
URL: https://github.com/apache/datafusion/pull/23723#discussion_r3680753812
##########
datafusion/functions-table/src/generate_series.rs:
##########
@@ -417,7 +450,24 @@ impl<T: SeriesValue> LazyBatchGenerator for
GenericSeriesState<T> {
.should_stop(self.end.clone(), &self.step, self.include_end)
{
buf.push(self.current.to_value_type());
- self.current.advance(&self.step)?;
+ if self
Review Comment:
The new `finished` guard fixes the exact boundary case by avoiding an extra
`advance` once the current value is already the final emitted value. I think
there is still one edge case left, though.
Consider:
```sql
SELECT * FROM generate_series(
TIMESTAMP '2262-04-11T23:47:16.854775806',
TIMESTAMP '2262-04-11T23:47:16.854775807',
INTERVAL '2' NANOSECOND
);
```
Here the current value is the last reachable value before `end`, but line
453 still calls `advance`, which attempts to compute `...775808` and returns
the Arrow overflow error.
I'd expect this to behave like the integer overflow case and return the
single reachable row (`...775806`) without an error.
Could we apply the same overflow-aware terminal handling to timestamp and
date series as well? It would also be great to add an SLT covering a
near-maximum timestamp or date where the next step would overshoot the
representable range.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]