Avoid per-write virtual dispatch in `DictionaryValuesWriter.shouldFallBack()` by caching the size-exceeded check
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 76/100
- Tipo di issue
- Refactoring
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- java
- Ambito
- data-engineering
Direzione di ricerca
Inizia da DictionaryValuesWriter.shouldFallBack() e FallbackValuesWriter.checkFallback(), quindi esamina i metodi write delle sottoclassi tipizzate Binary, Long, Double, Integer e Float, in particolare i relativi rami id == -1. Verifica che lo stato di superamento della dimensione venga aggiornato solo quando viene aggiunta una nuova voce al dizionario e che il comportamento di fallback rimanga invariato per le scritture duplicate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the enhancement requested
DictionaryValuesWriter.shouldFallBack() is called by FallbackValuesWriter.checkFallback() after every single value write. The current implementation dispatches a virtual call to getDictionarySize() on every invocation:
public boolean shouldFallBack() {
return dictionaryByteSize > maxDictionaryByteSize || getDictionarySize() > MAX_DICTIONARY_ENTRIES;
}
getDictionarySize() is an abstract method overridden in each typed subclass (Binary, Long, Double, Integer, Float) to return the backing map's .size(). Since shouldFallBack() is polled after every write, including writes of duplicate values that do not grow the dictionary, the virtual dispatch and map-size query are redundant work for the common case where most values are already in the dictionary.
Both dictionaryByteSize and the dictionary entry count can only increase when a new entry is added (inside the if (id == -1) branch of each subclass's write method). Therefore the size-exceeded condition can only transition from false to true at that exact point.
Proposal
Replace the per-write check with a cached boolean dictionarySizeExceeded flag. Introduce a checkDictionarySizeLimit(int newDictionarySize) method that subclass write methods call only when a new dictionary entry is actually added. shouldFallBack() then returns the cached flag directly, a simple field read with no virtual dispatch.
Component(s)
Core
- Lingua principale
- Java
- Stelle
- 3.1k
- Fork
- 1.6k
- Merge medio
- 6g 16h
- PR unite (30g)
- 36
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
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/parquet-java
-
Type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
apache/parquet-java#3792 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
apache/parquet-java#3767 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
apache/parquet-java#3695 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/parquet-java#3667 ·
-
Type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
apache/parquet-java#3587 ·
Tutte le issue di apache/parquet-java
Issue simili
-
executions.Query — startDate and timeRange filters are sent with inverted comparison operators Apertaarea/plugin
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
kestra-io/plugin-kestra#190 ·
-
litertlm-android AAR ships no consumer ProGuard rules → "mid == null" SIGABRT in minified apps Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
integra-team-red/meet-map#249 ·
-
[Studio][Bug] Cancelled create-user dialog keeps the password and admin switch for the next attempt Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apache/rocketmq-dashboard#5064 ·