-
Notifications
You must be signed in to change notification settings - Fork 81
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
Showing
17 changed files
with
164 additions
and
147 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
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
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
93 changes: 93 additions & 0 deletions
93
...sions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/ChunkReaderFactory.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,93 @@ | ||
// | ||
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending | ||
// | ||
package io.deephaven.extensions.barrage.chunk; | ||
|
||
import io.deephaven.chunk.ChunkType; | ||
import io.deephaven.extensions.barrage.util.StreamReaderOptions; | ||
import org.apache.arrow.flatbuf.Field; | ||
import org.apache.arrow.flatbuf.Type; | ||
|
||
/** | ||
* Supports creation of {@link ChunkReader} instances to use when processing a flight stream. JVM implementations for | ||
* client and server should probably use {@link DefaultChunkReadingFactory#INSTANCE}. | ||
*/ | ||
public interface ChunkReaderFactory { | ||
/** | ||
* Describes type info used by factory implementations when creating a ChunkReader. | ||
*/ | ||
class TypeInfo { | ||
private final ChunkType chunkType; | ||
private final Class<?> type; | ||
private final Class<?> componentType; | ||
private final Field arrowField; | ||
|
||
public TypeInfo(ChunkType chunkType, Class<?> type, Class<?> componentType, Field arrowField) { | ||
this.chunkType = chunkType; | ||
this.type = type; | ||
this.componentType = componentType; | ||
this.arrowField = arrowField; | ||
} | ||
|
||
public ChunkType chunkType() { | ||
return chunkType; | ||
} | ||
|
||
public Class<?> type() { | ||
return type; | ||
} | ||
|
||
public Class<?> componentType() { | ||
return componentType; | ||
} | ||
|
||
public Field arrowField() { | ||
return arrowField; | ||
} | ||
|
||
public Field componentArrowField() { | ||
if (arrowField.typeType() != Type.List) { | ||
throw new IllegalStateException("Not a flight List"); | ||
} | ||
if (arrowField.childrenLength() != 1) { | ||
throw new IllegalStateException("Incorrect number of child Fields"); | ||
} | ||
return arrowField.children(0); | ||
} | ||
} | ||
|
||
/** | ||
* Factory method to create a TypeInfo instance. | ||
* | ||
* @param chunkType the output chunk type | ||
* @param type the Java type to be read into the chunk | ||
* @param componentType the Java type of nested components | ||
* @param arrowField the Arrow type to be read into the chunk | ||
* @return a TypeInfo instance | ||
*/ | ||
static TypeInfo typeInfo(ChunkType chunkType, Class<?> type, Class<?> componentType, Field arrowField) { | ||
return new TypeInfo(chunkType, type, componentType, arrowField); | ||
} | ||
|
||
/** | ||
* Returns a {@link ChunkReader} for the specified arguments. | ||
* | ||
* @param options options for reading the stream | ||
* @param factor a multiplicative factor to apply when reading integers | ||
* @param typeInfo the type of data to read into a chunk | ||
* @return a ChunkReader based on the given options, factory, and type to read | ||
*/ | ||
ChunkReader getReader(final StreamReaderOptions options, final int factor, final TypeInfo typeInfo); | ||
|
||
/** | ||
* Returns a {@link ChunkReader} for the specified arguments. | ||
* | ||
* @param options options for reading the stream | ||
* @param typeInfo the type of data to read into a chunk | ||
* @return a ChunkReader based on the given options, factory, and type to read | ||
*/ | ||
default ChunkReader getReader(final StreamReaderOptions options, final TypeInfo typeInfo) { | ||
return getReader(options, 1, typeInfo); | ||
} | ||
|
||
} |
85 changes: 0 additions & 85 deletions
85
...ions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/ChunkReadingFactory.java
This file was deleted.
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
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
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
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.