Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix csv_query_approx_count once binary type coercion PR is merged #3353

Open
andygrove opened this issue Sep 3, 2022 · 0 comments
Open

Fix csv_query_approx_count once binary type coercion PR is merged #3353

andygrove opened this issue Sep 3, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@andygrove
Copy link
Member

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

@andygrove andygrove added the bug Something isn't working label Sep 3, 2022
@andygrove andygrove self-assigned this Sep 3, 2022
@andygrove andygrove modified the milestone: 14.0.0 Oct 30, 2022
@andygrove andygrove removed their assignment Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant