MySQL caret binds below multiplication, changing a DataFusion query result

Offen
#2,692 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

  • #2701 von @princejain756 — ohne Merge geschlossen

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
72/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
rust, sql

Rechercherichtung

Start with the generic precedence table in src/dialect/mod.rs and the MySQL dialect in src/dialect/mysql.rs, then compare their handling of Caret and MulDivModOp. Reproduce the expression from the issue using the MySQL dialect and inspect existing parser tests for precedence cases. Done when the MySQL expression groups as (2 ^ 3) * 4 and returns 4, with a regression test covering the precedence.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

MySQL

Reproduction

With datafusion==55.0.0:

from datafusion import SessionConfig, SessionContext

config = SessionConfig().set("datafusion.sql_parser.dialect", "MySQL")
batches = SessionContext(config).sql("SELECT 2 ^ 3 * 4").collect()
print(batches[0].column(0).to_pylist())

Observed on 2026-10-19: [14]. MySQL's precedence table ranks bitwise ^ above *, so the expression groups as (2 ^ 3) * 4 and yields 4. The observed result corresponds to 2 ^ (3 * 4).

The generic precedence table gives Caret a lower value than MulDivModOp, and the MySQL dialect does not override caret precedence. The same relative tiers remain on the default branch as of 2026-10-19. This is a MySQL-dialect parser discrepancy with an observed downstream query-result difference in DataFusion.

Vorherrschende Sprache
Rust
Sterne
3.5k
Forks
805
Ø Merge
2 T. 3 Std.
Gemergte PRs (30 T.)
116

Entwicklungsumgebung

  • Kein Dockerfile und keine Docker-Compose-Datei
  • Hat eine Pull-Request-Vorlage
  • Kein Beitragsleitfaden

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus apache/datafusion-sqlparser-rs

Alle Issues in apache/datafusion-sqlparser-rs

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

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