Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Avoid per-write virtual dispatch in `DictionaryValuesWriter.shouldFallBack()` by caching the size-exceeded check

オープン
#3,501 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
76/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
java

調査の方向性

DictionaryValuesWriter.shouldFallBack() と FallbackValuesWriter.checkFallback() から始め、次に、型付きサブクラス Binary、Long、Double、Integer、Float の write メソッドを調べます。特に、それぞれの id == -1 分岐を確認してください。サイズ超過状態が新しい辞書エントリが追加された場合にのみ更新され、重複した書き込みに対して fallback の動作が変わらないことを確認してください。

索引モデルが issue の本文から書いたものです。

説明

Type: enhancement
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

主要言語
Java
スター
3.1k
フォーク
1.6k
平均マージ
4日 5時間
マージ済み PR(30日)
30

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/parquet-java のほかの issue

apache/parquet-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。