-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
csv_query_approx_count fails due to an edge case exposed in #3222
The test fails with:
"Plan(\"Aggregations require unique expression names but the expression \\\"APPROXDISTINCT(#aggregate_test_100.c9)\\\" at position 0 and \\\"APPROXDISTINCT(CAST(#aggregate_test_100.c9 AS Utf8))\\\" at position 1 have the same name. Consider aliasing (\\\"AS\\\") one of them.\")
However, the expressions are already aliased. The alias is dropped before the error check above and this part of the codebase needs some reworking. It is not trivial to fix.
To Reproduce
#[tokio::test]
async fn csv_query_approx_count() -> Result<()> {
let ctx = SessionContext::new();
register_aggregate_csv(&ctx).await?;
let sql = "SELECT approx_distinct(c9) count_c9, approx_distinct(cast(c9 as varchar)) count_c9_str FROM aggregate_test_100";
let actual = execute_to_batches(&ctx, sql).await;
let expected = vec![
"+----------+--------------+",
"| count_c9 | count_c9_str |",
"+----------+--------------+",
"| 100 | 99 |",
"+----------+--------------+",
];
assert_batches_eq!(expected, &actual);
Ok(())
}
Expected behavior
Should pass
Additional context
None
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working