Splitting file name after first dot (instead of stripping a '.parquet' suffix) could lead to issues with files containing more than one dot
- Vorherrschende Sprache
- Rust
- Sterne
- 9.3k
- Forks
- 2.4k
- Ø Merge
- 3 T. 11 Std.
- Gemergte PRs (30 T.)
- 360
Beschreibung
Hey 👋
I'm currently facing an issue with [parquet-viewer](https://github.com/XiangpengHao/parquet-viewer) with filenames containing more than one dot. 'parquet-viewer' uses Datafusion underlyingly and the error message I'm seeing definitly comes from Datafusion, so I'm vaguely feeling that potentially the issue could lay around here somewhere.
For reference, [this](https://github.com/XiangpengHao/parquet-viewer/issues/65) is the issue I'm seeing: if a file is named `test.[random-strings].parquet`, it will lead to this error:
```
Plan(
"failed to resolve schema: test",
)
```
The error definitely is raised [here](https://github.com/apache/datafusion/blob/3ee52f85fdb94544da04f6a67f0c7fc03c714843/datafusion/core/src/execution/session_state.rs#L323).
At least when I try to reproduce the issue with Datafusion from Python, I can't seem be able to reproduce the issue though:
```
>>> from datafusion import SessionContext
>>> ctx = SessionContext()
>>> df = ctx.read_parquet("[random-path]/test.ako.parquet")
>>> df.show()
DataFrame()
+----+-----+-----+
| l1 | bar | foo |
+----+-----+-----+
| | | 0 |
| | 0 | |
+----+-----+-----+
>>> df.limit(2)
DataFrame()
+----+-----+-----+
| l1 | bar | foo |
+----+-----+-----+
| | | 0 |
| | 0 | |
+----+-----+-----+
>>> df.schema()
l1: string_view
bar: uint64
foo: uint64
```
I did however find [this](https://github.com/apache/datafusion/blob/3ee52f85fdb94544da04f6a67f0c7fc03c714843/datafusion/catalog/src/listing_schema.rs#L119) line in the Datafusion codebase, which definitely seems fishy to me, as it could lead to problems with multiple parquet files called `part.1.parquet`, `part.2.parquet`?
Maybe it is also connected to the issue I'm seeing here?
Beitragsleitfaden
Rechercherichtung
Beginne damit, datafusion/catalog/src/listing_schema.rs ungefähr bei Zeile 119 und datafusion/core/src/execution/session_state.rs ungefähr bei Zeile 323 zu lesen. Reproduziere das Verhalten mit Parquet-Dateinamen mit mehreren Punkten und vergleiche es mit dem Python-Beispiel. Erledigt ist die Aufgabe, wenn die relevante Behandlung von Dateinamen überprüft oder korrigiert wurde und der gemeldete Fehler bei der Schemaauflösung durch einen Regressionstest abgedeckt ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python, rust
- Bereich
- data-engineering, databases
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100