[Bug] Mosaic accepts TIMESTAMP(0) columns that its native writer cannot write

Đang mở Phù hợp với người mới
#11,228 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
backend, databases

Hướng nghiên cứu

Đọc MosaicFileFormat.validateDataFields và các bước kiểm tra hiện có đối với những kiểu không được hỗ trợ, sau đó theo dõi cách ArrowFieldTypeConversion ánh xạ độ chính xác của dấu thời gian. Bổ sung kiểm thử cho TIMESTAMP(0) và TIMESTAMP(0) WITH LOCAL TIME ZONE trong các kiểm thử liên quan, đồng thời xác nhận rằng việc tạo bảng từ chối các kiểu này với thông báo rõ ràng trước khi thử ghi dữ liệu.

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

Mô tả

Search before asking

  • I searched in the issues and found nothing similar.

Paimon version
master @ 33dbcfcb17

Compute Engine
Engine-agnostic (Mosaic file format).

Minimal reproduce step
Create a table with 'file.format' = 'mosaic' and a TIMESTAMP(0) or TIMESTAMP(0) WITH LOCAL TIME ZONE column, then insert a row. CREATE TABLE succeeds, but every write fails when the file is opened:

java.lang.RuntimeException: writer open failed: unsupported Timestamp unit: Second

ArrowFieldTypeConversion maps precision 0 to the Arrow SECOND unit, and the Mosaic native writer only accepts millisecond, microsecond and nanosecond timestamps (validate_data_type in apache/paimon-mosaic core/src/types.rs). Precisions 1 to 9 write fine.

MySQL CDC maps DATETIME without a precision to TIMESTAMP(0), so a CDC job into a Mosaic table hits this on its first write.

What doesn't meet your expectations?
MosaicFileFormat.validateDataFields should reject TIMESTAMP(0) the way it already rejects VARIANT, BLOB, VECTOR, MULTISET and ROW, so the table definition fails with a message that names the type, instead of every write failing later with a native error that names neither the column nor the format.

Anything else?
Storing precision 0 as milliseconds would make the type writable, but it needs matching changes on the write and read sides of the Arrow conversion. Rejecting it is the smaller fix.

Are you willing to submit a PR?

  • I'm willing to submit a PR!
Ngôn ngữ chính
Java
Star
3.4k
Fork
1.4k
Merge trung bình
1 ngày 10 giờ
Pull request đã merge (30 ngày)
365

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/paimon

Tất cả issue của apache/paimon

Issue tương tự

Thêm issue về Java

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.