2010YOUY01 opened a new issue, #12815:
URL: https://github.com/apache/datafusion/issues/12815

   ### Describe the bug
   
   See the reproducer in datafusion-cli (compiled from the latest main, commit 
https://github.com/apache/datafusion/commit/84c94097896e9d08e40d63e8c505414ea70e8b29)
   
   ```shell
   /*DML*/CREATE TABLE t41(v0 DOUBLE, v1 BOOLEAN, v2 STRING, v3 STRING);
   /*DML*/INSERT INTO t41(v0, v2) VALUES ('NaN'::Double, 'd殪s7'), 
(0.4097890978398071, '顼)j');
   
   > SELECT NTH_VALUE(tt0.v0, NULL) OVER (PARTITION BY tt0.v2 ORDER BY tt0.v0) 
FROM t41 AS tt0;
   thread 'main' panicked at 
/Users/yongting/Desktop/code/my_datafusion/arrow-datafusion/datafusion/physical-expr/src/window/nth_value.rs:195:63:
   attempt to subtract with overflow
   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
   
   ```
   
   ### To Reproduce
   
   _No response_
   
   ### Expected behavior
   
   Returns 2 rows of `Null`
   Run in duckdb:
   ```shell
   D /*DML*/CREATE TABLE t41(v0 DOUBLE, v1 BOOLEAN, v2 STRING, v3 STRING);
   D /*DML*/INSERT INTO t41(v0, v2) VALUES ('NaN'::Double, 'd殪s7'), 
(0.4097890978398071, '顼)j');
   D SELECT NTH_VALUE(tt0.v0, NULL) OVER (PARTITION BY tt0.v2 ORDER BY tt0.v0) 
FROM t41 AS tt0;
   ┌────────────────────────────────────────────────────────────────────┐
   │ nth_value(tt0.v0, NULL) OVER (PARTITION BY tt0.v2 ORDER BY tt0.v0) │
   │                               double                               │
   ├────────────────────────────────────────────────────────────────────┤
   │                                                                    │
   │                                                                    │
   └────────────────────────────────────────────────────────────────────┘
   ```
   
   ### Additional context
   
   Found by SQLancer https://github.com/apache/datafusion/issues/11030


-- 
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.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

Reply via email to