-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added support to upcast numeric types when reading parquet (#5923)
- Loading branch information
1 parent
00625b2
commit c74e570
Showing
31 changed files
with
1,297 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...se/src/main/java/io/deephaven/parquet/base/materializers/DoubleFromFloatMaterializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending | ||
// | ||
// ****** AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY | ||
// ****** Edit DoubleMaterializer and run "./gradlew replicatePageMaterializers" to regenerate | ||
// | ||
// @formatter:off | ||
package io.deephaven.parquet.base.materializers; | ||
|
||
import io.deephaven.parquet.base.PageMaterializer; | ||
import io.deephaven.parquet.base.PageMaterializerFactory; | ||
import org.apache.parquet.column.values.ValuesReader; | ||
|
||
public class DoubleFromFloatMaterializer extends DoubleMaterializerBase implements PageMaterializer { | ||
|
||
public static final PageMaterializerFactory FACTORY = new PageMaterializerFactory() { | ||
@Override | ||
public PageMaterializer makeMaterializerWithNulls(ValuesReader dataReader, Object nullValue, int numValues) { | ||
return new DoubleFromFloatMaterializer(dataReader, (double) nullValue, numValues); | ||
} | ||
|
||
@Override | ||
public PageMaterializer makeMaterializerNonNull(ValuesReader dataReader, int numValues) { | ||
return new DoubleFromFloatMaterializer(dataReader, numValues); | ||
} | ||
}; | ||
|
||
private final ValuesReader dataReader; | ||
|
||
private DoubleFromFloatMaterializer(ValuesReader dataReader, int numValues) { | ||
this(dataReader, 0, numValues); | ||
} | ||
|
||
private DoubleFromFloatMaterializer(ValuesReader dataReader, double nullValue, int numValues) { | ||
super(nullValue, numValues); | ||
this.dataReader = dataReader; | ||
} | ||
|
||
@Override | ||
public void fillValues(int startIndex, int endIndex) { | ||
for (int ii = startIndex; ii < endIndex; ii++) { | ||
data[ii] = dataReader.readFloat(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...et/base/src/main/java/io/deephaven/parquet/base/materializers/DoubleMaterializerBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending | ||
// | ||
// ****** AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY | ||
// ****** Edit LongMaterializerBase and run "./gradlew replicatePageMaterializers" to regenerate | ||
// | ||
// @formatter:off | ||
package io.deephaven.parquet.base.materializers; | ||
|
||
import io.deephaven.parquet.base.PageMaterializer; | ||
|
||
import java.util.Arrays; | ||
|
||
abstract class DoubleMaterializerBase implements PageMaterializer { | ||
|
||
private final double nullValue; | ||
final double[] data; | ||
|
||
DoubleMaterializerBase(double nullValue, int numValues) { | ||
this.nullValue = nullValue; | ||
this.data = new double[numValues]; | ||
} | ||
|
||
@Override | ||
public void fillNulls(int startIndex, int endIndex) { | ||
Arrays.fill(data, startIndex, endIndex, nullValue); | ||
} | ||
|
||
@Override | ||
public Object fillAll() { | ||
fillValues(0, data.length); | ||
return data; | ||
} | ||
|
||
@Override | ||
public Object data() { | ||
return data; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...ase/src/main/java/io/deephaven/parquet/base/materializers/IntFromBooleanMaterializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending | ||
// | ||
// ****** AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY | ||
// ****** Edit IntMaterializer and run "./gradlew replicatePageMaterializers" to regenerate | ||
// | ||
// @formatter:off | ||
package io.deephaven.parquet.base.materializers; | ||
|
||
import io.deephaven.parquet.base.PageMaterializer; | ||
import io.deephaven.parquet.base.PageMaterializerFactory; | ||
import org.apache.parquet.column.values.ValuesReader; | ||
|
||
public class IntFromBooleanMaterializer extends IntMaterializerBase implements PageMaterializer { | ||
|
||
public static final PageMaterializerFactory FACTORY = new PageMaterializerFactory() { | ||
@Override | ||
public PageMaterializer makeMaterializerWithNulls(ValuesReader dataReader, Object nullValue, int numValues) { | ||
return new IntFromBooleanMaterializer(dataReader, (int) nullValue, numValues); | ||
} | ||
|
||
@Override | ||
public PageMaterializer makeMaterializerNonNull(ValuesReader dataReader, int numValues) { | ||
return new IntFromBooleanMaterializer(dataReader, numValues); | ||
} | ||
}; | ||
|
||
private final ValuesReader dataReader; | ||
|
||
private IntFromBooleanMaterializer(ValuesReader dataReader, int numValues) { | ||
this(dataReader, 0, numValues); | ||
} | ||
|
||
private IntFromBooleanMaterializer(ValuesReader dataReader, int nullValue, int numValues) { | ||
super(nullValue, numValues); | ||
this.dataReader = dataReader; | ||
} | ||
|
||
@Override | ||
public void fillValues(int startIndex, int endIndex) { | ||
for (int ii = startIndex; ii < endIndex; ii++) { | ||
data[ii] = dataReader.readBoolean() ? 1 : 0; | ||
} | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...rc/main/java/io/deephaven/parquet/base/materializers/IntFromUnsignedByteMaterializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending | ||
// | ||
// ****** AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY | ||
// ****** Edit LongFromUnsignedShortMaterializer and run "./gradlew replicatePageMaterializers" to regenerate | ||
// | ||
// @formatter:off | ||
package io.deephaven.parquet.base.materializers; | ||
|
||
import io.deephaven.parquet.base.PageMaterializer; | ||
import io.deephaven.parquet.base.PageMaterializerFactory; | ||
import org.apache.parquet.column.values.ValuesReader; | ||
|
||
public class IntFromUnsignedByteMaterializer extends IntMaterializerBase implements PageMaterializer { | ||
|
||
public static final PageMaterializerFactory FACTORY = new PageMaterializerFactory() { | ||
@Override | ||
public PageMaterializer makeMaterializerWithNulls(ValuesReader dataReader, Object nullValue, int numValues) { | ||
return new IntFromUnsignedByteMaterializer(dataReader, (int) nullValue, numValues); | ||
} | ||
|
||
@Override | ||
public PageMaterializer makeMaterializerNonNull(ValuesReader dataReader, int numValues) { | ||
return new IntFromUnsignedByteMaterializer(dataReader, numValues); | ||
} | ||
}; | ||
|
||
private final ValuesReader dataReader; | ||
|
||
private IntFromUnsignedByteMaterializer(ValuesReader dataReader, int numValues) { | ||
this(dataReader, 0, numValues); | ||
} | ||
|
||
private IntFromUnsignedByteMaterializer(ValuesReader dataReader, int nullValue, int numValues) { | ||
super(nullValue, numValues); | ||
this.dataReader = dataReader; | ||
} | ||
|
||
@Override | ||
public void fillValues(int startIndex, int endIndex) { | ||
for (int ii = startIndex; ii < endIndex; ii++) { | ||
data[ii] = Byte.toUnsignedInt((byte) dataReader.readInteger()); | ||
} | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...c/main/java/io/deephaven/parquet/base/materializers/IntFromUnsignedShortMaterializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending | ||
// | ||
// ****** AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY | ||
// ****** Edit LongFromUnsignedShortMaterializer and run "./gradlew replicatePageMaterializers" to regenerate | ||
// | ||
// @formatter:off | ||
package io.deephaven.parquet.base.materializers; | ||
|
||
import io.deephaven.parquet.base.PageMaterializer; | ||
import io.deephaven.parquet.base.PageMaterializerFactory; | ||
import org.apache.parquet.column.values.ValuesReader; | ||
|
||
public class IntFromUnsignedShortMaterializer extends IntMaterializerBase implements PageMaterializer { | ||
|
||
public static final PageMaterializerFactory FACTORY = new PageMaterializerFactory() { | ||
@Override | ||
public PageMaterializer makeMaterializerWithNulls(ValuesReader dataReader, Object nullValue, int numValues) { | ||
return new IntFromUnsignedShortMaterializer(dataReader, (int) nullValue, numValues); | ||
} | ||
|
||
@Override | ||
public PageMaterializer makeMaterializerNonNull(ValuesReader dataReader, int numValues) { | ||
return new IntFromUnsignedShortMaterializer(dataReader, numValues); | ||
} | ||
}; | ||
|
||
private final ValuesReader dataReader; | ||
|
||
private IntFromUnsignedShortMaterializer(ValuesReader dataReader, int numValues) { | ||
this(dataReader, 0, numValues); | ||
} | ||
|
||
private IntFromUnsignedShortMaterializer(ValuesReader dataReader, int nullValue, int numValues) { | ||
super(nullValue, numValues); | ||
this.dataReader = dataReader; | ||
} | ||
|
||
@Override | ||
public void fillValues(int startIndex, int endIndex) { | ||
for (int ii = startIndex; ii < endIndex; ii++) { | ||
data[ii] = Short.toUnsignedInt((short) dataReader.readInteger()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.