apache / apache/datafusion

octet_length(char) doesn't behave as expected.

Aperta
#6,508 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Rust
Stelle
9.3k
Fork
2.4k
Merge medio
3g 11h
PR unite (30g)
360

Descrizione

### Describe the bug

Hi there,

``select octet_length(char)`` doesn't behave as expected.

In the example below - in Postgres (``text`` column) the below SQL would return 25 as the result however in DataFusion (``StringArray`` column ) it just returns the original length of the values in ``n_name``.

```sql
select octet_length(n_name::char(25)) from nation;
```

I'm not sure if this is because the cast to a ``char(25)`` is not behaving as expected

### To Reproduce

create a StringColumn in DF, populate it with some values and run the following SQL on it.

```sql
select octet_length(n_name::char(25)) from nation;
```

### Expected behavior

Should return 25, but it returns the length of each of the values in the column.

### Additional context

_No response_

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con la riproduzione SQL usando un DataFusion StringArray e confronta octet_length(n_name::char(25)) con il risultato di PostgreSQL. Traccia il cast a char(25) e il comportamento di octet_length; quindi aggiungi una copertura che mostri che l’espressione restituisce 25 per i valori riprodotti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
postgresql, rust, sql
Ambito
databases
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.