DuckDB: `f(a == b)` is displayed as `f(a = b)`, which reparses as a named argument

Đang mở
#2,808 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust, sql
Lĩnh vực
databases

Hướng nghiên cứu

Start with how BinaryOperator::Eq is displayed, and with the DuckDB dialect's supports_named_fn_args_with_eq_operator flag (#1182) that makes a = b inside a call a named argument. Reproduce SELECT coalesce(a == b) FROM t as a round trip and compare the AST before and after. Before changing anything, check with maintainers whether this counts as accepted normalisation, since the thread has no answer yet. Done means the round trip keeps Unnamed(BinaryOp { a Eq b }), or the maintainers have documented why it does not.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

DuckDB Prolific Author

== is parsed as BinaryOperator::Eq and displayed as =. Inside a function call with DuckDbDialect, a = b is a named argument (supports_named_fn_args_with_eq_operator, #1182), so the output means something else:

SELECT coalesce(a == b) FROM t
  -> AST arg: Unnamed(BinaryOp { a Eq b })
  -> displays as: SELECT coalesce(a = b) FROM t
  -> reparse arg: Named { name: a, arg: b, operator: Equals }
SELECT a == b FROM t
  -> displays as SELECT a = b FROM t, same AST (fine)

DuckDB documents = and == as equal (https://duckdb.org/docs/stable/sql/expressions/comparison_operators) and evaluates coalesce(a == b) as a comparison. This may count as accepted normalisation; the only effect is the AST change inside call arguments.

Tested on main ce12f1f6 (also 0.63.0 and 0.58.0).

Found with a property-based fuzzer (round trip check); I used AI assistance for triage and verified every case above.

Ngôn ngữ chính
Rust
Star
3.5k
Fork
805
Merge trung bình
2 ngày 3 giờ
Pull request đã merge (30 ngày)
116

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/datafusion-sqlparser-rs

Tất cả issue của apache/datafusion-sqlparser-rs

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.