Skip to content

MySQL caret binds below multiplication, changing a DataFusion query result #2692

Open

Description

@pbottine

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions