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/01/25 17:16:04 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #5055: Minor: Move some aggregate error tests to sqllogictests

alamb commented on code in PR #5055:
URL: https://github.com/apache/arrow-datafusion/pull/5055#discussion_r1086927523


##########
datafusion/core/tests/sqllogictests/test_files/aggregate.slt:
##########
@@ -36,6 +36,53 @@ STORED AS CSV
 WITH HEADER ROW
 LOCATION '../../testing/data/csv/aggregate_test_100.csv'
 
+#######
+# Error tests
+#######
+
+# https://github.com/apache/arrow-datafusion/issues/3353
+statement error Aggregations require unique expression names
+SELECT approx_distinct(c9) count_c9, approx_distinct(cast(c9 as varchar)) count_c9_str FROM aggregate_test_100
+
+# csv_query_approx_percentile_cont_with_weight()
+statement error Error during planning: The function ApproxPercentileContWithWeight does not support inputs of type Utf8.
+SELECT approx_percentile_cont_with_weight(c1, c2, 0.95) FROM aggregate_test_100
+
+statement error  Error during planning: The weight argument for ApproxPercentileContWithWeight does not support inputs of type Utf8
+SELECT approx_percentile_cont_with_weight(c3, c1, 0.95) FROM aggregate_test_100
+
+statement error Error during planning: The percentile argument for ApproxPercentileContWithWeight must be Float64, not Utf8
+SELECT approx_percentile_cont_with_weight(c3, c2, c1) FROM aggregate_test_100
+
+
+# csv_query_approx_percentile_cont_with_weight

Review Comment:
   Good call with duplicated block. Thank you 🙏 
   
   
   
   As for the error messages, I am not sure what you mean by "though sqllogictests completely ignores actual error message - even"
   
   I tried changing the expected error message like this
   
   ```diff
   diff --git a/datafusion/core/tests/sqllogictests/test_files/aggregate.slt b/datafusion/core/tests/sqllogictests/test_files/aggregate.slt
   index 3b527dcd8..6931018da 100644
   --- a/datafusion/core/tests/sqllogictests/test_files/aggregate.slt
   +++ b/datafusion/core/tests/sqllogictests/test_files/aggregate.slt
   @@ -56,7 +56,7 @@ SELECT approx_percentile_cont_with_weight(c3, c2, c1) FROM aggregate_test_100
    
    
    # csv_query_approx_percentile_cont_with_weight
   -statement error Error during planning: The function ApproxPercentileContWithWeight does not support inputs of type Utf8.
   +statement error some random text
    SELECT approx_percentile_cont_with_weight(c1, c2, 0.95) FROM aggregate_test_100
    
    statement error Error during planning: The weight argument for ApproxPercentileContWithWeight does not support inputs of type Utf8
   ```
   
   And then test failed, as I expected:
   ```shell
   cargo test --test sqllogictests
   ....
   STORED AS CSV
   WITH HEADER ROW
   LOCATION '../../testing/data/csv/aggregate_test_100.csv'"
   [aggregate.slt] Running query: "SELECT approx_distinct(c9) count_c9, approx_distinct(cast(c9 as varchar)) count_c9_str FROM aggregate_test_100"
   [aggregate.slt] Running query: "SELECT approx_percentile_cont_with_weight(c1, c2, 0.95) FROM aggregate_test_100"
   [aggregate.slt] Running query: "SELECT approx_percentile_cont_with_weight(c3, c1, 0.95) FROM aggregate_test_100"
   [aggregate.slt] Running query: "SELECT approx_percentile_cont_with_weight(c3, c2, c1) FROM aggregate_test_100"
   [aggregate.slt] Running query: "SELECT approx_percentile_cont_with_weight(c1, c2, 0.95) FROM aggregate_test_100"
   Error: statement is expected to fail with error:
   	some random text
   but got error:
   	DataFusion error: Error during planning: The function ApproxPercentileContWithWeight does not support inputs of type Utf8.
   [SQL] SELECT approx_percentile_cont_with_weight(c1, c2, 0.95) FROM aggregate_test_100
   at tests/sqllogictests/test_files/aggregate.slt:59
   
   error: test failed, to rerun pass `-p datafusion --test sqllogictests`
   ```
   
   🤔 



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