[coverage] Conformance findings: PARAMQUERY-021

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

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
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python, sql
Lĩnh vực
database, testing

Hướng nghiên cứu

Bắt đầu bằng cách xác định phần xử lý DecimalParameter và đường dẫn liên kết tham số trong databricks-sql-python, sau đó so sánh chúng với test bị lỗi test_decimal_target_type_never_truncates_bound_scale trong coverage PR. Chạy conformance test được tham chiếu cho thrift và sea; được xem là hoàn tất khi DECIMAL(10,2) tường minh được liên kết chính xác và các giá trị giữ lại mọi chữ số phần thập phân đã khai báo hoặc có từ nguồn mà không bị cắt ngắn.

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

Mô tả

Summary

Surfaced by the multi-language coverage fan-out while conformance-testing these SPEC-IDs against databricks/databricks-sql-python. Each finding is committed as an expected-failure (xfail) test in the coverage PR — the test asserts the CORRECT (post-fix) behavior and stays red until THIS driver (databricks/databricks-sql-python) is fixed, then flips green as a tripwire.

Findings

  • PARAMQUERY-021 [thrift]: DecimalParameter with explicit precision/scale renders DECIMAL(scale,precision) instead of DECIMAL(precision,scale), so a declared DECIMAL(10,2) target is sent as DECIMAL(2,10) and the server rejects it (INVALID_PARAMETER_MARKER_VALUE.INVALID_DATA_TYPE, SQLSTATE 22023)
    • failing test: test_decimal_target_type_never_truncates_bound_scale (see the coverage PR diff under tests/)
  • PARAMQUERY-021 [sea]: DecimalParameter with explicit precision/scale renders DECIMAL(scale,precision) instead of DECIMAL(precision,scale), so a declared DECIMAL(10,2) target becomes DECIMAL(2,10) and the kernel rejects the bind with ProgrammingError "DECIMAL scale must be in 0..=precision"
    • failing test: test_decimal_target_type_never_truncates_bound_scale (see the coverage PR diff under tests/)
  • PARAMQUERY-021: DecimalParameter with explicit precision/scale renders the cast expression as DECIMAL(scale,precision) instead of DECIMAL(precision,scale), so a declared DECIMAL(10,2) target is sent as DECIMAL(2,10) and every bind with an explicitly declared decimal target fails (thrift: server INVALID_PARAMETER_MARKER_VALUE.INVALID_DATA_TYPE / SQLSTATE 22023; kernel: ProgrammingError "DECIMAL scale must be in 0..=precision")

Reproduce & Expected

PARAMQUERY-021 — Verify that declaring a DECIMAL/NUMERIC target type for a bound parameter never silently drops fractional digits.

Reproduce:

SELECT ? AS v
SELECT ? AS v
SELECT ? AS v

Expected (per the shared spec):

  • All three binds prepare and execute successfully.
  • (a) The declared DECIMAL(10,2) accommodates the value, so the parameter rides as that decimal type and the value compares numerically equal to 123.45 with both fractional digits intact.
  • (b) THE CORE GUARANTEE: with no declared scale, the value is still 123.45 -- NOT 123. Assert the value, not the reported column type: a conforming driver may legitimately deliver this as a decimal the server inferred from the literal OR as the lossless text/string form, so the type is implementation latitude while the VALUE is the contract.
  • (c) The value's own scale (4) is authoritative over the under-declared target scale (2): all four fractional digits survive. A result of 123.45 (or 123) is a truncation violation.

Context

Ngôn ngữ chính
Python
Star
233
Fork
152
Merge trung bình
21 giờ 5 phút
Pull request đã merge (30 ngày)
10

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

Mở 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 databricks/databricks-sql-python

Tất cả issue của databricks/databricks-sql-python

Issue tương tự

Thêm issue về Python

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.