Skip to content

Commit

Permalink
feat: Support type checking when retrieving an objectColumnIterator (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rbasralian authored Sep 25, 2024
1 parent 004765a commit 77caf0d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
3 changes: 3 additions & 0 deletions engine/api/src/main/java/io/deephaven/engine/table/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ public interface Table extends

<DATA_TYPE> CloseableIterator<DATA_TYPE> objectColumnIterator(@NotNull String columnName);

<DATA_TYPE> CloseableIterator<DATA_TYPE> objectColumnIterator(@NotNull String columnName,
@NotNull Class<? extends DATA_TYPE> clazz);

// -----------------------------------------------------------------------------------------------------------------
// Filter Operations
// -----------------------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,12 @@ public <DATA_TYPE> CloseableIterator<DATA_TYPE> objectColumnIterator(@NotNull fi
return new ChunkedObjectColumnIterator<>(getColumnSource(columnName, Object.class), getRowSet());
}

@Override
public <DATA_TYPE> CloseableIterator<DATA_TYPE> objectColumnIterator(@NotNull final String columnName,
@NotNull Class<? extends DATA_TYPE> clazz) {
return new ChunkedObjectColumnIterator<>(getColumnSource(columnName, clazz), getRowSet());
}

// endregion Column Iterators

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ default <DATA_TYPE> CloseableIterator<DATA_TYPE> objectColumnIterator(@NotNull S
return throwUnsupported();
}

@Override
default <DATA_TYPE> CloseableIterator<DATA_TYPE> objectColumnIterator(@NotNull String columnName,
@NotNull Class<? extends DATA_TYPE> clazz) {
return throwUnsupported();
}

@Override
default Table wouldMatch(WouldMatchPair... matchers) {
return throwUnsupported();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ public <DATA_TYPE> CloseableIterator<DATA_TYPE> objectColumnIterator(@NotNull St
return coalesce().objectColumnIterator(columnName);
}

@Override
public <DATA_TYPE> CloseableIterator<DATA_TYPE> objectColumnIterator(@NotNull String columnName,
@NotNull Class<? extends DATA_TYPE> clazz) {
return coalesce().objectColumnIterator(columnName, clazz);
}

@Override
@ConcurrentMethod
public Table where(Filter filter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public void setUp() throws Exception {
final PartitionedTable partitionedInputData = inputData.partitionBy("PC");
final String[] partitionedInputDestinations;
try (final Stream<String> partitionNames = partitionedInputData.table()
.<String>objectColumnIterator("PC").stream()) {
.objectColumnIterator("PC", String.class).stream()) {
partitionedInputDestinations = partitionNames.map(pcv -> new File(dataDirectory,
"IP" + File.separator + "P" + pcv + File.separator + tableName + File.separator
+ PARQUET_FILE_NAME)
Expand All @@ -242,7 +242,7 @@ public void setUp() throws Exception {
final PartitionedTable partitionedInputMissingData = inputMissingData.view("PC", "II").partitionBy("PC");
final String[] partitionedInputMissingDestinations;
try (final Stream<String> partitionNames = partitionedInputMissingData.table()
.<String>objectColumnIterator("PC").stream()) {
.objectColumnIterator("PC", String.class).stream()) {
partitionedInputMissingDestinations = partitionNames.map(pcv -> new File(dataDirectory,
"IP" + File.separator + "P" + pcv + File.separator + tableName + File.separator
+ PARQUET_FILE_NAME)
Expand Down

0 comments on commit 77caf0d

Please sign in to comment.