apache / apache/parquet-java

record count for row group size check configurable

Offen
#2,740 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Component: Java Component: Parquet Priority: Major Type: enhancement
Vorherrschende Sprache
Java
Sterne
3.1k
Forks
1.6k
Ø Merge
3 T. 12 Std.
Gemergte PRs (30 T.)
33

Beschreibung

 org.apache.parquet.hadoop.InternalParquetRecordWriter#checkBlockSizeReached
```java

 private void checkBlockSizeReached() throws IOException {
    if (recordCount >= recordCountForNextMemCheck) { // checking the memory size is relatively expensive, so let's not do it for every record.
      long memSize = columnStore.getBufferedSize();
      long recordSize = memSize / recordCount;
      // flush the row group if it is within ~2 records of the limit
      // it is much better to be slightly under size than to be over at all
      if (memSize > (nextRowGroupSize - 2 * recordSize)) {
        LOG.info("mem size {} > {}: flushing {} records to disk.", memSize, nextRowGroupSize, recordCount);
        flushRowGroupToStore();
        initStore();
        recordCountForNextMemCheck = min(max(MINIMUM_RECORD_COUNT_FOR_CHECK, recordCount / 2), MAXIMUM_RECORD_COUNT_FOR_CHECK);
        this.lastRowGroupEndPos = parquetFileWriter.getPos();
      } else {
        recordCountForNextMemCheck = min(
            max(MINIMUM_RECORD_COUNT_FOR_CHECK, (recordCount + (long)(nextRowGroupSize / ((float)recordSize))) / 2), // will check halfway
            recordCount + MAXIMUM_RECORD_COUNT_FOR_CHECK // will not look more than max records ahead
            );
        LOG.debug("Checked mem at {} will check again at: {}", recordCount, recordCountForNextMemCheck);
      }
    }
  }
```
in this code,if the block size is small ,for example 8M,and the first 100 lines record size is small and  after 100 lines the record size is big,it will cause big row group,in our real scene,it will more than 64M. So i think the size for block check can configurable.

**Reporter**: [xjlem](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=xjlem)

**Note**: *This issue was originally created as [PARQUET-2242](https://issues.apache.org/jira/browse/PARQUET-2242). Please see the [migration documentation](https://issues.apache.org/jira/browse/PARQUET-2502) for further details.*

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginne mit org.apache.parquet.hadoop.InternalParquetRecordWriter#checkBlockSizeReached und verfolge, wie nextRowGroupSize und recordCountForNextMemCheck initialisiert und verwendet werden. Ermittle den bestehenden Konfigurationspfad und die relevanten Writer-Tests. Definiere anschließend die Fertigstellung so, dass die Konfiguration der Größenbestimmung für die Speicherprüfung ermöglicht wird und das gemeldete Verhalten übergroßer Row Groups verhindert wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
data-engineering
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.