You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/02/20 12:37:53 UTC

[GitHub] [arrow-datafusion] alamb opened a new issue, #5346: Window function: Internal error: Operator + is not implemented for types

alamb opened a new issue, #5346:
URL: https://github.com/apache/arrow-datafusion/issues/5346

   **Describe the bug**
   I get an internal error on a window query:
   
   ```
   query error DataFusion error: Internal error: Operator + is not implemented for types Int8(5) and Utf8("1"). This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker
   ```
   
   
   **To Reproduce**
   Run this sql in the `datafusion` checkout (where `aggregate_test_100.csv` is)
   
   ```sql
   CREATE EXTERNAL TABLE aggregate_test_100 (
     c1  VARCHAR NOT NULL,
     c2  TINYINT NOT NULL,
     c3  SMALLINT NOT NULL,
     c4  SMALLINT,
     c5  INT,
     c6  BIGINT NOT NULL,
     c7  SMALLINT NOT NULL,
     c8  INT NOT NULL,
     c9  BIGINT UNSIGNED NOT NULL,
     c10 VARCHAR NOT NULL,
     c11 FLOAT NOT NULL,
     c12 DOUBLE NOT NULL,
     c13 VARCHAR NOT NULL
   )
   STORED AS CSV
   WITH HEADER ROW
   LOCATION './testing/data/csv/aggregate_test_100.csv';
   
   SELECT
   SUM(c4) OVER(ORDER BY c2 DESC RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING),
   SUM(c3) OVER(ORDER BY c2 DESC RANGE BETWEEN 10000 PRECEDING AND 10000 FOLLOWING),
   COUNT(*) OVER(ORDER BY c2 DESC RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING)
   FROM aggregate_test_100
   ORDER BY c9
   LIMIT 5;
   ```
   
   Results in 
   
   ```
   ❯ SELECT
   SUM(c4) OVER(ORDER BY c2 DESC RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING),
   SUM(c3) OVER(ORDER BY c2 DESC RANGE BETWEEN 10000 PRECEDING AND 10000 FOLLOWING),
   COUNT(*) OVER(ORDER BY c2 DESC RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING)
   FROM aggregate_test_100
   ORDER BY c9
   LIMIT 5
   ;
   Internal("Operator + is not implemented for types Int8(5) and Utf8(\"1\")")
   ❯
   ```
   
   **Expected behavior**
   Test should pass
   
   
   **Additional context**
   Found on https://github.com/apache/arrow-datafusion/pull/5330 (for some reason the error didn't happen in the rust based test setup)


-- 
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-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] mustafasrepo commented on issue #5346: Window function: Internal error: Operator + is not implemented for types

Posted by "mustafasrepo (via GitHub)" <gi...@apache.org>.
mustafasrepo commented on issue #5346:
URL: https://github.com/apache/arrow-datafusion/issues/5346#issuecomment-1441631579

   I have debugged this problem. It originates when value of `RANGE` cannot be casted to type used in the `ORDER BY` column. The reason above test passes in rust and not in cli is that, In rust test cases for c2 column we use `Uint32`, whereas in cli test `Int8` is used. Below, test reproduces the issue in rust. 
   ```
   #[tokio::test]
   async fn window_frame_large_range() -> Result<()> {
       let ctx = SessionContext::new();
       register_aggregate_csv(&ctx).await?;
       // 10000 is outside the valid range for Int8 (type of c3). In this case we should be able to still produce correct result.
       // See issue: https://github.com/apache/arrow-datafusion/issues/5346
       let sql = "SELECT
                  SUM(c3) OVER(ORDER BY c3 DESC RANGE BETWEEN 10000 PRECEDING AND 10000 FOLLOWING) as summation1
                  FROM aggregate_test_100
                  ORDER BY c9
                  LIMIT 5";
       let actual = execute_to_batches(&ctx, sql).await;
       let expected = vec![
           "+------------+",
           "| summation1 |",
           "+------------+",
           "| 781        |",
           "| 781        |",
           "| 781        |",
           "| 781        |",
           "| 781        |",
           "+------------+",
       ];
       assert_batches_eq!(expected, &actual);
       Ok(())
   }
   ```
   


-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] ozankabak commented on issue #5346: Window function: Internal error: Operator + is not implemented for types

Posted by "ozankabak (via GitHub)" <gi...@apache.org>.
ozankabak commented on issue #5346:
URL: https://github.com/apache/arrow-datafusion/issues/5346#issuecomment-1441265328

   We will take a look at this once we finish up tasks at hand.


-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] avantgardnerio closed issue #5346: Window function: Internal error: Operator + is not implemented for types

Posted by "avantgardnerio (via GitHub)" <gi...@apache.org>.
avantgardnerio closed issue #5346: Window function: Internal error: Operator + is not implemented for types
URL: https://github.com/apache/arrow-datafusion/issues/5346


-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org