Parquet: Bloom row group filter skips matching rows or throws on decimal scale, encoding, and precision mismatches
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 28/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- java
- Lĩnh vực
- data-engineering
Hướng nghiên cứu
Start with ParquetBloomRowGroupFilter.shouldRead and the decimal hashing paths for INT32, INT64, FIXED_LEN_BYTE_ARRAY, and BINARY. Reproduce each scale, encoding, and precision-widening case from the issue before changing the conversion and range-check behavior. Done means matching decimal rows are not skipped, unrepresentable literals return ROWS_CANNOT_MATCH without exceptions or truncation, and the relevant Parquet filter tests cover all four encodings.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Apache Iceberg version
main (development)
Query engine
Other
Please describe the bug 🐞
Parquet Bloom filters hash the raw bytes written to a column, so evaluating an = or IN predicate requires converting the query's BigDecimal literal to the file column's physical encoding and scale. ParquetBloomRowGroupFilter instead hashes decimals using the literal's own scale and the file column precision's minimal byte length, causing Parquet.read(...).filter(...) to skip matching row groups or fail with IllegalArgumentException.
For example, when a DECIMAL(9, 2) column with a Bloom filter (and dictionary disabled) contains 12.50:
// Succeeds when literal scale matches the file scale (2)
readFile(f1, intDec, equal("dec", new BigDecimal("12.50"))); // -> [12.50]
// Silently skips the matching row group when literal scale differs (1)
readFile(f1, intDec, equal("dec", new BigDecimal("12.5"))); // -> []
The same mismatch affects three scenarios:
- Different literal scale (
12.5or12.500against12.50, sinceLiterals.DecimalLiteralpreserves input scale):INT32/INT64columns hash the unrescaled integer (125or12500instead of1250) and skip matching row groups;FIXED_LEN_BYTE_ARRAYcolumns throwIllegalArgumentException(wrong scale). - Non-minimal
FIXED_LEN_BYTE_ARRAYorBINARYencodings (e.g.,DECIMAL(20, 2)stored infixed_len_byte_array(16), orDECIMAL(10, 2)inbinary): the filter hashes 9 or 5 bytes instead of the column's 16-byte or variable-length encoding and skips matching row groups. - Decimal precision widening: wider literals in
=orINthrowIllegalArgumentException(too large) onFIXED_LEN_BYTE_ARRAY(e.g.,DECIMAL(20, 2)->DECIMAL(30, 2)), or truncate high bits viaintValue()/longValue()onINT32/INT64.
Reproducer on main (ce1ce41):
Schema intDec = new Schema(optional(1, "dec", Types.DecimalType.of(9, 2)));
InputFile f1 = writeFile(intDec, new BigDecimal("12.50"));
System.out.println("1. same scale (12.50) -> " + readFile(f1, intDec, equal("dec", new BigDecimal("12.50"))));
System.out.println("2. diff scale (12.5) -> " + readFile(f1, intDec, equal("dec", new BigDecimal("12.5"))));
MessageType fixed16Type = MessageTypeParser.parseMessageType(
"message table { optional fixed_len_byte_array(16) dec (DECIMAL(20, 2)) = 1; }");
InMemoryOutputFile fixed16Out = new InMemoryOutputFile();
try (ParquetWriter<Group> writer = ExampleParquetWriter.builder(ParquetIO.file(fixed16Out))
.withType(fixed16Type).withDictionaryEncoding(false).withBloomFilterEnabled("dec", true).build()) {
writer.write(new SimpleGroupFactory(fixed16Type).newGroup().append("dec",
Binary.fromConstantByteArray(DecimalUtil.toReusedFixLengthBytes(20, 2, new BigDecimal("12.34"), new byte[16]))));
}
Schema dec20 = new Schema(optional(1, "dec", Types.DecimalType.of(20, 2)));
System.out.println("3. FIXED(16) (12.34) -> " + readFile(fixed16Out.toInputFile(), dec20, equal("dec", new BigDecimal("12.34"))));
Schema dec30 = new Schema(optional(1, "dec", Types.DecimalType.of(30, 2)));
InputFile f2 = writeFile(dec20, new BigDecimal("1.00"), new BigDecimal("50.00"), new BigDecimal("100.00"));
try {
System.out.println("4. widened IN -> " + readFile(f2, dec30,
in("dec", new BigDecimal("50.00"), new BigDecimal("1234567890123456789012.34"))));
} catch (Exception e) {
System.out.println("4. widened IN -> " + e.getClass().getSimpleName() + ": " + e.getMessage());
}
Output:
1. same scale (12.50) -> [12.50]
2. diff scale (12.5) -> []
3. FIXED(16) (12.34) -> []
4. widened IN -> IllegalArgumentException: Cannot write value as decimal(20,2), too large: 1234567890123456789012.34
Expected behavior: ParquetBloomRowGroupFilter should never skip row groups containing matching decimal rows across INT32, INT64, FIXED_LEN_BYTE_ARRAY, and BINARY encodings or differing literal scales, and should treat literals that cannot be represented in the file column's (precision, scale) as ROWS_CANNOT_MATCH without throwing or truncating.
Cause: ParquetBloomRowGroupFilter.shouldRead hashes INT32/INT64 decimals via intValue()/longValue() without rescaling or range checks, and hashes FIXED_LEN_BYTE_ARRAY and BINARY decimals without rescaling using TypeUtil.decimalRequiredBytes(precision) instead of the column's encoded byte length.
Willingness to contribute
- I can contribute a fix for this bug independently
- I would be willing to contribute a fix for this bug with guidance from the Iceberg community
- I cannot contribute a fix for this bug at this time
- Ngôn ngữ chính
- Java
- Star
- 9.5k
- Fork
- 3.7k
- Merge trung bình
- 2 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 170
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/iceberg
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Spark: Test INSERT targets with computed IDENTIFIER expressionsCó thể đã có người làm @shivadarshan-devadiga đã nhận 15 ngày trước. Đang mởimprovement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Core] TestAvroPartitionStatsHandler fails on Windows due to unclosed partition statistics scanCó thể đã có người làm @Ankitkj1999 đã nhận 17 ngày trước. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Core: TableMetadata.Builder allows adding encryption keys to v1/v2 tablesCó thể đã có người làm @yusufyildiz34 đã nhận 37 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/iceberg#18632 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Kafka: Filter empty strings and whitespace in IcebergSinkConfig stringToListCó thể đã có người làm @mohamed-elbrik đã nhận 42 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/iceberg
Issue tương tự
-
bug vault
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
bancolombia/secrets-manager#150 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 92/100
HexaHexes/neoforge-mod-template#124 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
awaiting triage java new feature P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
source-survicate: pagination reads pagination and stops after one page; substreams drop survey_idĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
OpenLiberty/open-liberty#36410 ·
Maintainer thường phản hồi trong vòng 1 ngày