Fix `csv_query_approx_count` once binary type coercion PR is merged
- Lingua principale
- Rust
- Stelle
- 9.3k
- Fork
- 2.4k
- Merge medio
- 3g 11h
- PR unite (30g)
- 360
Descrizione
**Describe the bug**
`csv_query_approx_count` fails due to an edge case exposed in https://github.com/apache/arrow-datafusion/pull/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
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con il riproduttore csv_query_approx_count, includendo register_aggregate_csv, execute_to_batches e l'errore di aggregazione mostrato nell'issue. Traccia dove vengono gestiti gli alias prima del controllo delle espressioni duplicate, quindi conferma che la query produca i risultati attesi 100 e 99 quando sarà disponibile la modifica per la coercizione dei tipi binari.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust, sql
- Ambito
- databases
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100