API: Truncate projection of startsWith/notStartsWith miscounts surrogate pairs
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 58/100
Direzione di ricerca
Start with the string truncate transform: the TruncateString project and projectStrict methods, which compare the prefix's String.length() with the width, and UnicodeUtil.truncateString, which counts code points. Run the reproduction from the issue (startsWith and notStartsWith on "😀" with truncate width 2) to see the wrong projections. Done means both methods compare code point counts, and tests cover surrogate-pair prefixes while ASCII and BMP cases still pass.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Apache Iceberg version
main (development)
Query engine
None
Please describe the bug 🐞
Problem
truncate[W] on strings truncates to W code points (UnicodeUtil.truncateString), but TruncateString.project and projectStrict decide how to project startsWith/notStartsWith by comparing the prefix's String.length() (UTF-16 chars) with W.
A prefix with supplementary characters such as emoji can have length() == W and still have fewer than W code points. The projection then treats it as a full partition value and turns it into an equality, while the partition values of matching rows are longer.
Reproduce
Schema schema = new Schema(Types.NestedField.optional(1, "s", Types.StringType.get()));
PartitionSpec spec = PartitionSpec.builderFor(schema).truncate("s", 2).build();
// "😀" is 1 code point but 2 chars. A row "😀abc" lands in partition s_trunc = "😀a".
Projections.inclusive(spec).project(Expressions.startsWith("s", "😀"));
// actual: ref(name="s_trunc") == "😀" -> partition "😀a" is pruned
// expected: ref(name="s_trunc") startsWith "😀"
Projections.strict(spec).project(Expressions.notStartsWith("s", "😀"));
// actual: ref(name="s_trunc") != "😀" -> partition "😀a" is treated as all-matching
// expected: ref(name="s_trunc") notStartsWith "😀"
Impact
- Inclusive projection prunes partitions that contain matching rows, so scans with such a
startsWithfilter silently return fewer rows. - Strict projection reports partitions as fully matching when none of their rows match, which affects residuals and partition-level decisions such as metadata-only deletes.
It only happens for string truncate partitions when the prefix's UTF-16 length equals the width but its code point count is smaller. ASCII and BMP-only prefixes are unaffected.
Proposed fix
Compare the prefix's code point count with the width in both methods. I have a fix with tests and can open a PR.
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
- Lingua principale
- Java
- Stelle
- 9.4k
- Fork
- 3.7k
- Merge medio
- 2g 16h
- PR unite (30g)
- 160
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/iceberg
-
Spark: Test INSERT targets with computed IDENTIFIER expressionsForse già presa @shivadarshan-devadiga l’ha presa 7 giorni fa. Apertaimprovement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
[Core] TestAvroPartitionStatsHandler fails on Windows due to unclosed partition statistics scanForse già presa @Ankitkj1999 l’ha presa 9 giorni fa. Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Flink: JdbcLockFactory concurrent lock-table creation can fail with "table already exists" and restart the jobForse già presa @adiranjan25 l’ha presa 16 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
apache/iceberg#18797 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Core: TableMetadata.Builder allows adding encryption keys to v1/v2 tablesForse già presa @yusufyildiz34 l’ha presa 29 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/iceberg#18632 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Kafka: Filter empty strings and whitespace in IcebergSinkConfig stringToListForse già presa @mohamed-elbrik l’ha presa 34 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di apache/iceberg
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
speakeasy-api/speakeasy#2159 ·
I maintainer di solito rispondono entro 1 giorno
-
area: cli
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
vitruv-tools/NeoJoin#415 ·
I maintainer di solito rispondono entro 1 giorno
-
Quick Installation step 2 installs from the plugin manager, but the plugin isn't published yetAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
jenkinsci/user-guide-ai-chatbot-plugin#132 ·
I maintainer di solito rispondono entro 6 giorni
-
account assessment course feature lecture
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug] 连接达梦时报错,agent 进程启动即退Apertabug db/dameng user-priority/P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno