apache / apache/datafusion-sqlparser-rs

Parse negative numbers for Postgres Dialect

Đang mở
#549 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
3.5k
Fork
772
Merge trung bình
4 ngày 9 giờ
Pull request đã merge (30 ngày)
17

Mô tả

Parser should parse negative numbers as is, rather than into a unary_op neg, wrapping an inner value, to be consistent with Postgres.

Postgres behaviour using (pglast):
```
[nix-shell:~/projects/risingwave-nix]$ ./query_parser.py "select -(-(-(9223372036854775808)))"
{'@': 'SelectStmt',
'all': False,
'limitOption': {'#': 'LimitOption',
'name': 'LIMIT_OPTION_DEFAULT',
'value': 0},
'op': {'#': 'SetOperation', 'name': 'SETOP_NONE', 'value': 0},
'targetList': ({'@': 'ResTarget',
'location': 7,
'val': {'@': 'A_Const',
'location': 7,
'val': {'@': 'Float',
'val': Decimal('-9223372036854775808')}}},)}
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Reproduce the nested-negative example through the Postgres dialect, using the query_parser.py entry point shown in the issue. Trace how negative numeric literals are represented in the parser output; done means they match the shown Postgres behavior as numeric constants rather than unary_op nodes, with relevant parser coverage added or updated once located.

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

Đánh giá

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

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.