apache / apache/datafusion

Support date types in `percentile_cont` aggregate function

Offen
#18,601 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Rust
Sterne
9.3k
Forks
2.4k
Ø Merge
3 T. 11 Std.
Gemergte PRs (30 T.)
360

Beschreibung

### Is your feature request related to a problem or challenge?

https://github.com/apache/datafusion/pull/17988 has added support for `percentile_cont`, and this function can support more date-related data types.

Data is generated with https://github.com/clflushopt/tpchgen-rs/tree/main/tpchgen-cli
```
DataFusion CLI v51.0.0
> select percentile_cont(0.01) within group (order by l_shipdate)
from '/Users/yongting/data/tpch_sf1/lineitem.parquet';
Error during planning: Failed to coerce arguments to satisfy a call to 'percentile_cont' function: coercion from Date32, Float64 to the signature OneOf([Exact([Int8, Float64]), Exact([Int16, Float64]), Exact([Int32, Float64]), Exact([Int64, Float64]), Exact([UInt8, Float64]), Exact([UInt16, Float64]), Exact([UInt32, Float64]), Exact([UInt64, Float64]), Exact([Float32, Float64]), Exact([Float64, Float64])]) failed No function matches the given name and argument types 'percentile_cont(Date32, Float64)'. You might need to add explicit type casts.
Candidate functions:
percentile_cont(expr: Int8, percentile: Float64)
percentile_cont(expr: Int16, percentile: Float64)
percentile_cont(expr: Int32, percentile: Float64)
percentile_cont(expr: Int64, percentile: Float64)
percentile_cont(expr: UInt8, percentile: Float64)
percentile_cont(expr: UInt16, percentile: Float64)
percentile_cont(expr: UInt32, percentile: Float64)
percentile_cont(expr: UInt64, percentile: Float64)
percentile_cont(expr: Float32, percentile: Float64)
percentile_cont(expr: Float64, percentile: Float64)
```

### Describe the solution you'd like

_No response_

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne bei der Implementierung der Aggregatfunktion percentile_cont und ihrer Argument-Typsignatur oder der Behandlung der Typkonvertierung. Reproduziere die gezeigte DataFusion CLI-Abfrage mit den TPCH lineitem-Daten und füge anschließend Abdeckung für Date32 und die von der Implementierung unterstützten datumsbezogenen Typen hinzu. Die Aufgabe ist abgeschlossen, wenn percentile_cont die angegebene Datumseingabe akzeptiert und das erwartete Perzentilergebnis zurückgibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust, sql
Bereich
databases
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.