forked from deephaven/deephaven-core
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58783c0
commit 8dab591
Showing
18 changed files
with
931 additions
and
362 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
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
8 changes: 8 additions & 0 deletions
8
extensions/parquet/table/src/main/java/io/deephaven/parquet/table/ParquetCacheTags.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,8 @@ | ||
/** | ||
* Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending | ||
*/ | ||
package io.deephaven.parquet.table; | ||
|
||
public enum ParquetCacheTags { | ||
DECIMAL_ARGS | ||
} |
363 changes: 9 additions & 354 deletions
363
extensions/parquet/table/src/main/java/io/deephaven/parquet/table/ParquetTableWriter.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
62 changes: 62 additions & 0 deletions
62
...ions/parquet/table/src/main/java/io/deephaven/parquet/table/transfer/BooleanTransfer.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,62 @@ | ||
/** | ||
* Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending | ||
*/ | ||
package io.deephaven.parquet.table.transfer; | ||
|
||
import io.deephaven.chunk.ByteChunk; | ||
import io.deephaven.chunk.attributes.Values; | ||
import io.deephaven.engine.rowset.RowSequence; | ||
import io.deephaven.engine.table.ChunkSource; | ||
import io.deephaven.engine.table.ColumnSource; | ||
import org.apache.parquet.column.statistics.Statistics; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
public class BooleanTransfer implements TransferObject<ByteBuffer> { | ||
|
||
private final ColumnSource<?> columnSource; | ||
private final ChunkSource.GetContext context; | ||
private ByteChunk<? extends Values> chunk; | ||
private ByteBuffer buffer; | ||
|
||
public BooleanTransfer(@NotNull final ColumnSource<?> columnSource, final int targetSize) { | ||
this.columnSource = columnSource; | ||
this.buffer = ByteBuffer.allocate(targetSize); | ||
this.context = columnSource.makeGetContext(targetSize); | ||
} | ||
|
||
@Override | ||
public ByteBuffer getBuffer() { | ||
return buffer; | ||
} | ||
|
||
@Override | ||
public int rowCount() { | ||
return chunk.size(); | ||
} | ||
|
||
@Override | ||
public void fetchData(@NotNull final RowSequence rs) { | ||
chunk = columnSource.getChunk(context, rs).asByteChunk(); | ||
if(buffer.capacity() < chunk.size()) { | ||
buffer = ByteBuffer.allocate(chunk.size()); | ||
} | ||
|
||
buffer.clear(); | ||
for (int ii = 0; ii < chunk.size(); ii++) { | ||
final byte val = chunk.get(ii); | ||
buffer.put(val); | ||
} | ||
buffer.flip(); | ||
} | ||
|
||
@Override | ||
public void close() { | ||
context.close(); | ||
} | ||
|
||
@Override | ||
public <T extends Comparable<T>> void updateStatistics(@NotNull final Statistics<T> stats) { | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
extensions/parquet/table/src/main/java/io/deephaven/parquet/table/transfer/ByteTransfer.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,84 @@ | ||
/** | ||
* Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending | ||
*/ | ||
/* | ||
* --------------------------------------------------------------------------------------------------------------------- | ||
* AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY - for any changes edit IntTransfer and regenerate | ||
* --------------------------------------------------------------------------------------------------------------------- | ||
*/ | ||
package io.deephaven.parquet.table.transfer; | ||
|
||
import io.deephaven.chunk.ByteChunk; | ||
import io.deephaven.chunk.attributes.Values; | ||
import io.deephaven.engine.rowset.RowSequence; | ||
import io.deephaven.engine.table.ChunkSource; | ||
import io.deephaven.engine.table.ColumnSource; | ||
import io.deephaven.util.QueryConstants; | ||
import org.apache.parquet.column.statistics.IntStatistics; | ||
import org.apache.parquet.column.statistics.Statistics; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.nio.IntBuffer; | ||
|
||
public class ByteTransfer implements TransferObject<IntBuffer> { | ||
|
||
private final ColumnSource<?> columnSource; | ||
private final ChunkSource.GetContext context; | ||
private ByteChunk<? extends Values> chunk; | ||
private IntBuffer buffer; | ||
private byte minValue = QueryConstants.NULL_BYTE; | ||
private byte maxValue = QueryConstants.NULL_BYTE; | ||
|
||
public ByteTransfer(@NotNull final ColumnSource<?> columnSource, final int targetSize) { | ||
this.columnSource = columnSource; | ||
this.buffer = IntBuffer.allocate(targetSize); | ||
this.context = columnSource.makeGetContext(targetSize); | ||
} | ||
|
||
@Override | ||
public IntBuffer getBuffer() { | ||
return buffer; | ||
} | ||
|
||
@Override | ||
public int rowCount() { | ||
return chunk.size(); | ||
} | ||
|
||
@Override | ||
public void fetchData(@NotNull final RowSequence rs) { | ||
chunk = columnSource.getChunk(context, rs).asByteChunk(); | ||
if(buffer.capacity() < chunk.size()) { | ||
buffer = IntBuffer.allocate(chunk.size()); | ||
} | ||
|
||
buffer.clear(); | ||
for (int ii = 0; ii < chunk.size(); ii++) { | ||
final byte val = chunk.get(ii); | ||
if(val != QueryConstants.NULL_BYTE) { | ||
if (minValue == QueryConstants.NULL_BYTE) { | ||
minValue = maxValue = val; | ||
} else if (val < minValue) { | ||
minValue = val; | ||
} else if (val > maxValue) { | ||
maxValue = val; | ||
} | ||
} | ||
|
||
buffer.put(val); | ||
} | ||
buffer.flip(); | ||
} | ||
|
||
@Override | ||
public void close() { | ||
context.close(); | ||
} | ||
|
||
@Override | ||
public <T extends Comparable<T>> void updateStatistics(@NotNull final Statistics<T> stats) { | ||
if(minValue != QueryConstants.NULL_BYTE) { | ||
((IntStatistics) stats).setMinMax(minValue, maxValue); | ||
} | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
extensions/parquet/table/src/main/java/io/deephaven/parquet/table/transfer/CharTransfer.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,84 @@ | ||
/** | ||
* Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending | ||
*/ | ||
/* | ||
* --------------------------------------------------------------------------------------------------------------------- | ||
* AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY - for any changes edit IntTransfer and regenerate | ||
* --------------------------------------------------------------------------------------------------------------------- | ||
*/ | ||
package io.deephaven.parquet.table.transfer; | ||
|
||
import io.deephaven.chunk.CharChunk; | ||
import io.deephaven.chunk.attributes.Values; | ||
import io.deephaven.engine.rowset.RowSequence; | ||
import io.deephaven.engine.table.ChunkSource; | ||
import io.deephaven.engine.table.ColumnSource; | ||
import io.deephaven.util.QueryConstants; | ||
import org.apache.parquet.column.statistics.IntStatistics; | ||
import org.apache.parquet.column.statistics.Statistics; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.nio.IntBuffer; | ||
|
||
public class CharTransfer implements TransferObject<IntBuffer> { | ||
|
||
private final ColumnSource<?> columnSource; | ||
private final ChunkSource.GetContext context; | ||
private CharChunk<? extends Values> chunk; | ||
private IntBuffer buffer; | ||
private char minValue = QueryConstants.NULL_CHAR; | ||
private char maxValue = QueryConstants.NULL_CHAR; | ||
|
||
public CharTransfer(@NotNull final ColumnSource<?> columnSource, final int targetSize) { | ||
this.columnSource = columnSource; | ||
this.buffer = IntBuffer.allocate(targetSize); | ||
this.context = columnSource.makeGetContext(targetSize); | ||
} | ||
|
||
@Override | ||
public IntBuffer getBuffer() { | ||
return buffer; | ||
} | ||
|
||
@Override | ||
public int rowCount() { | ||
return chunk.size(); | ||
} | ||
|
||
@Override | ||
public void fetchData(@NotNull final RowSequence rs) { | ||
chunk = columnSource.getChunk(context, rs).asCharChunk(); | ||
if(buffer.capacity() < chunk.size()) { | ||
buffer = IntBuffer.allocate(chunk.size()); | ||
} | ||
|
||
buffer.clear(); | ||
for (int ii = 0; ii < chunk.size(); ii++) { | ||
final char val = chunk.get(ii); | ||
if(val != QueryConstants.NULL_CHAR) { | ||
if (minValue == QueryConstants.NULL_CHAR) { | ||
minValue = maxValue = val; | ||
} else if (val < minValue) { | ||
minValue = val; | ||
} else if (val > maxValue) { | ||
maxValue = val; | ||
} | ||
} | ||
|
||
buffer.put(val); | ||
} | ||
buffer.flip(); | ||
} | ||
|
||
@Override | ||
public void close() { | ||
context.close(); | ||
} | ||
|
||
@Override | ||
public <T extends Comparable<T>> void updateStatistics(@NotNull final Statistics<T> stats) { | ||
if(minValue != QueryConstants.NULL_CHAR) { | ||
((IntStatistics) stats).setMinMax(minValue, maxValue); | ||
} | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
...nsions/parquet/table/src/main/java/io/deephaven/parquet/table/transfer/CodecTransfer.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,64 @@ | ||
/** | ||
* Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending | ||
*/ | ||
package io.deephaven.parquet.table.transfer; | ||
|
||
import io.deephaven.chunk.ObjectChunk; | ||
import io.deephaven.chunk.attributes.Values; | ||
import io.deephaven.engine.rowset.RowSequence; | ||
import io.deephaven.engine.table.ChunkSource; | ||
import io.deephaven.engine.table.ColumnSource; | ||
import io.deephaven.util.codec.ObjectCodec; | ||
import org.apache.parquet.column.statistics.Statistics; | ||
import org.apache.parquet.io.api.Binary; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class CodecTransfer<T> implements TransferObject<Binary[]> { | ||
|
||
private final ChunkSource.GetContext context; | ||
private final ObjectCodec<? super T> codec; | ||
private ObjectChunk<T, Values> chunk; | ||
private final Binary[] buffer; | ||
private final ColumnSource<T> columnSource; | ||
|
||
|
||
public CodecTransfer( | ||
@NotNull final ColumnSource<T> columnSource, | ||
@NotNull final ObjectCodec<? super T> codec, | ||
final int targetSize) { | ||
this.columnSource = columnSource; | ||
this.buffer = new Binary[targetSize]; | ||
context = this.columnSource.makeGetContext(targetSize); | ||
this.codec = codec; | ||
} | ||
|
||
@Override | ||
public Binary[] getBuffer() { | ||
return buffer; | ||
} | ||
|
||
@Override | ||
public int rowCount() { | ||
return chunk.size(); | ||
} | ||
|
||
@Override | ||
public void fetchData(@NotNull final RowSequence rs) { | ||
// noinspection unchecked | ||
chunk = (ObjectChunk<T, Values>) columnSource.getChunk(context, rs); | ||
for (int i = 0; i < chunk.size(); i++) { | ||
T value = chunk.get(i); | ||
buffer[i] = value == null ? null : Binary.fromConstantByteArray(codec.encode(value)); | ||
} | ||
} | ||
|
||
@Override | ||
public void close() { | ||
context.close(); | ||
} | ||
|
||
@Override | ||
public <T extends Comparable<T>> void updateStatistics(@NotNull final Statistics<T> stats) { | ||
|
||
} | ||
} |
Oops, something went wrong.