diff --git a/engine/rowset/src/main/java/io/deephaven/engine/rowset/impl/RefCountedCow.java b/engine/rowset/src/main/java/io/deephaven/engine/rowset/impl/RefCountedCow.java index 5c19e42abeb..706d96f0031 100644 --- a/engine/rowset/src/main/java/io/deephaven/engine/rowset/impl/RefCountedCow.java +++ b/engine/rowset/src/main/java/io/deephaven/engine/rowset/impl/RefCountedCow.java @@ -72,14 +72,15 @@ * @param A class that will extend us, to get RefCounted functionality. */ public abstract class RefCountedCow { + private static final boolean debug = - Configuration.getInstance().getBooleanForClassWithDefault(RspArray.class, "debug", false) - || Configuration.getInstance().getBooleanForClassWithDefault(RefCountedCow.class, "debug", false); + Configuration.getInstance().getBooleanForClassWithDefault(RefCountedCow.class, "debug", false); /** * Field updater for refCount, so we can avoid creating an {@link java.util.concurrent.atomic.AtomicInteger} for * each instance. */ + @SuppressWarnings("rawtypes") private static final AtomicIntegerFieldUpdater REFCOUNT_UPDATER = AtomicIntegerFieldUpdater.newUpdater(RefCountedCow.class, "refCount"); diff --git a/engine/rowset/src/main/java/io/deephaven/engine/rowset/impl/rsp/RspRowSequence.java b/engine/rowset/src/main/java/io/deephaven/engine/rowset/impl/rsp/RspRowSequence.java index 3171cda6465..e19b57b8646 100644 --- a/engine/rowset/src/main/java/io/deephaven/engine/rowset/impl/rsp/RspRowSequence.java +++ b/engine/rowset/src/main/java/io/deephaven/engine/rowset/impl/rsp/RspRowSequence.java @@ -37,7 +37,7 @@ private static RspArray wrapRspArray(final RspArray arr) { final RspArray arr, final int startIdx, final long startOffset, final long cardBeforeStartIdx, final int endIdx, final long endOffset, final long cardBeforeEndIdx) { - if (RspBitmap.debug) { + if (RspArray.debug) { if (endIdx < startIdx || (endIdx == startIdx && endOffset < startOffset)) { throw new IllegalArgumentException("Empty " + RspRowSequence.class.getSimpleName() + " :" + diff --git a/engine/rowset/src/main/java/io/deephaven/engine/rowset/impl/singlerange/SingleRange.java b/engine/rowset/src/main/java/io/deephaven/engine/rowset/impl/singlerange/SingleRange.java index e5ccf797dc6..f12f4408656 100644 --- a/engine/rowset/src/main/java/io/deephaven/engine/rowset/impl/singlerange/SingleRange.java +++ b/engine/rowset/src/main/java/io/deephaven/engine/rowset/impl/singlerange/SingleRange.java @@ -4,6 +4,7 @@ package io.deephaven.engine.rowset.impl.singlerange; import io.deephaven.base.verify.Assert; +import io.deephaven.configuration.Configuration; import io.deephaven.engine.rowset.RowSet; import io.deephaven.engine.rowset.impl.OrderedLongSet; import io.deephaven.engine.rowset.impl.OrderedLongSetBuilderSequential; @@ -13,7 +14,6 @@ import io.deephaven.util.datastructures.LongAbortableConsumer; import io.deephaven.engine.rowset.RowSequence; import io.deephaven.chunk.LongChunk; -import io.deephaven.engine.rowset.impl.rsp.RspArray; import io.deephaven.engine.rowset.impl.rsp.RspBitmap; import io.deephaven.engine.rowset.impl.sortedranges.SortedRanges; import io.deephaven.util.datastructures.LongRangeAbortableConsumer; @@ -22,6 +22,10 @@ import java.util.function.LongConsumer; public abstract class SingleRange implements OrderedLongSet { + + private static final boolean debug = + Configuration.getInstance().getBooleanForClassWithDefault(SingleRange.class, "debug", false); + public abstract long rangeStart(); public abstract long rangeEnd(); @@ -129,7 +133,7 @@ public final int ixRefCount() { @SuppressWarnings("unused") private void ifDebugValidate() { - if (RspArray.debug) { + if (debug) { ixValidate(); } } diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/partitioned/BaseTableTransformationColumn.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/partitioned/BaseTableTransformationColumn.java index 82aceeaec68..81776ba100b 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/partitioned/BaseTableTransformationColumn.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/partitioned/BaseTableTransformationColumn.java @@ -18,19 +18,13 @@ import java.util.function.Function; /** - * Base {@link SelectColumn} implementation to wrap transformer functions for - * {@link PartitionedTable#transform(Function)} and - * {@link PartitionedTable#partitionedTransform(PartitionedTable, BiFunction)}. + * Base {@link SelectColumn} implementation to wrap transformer functions for {@link PartitionedTable#transform} and + * {@link PartitionedTable#partitionedTransform}. */ abstract class BaseTableTransformationColumn implements SelectColumn { BaseTableTransformationColumn() {} - @Override - public final List initInputs(@NotNull final Table table) { - return initInputs(table.getRowSet(), table.getColumnSourceMap()); - } - @Override public final Class getReturnedType() { return Table.class; diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/partitioned/LongConstantColumn.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/partitioned/LongConstantColumn.java index 930fa475698..14d476211bf 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/partitioned/LongConstantColumn.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/partitioned/LongConstantColumn.java @@ -12,8 +12,7 @@ import io.deephaven.engine.table.impl.MatchPair; import io.deephaven.engine.table.impl.select.Formula; import io.deephaven.engine.table.impl.select.SelectColumn; -import io.deephaven.engine.table.impl.sources.InMemoryColumnSource; -import io.deephaven.engine.table.impl.sources.SparseArrayColumnSource; +import io.deephaven.engine.table.impl.sources.LongSingleValueSource; import io.deephaven.engine.table.impl.sources.ViewColumnSource; import io.deephaven.util.type.TypeUtils; import org.jetbrains.annotations.NotNull; @@ -70,14 +69,9 @@ public SelectColumn copy() { return new LongConstantColumn(outputColumnName, outputValue); } - @Override - public final List initInputs(@NotNull final Table table) { - return initInputs(table.getRowSet(), table.getColumnSourceMap()); - } - @Override public final Class getReturnedType() { - return Table.class; + return long.class; } @Override @@ -98,12 +92,12 @@ public final MatchPair getMatchPair() { @Override public final WritableColumnSource newDestInstance(final long size) { - return SparseArrayColumnSource.getSparseMemoryColumnSource(size, Table.class); + return new LongSingleValueSource(); } @Override public final WritableColumnSource newFlatDestInstance(final long size) { - return InMemoryColumnSource.getImmutableMemoryColumnSource(size, Table.class, null); + return new LongSingleValueSource(); } @Override diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/perf/UpdatePerformanceTracker.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/perf/UpdatePerformanceTracker.java index db57638f63a..df7dff85b61 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/perf/UpdatePerformanceTracker.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/perf/UpdatePerformanceTracker.java @@ -16,7 +16,6 @@ import io.deephaven.engine.tablelogger.EngineTableLoggers; import io.deephaven.engine.tablelogger.UpdatePerformanceLogLogger; import io.deephaven.engine.updategraph.UpdateGraph; -import io.deephaven.engine.updategraph.UpdateSourceRegistrar; import io.deephaven.engine.updategraph.impl.PeriodicUpdateGraph; import io.deephaven.engine.util.string.StringUtils; import io.deephaven.internal.log.LoggerFactory; @@ -87,18 +86,20 @@ private static class InternalState { private boolean encounteredError = false; private InternalState() { - final UpdateSourceRegistrar registrar = + final UpdateGraph publishingGraph = PeriodicUpdateGraph.getInstance(PeriodicUpdateGraph.DEFAULT_UPDATE_GRAPH_NAME); - Assert.neqNull(registrar, "The " + PeriodicUpdateGraph.DEFAULT_UPDATE_GRAPH_NAME + " UpdateGraph " + Assert.neqNull(publishingGraph, "The " + PeriodicUpdateGraph.DEFAULT_UPDATE_GRAPH_NAME + " UpdateGraph " + "must be created before UpdatePerformanceTracker can be initialized."); - tableLogger = EngineTableLoggers.get().updatePerformanceLogLogger(); - publisher = new UpdatePerformanceStreamPublisher(); - adapter = new StreamToBlinkTableAdapter( - UpdatePerformanceStreamPublisher.definition(), - publisher, - registrar, - UpdatePerformanceTracker.class.getName()); - blink = adapter.table(); + try (final SafeCloseable ignored = ExecutionContext.getContext().withUpdateGraph(publishingGraph).open()) { + tableLogger = EngineTableLoggers.get().updatePerformanceLogLogger(); + publisher = new UpdatePerformanceStreamPublisher(); + adapter = new StreamToBlinkTableAdapter( + UpdatePerformanceStreamPublisher.definition(), + publisher, + publishingGraph, + UpdatePerformanceTracker.class.getName()); + blink = adapter.table(); + } } /** @@ -124,7 +125,6 @@ private synchronized void publish( private static final AtomicInteger entryIdCounter = new AtomicInteger(1); private final UpdateGraph updateGraph; - private final ExecutionContext context; private final PerformanceEntry aggregatedSmallUpdatesEntry; private final PerformanceEntry flushEntry; private final Queue> entries = new LinkedBlockingDeque<>(); @@ -135,9 +135,7 @@ private synchronized void publish( private long intervalStartTimeNanos = QueryConstants.NULL_LONG; public UpdatePerformanceTracker(final UpdateGraph updateGraph) { - this.updateGraph = updateGraph; - this.context = ExecutionContext.getContext() - .withUpdateGraph(Objects.requireNonNull(updateGraph)); + this.updateGraph = Objects.requireNonNull(updateGraph); this.aggregatedSmallUpdatesEntry = new PerformanceEntry( QueryConstants.NULL_INT, QueryConstants.NULL_INT, QueryConstants.NULL_INT, "Aggregated Small Updates", null, updateGraph.getName()); @@ -166,7 +164,9 @@ public void flush() { } final long intervalEndTimeMillis = System.currentTimeMillis(); final long intervalEndTimeNanos = System.nanoTime(); - try (final SafeCloseable ignored1 = context.open()) { + // This happens on the primary refresh thread of this UPT's UpdateGraph. It should already have that UG + // installed in the ExecutionContext. If we need another UG, that's the responsibility of the publish callbacks. + try { finishInterval( getInternalState(), intervalStartTimeMillis, diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/AbstractFormulaColumn.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/AbstractFormulaColumn.java index bda2ebcac4c..14c7ea9e6e4 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/AbstractFormulaColumn.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/AbstractFormulaColumn.java @@ -66,11 +66,6 @@ protected AbstractFormulaColumn(String columnName, String formulaString) { this.columnName = NameValidator.validateColumnName(columnName); } - @Override - public List initInputs(Table table) { - return initInputs(table.getRowSet(), table.getColumnSourceMap()); - } - @Override public Class getReturnedType() { return returnedType; diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/FunctionalColumn.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/FunctionalColumn.java index d9694d24573..2dda0e38dda 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/FunctionalColumn.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/FunctionalColumn.java @@ -8,6 +8,8 @@ import io.deephaven.api.util.NameValidator; import io.deephaven.engine.table.impl.MatchPair; import io.deephaven.engine.table.impl.NoSuchColumnException; +import io.deephaven.engine.table.impl.sources.InMemoryColumnSource; +import io.deephaven.engine.table.impl.sources.SparseArrayColumnSource; import io.deephaven.engine.table.impl.sources.ViewColumnSource; import io.deephaven.engine.table.WritableColumnSource; import io.deephaven.chunk.*; @@ -86,11 +88,6 @@ public String toString() { return "function(" + sourceName + ',' + destName + ')'; } - @Override - public List initInputs(Table table) { - throw new UnsupportedOperationException(); - } - @Override public List initInputs(TrackingRowSet rowSet, Map> columnsOfInterest) { // noinspection unchecked @@ -207,13 +204,13 @@ public MatchPair getMatchPair() { } @Override - public WritableColumnSource newDestInstance(long size) { - throw new UnsupportedOperationException(); + public final WritableColumnSource newDestInstance(final long size) { + return SparseArrayColumnSource.getSparseMemoryColumnSource(size, destDataType); } @Override - public WritableColumnSource newFlatDestInstance(long size) { - throw new UnsupportedOperationException(); + public final WritableColumnSource newFlatDestInstance(final long size) { + return InMemoryColumnSource.getImmutableMemoryColumnSource(size, destDataType, componentType); } @Override diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/MultiSourceFunctionalColumn.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/MultiSourceFunctionalColumn.java index eacc1f7c725..880a841660e 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/MultiSourceFunctionalColumn.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/MultiSourceFunctionalColumn.java @@ -9,6 +9,8 @@ import io.deephaven.engine.table.impl.MatchPair; import io.deephaven.engine.table.impl.NoSuchColumnException; import io.deephaven.engine.table.impl.PrevColumnSource; +import io.deephaven.engine.table.impl.sources.InMemoryColumnSource; +import io.deephaven.engine.table.impl.sources.SparseArrayColumnSource; import io.deephaven.engine.table.impl.sources.ViewColumnSource; import io.deephaven.engine.table.WritableColumnSource; import io.deephaven.chunk.attributes.Values; @@ -39,8 +41,6 @@ public class MultiSourceFunctionalColumn implements SelectColumn { @NotNull private final Class componentType; - boolean usesPython; - public MultiSourceFunctionalColumn(@NotNull List sourceNames, @NotNull String destName, @NotNull Class destDataType, @@ -69,11 +69,6 @@ public String toString() { return "function(" + String.join(",", sourceNames) + ',' + destName + ')'; } - @Override - public List initInputs(Table table) { - throw new UnsupportedOperationException(); - } - @Override public List initInputs(TrackingRowSet rowSet, Map> columnsOfInterest) { final List> localSources = new ArrayList<>(sourceNames.size()); @@ -203,13 +198,13 @@ public MatchPair getMatchPair() { } @Override - public WritableColumnSource newDestInstance(long size) { - throw new UnsupportedOperationException(); + public final WritableColumnSource newDestInstance(final long size) { + return SparseArrayColumnSource.getSparseMemoryColumnSource(size, destDataType); } @Override - public WritableColumnSource newFlatDestInstance(long size) { - throw new UnsupportedOperationException(); + public final WritableColumnSource newFlatDestInstance(final long size) { + return InMemoryColumnSource.getImmutableMemoryColumnSource(size, destDataType, componentType); } @Override diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/NullSelectColumn.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/NullSelectColumn.java index eb81a089fe7..8a544d80048 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/NullSelectColumn.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/NullSelectColumn.java @@ -25,11 +25,6 @@ public NullSelectColumn(final Class type, final Class elementType, final S this.name = name; } - @Override - public List initInputs(final Table table) { - return Collections.emptyList(); - } - @Override public List initInputs(final TrackingRowSet rowSet, final Map> columnsOfInterest) { @@ -80,12 +75,12 @@ public MatchPair getMatchPair() { @Override public WritableColumnSource newDestInstance(final long size) { - return SparseArrayColumnSource.getSparseMemoryColumnSource(size, nvcs.getType(), nvcs.getComponentType()); + return nvcs; } @Override public WritableColumnSource newFlatDestInstance(final long size) { - return InMemoryColumnSource.getImmutableMemoryColumnSource(size, nvcs.getType(), nvcs.getComponentType()); + return nvcs; } @Override diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/ReinterpretedColumn.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/ReinterpretedColumn.java index 30a8b3ae3be..b76c64456d9 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/ReinterpretedColumn.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/ReinterpretedColumn.java @@ -93,11 +93,6 @@ public String toString() { return "reinterpretAs(" + sourceName + ',' + destName + ')'; } - @Override - public List initInputs(Table table) { - throw new UnsupportedOperationException(); - } - @Override public List initInputs(TrackingRowSet rowSet, Map> columnsOfInterest) { // noinspection unchecked diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/SelectColumn.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/SelectColumn.java index 94da807c2cb..31295a0e0ea 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/SelectColumn.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/SelectColumn.java @@ -17,7 +17,6 @@ import io.deephaven.engine.table.ColumnDefinition; import io.deephaven.engine.table.ColumnSource; import io.deephaven.engine.table.impl.MatchPair; -import io.deephaven.engine.table.Table; import io.deephaven.engine.table.WritableColumnSource; import io.deephaven.engine.table.impl.BaseTable; import org.jetbrains.annotations.NotNull; @@ -61,15 +60,6 @@ static Collection copyFrom(Collection selectColumns) */ SelectColumn[] ZERO_LENGTH_SELECT_COLUMN_ARRAY = new SelectColumn[0]; - /** - * Initialize the SelectColumn using the input table and return a list of underlying columns that this SelectColumn - * is dependent upon. - * - * @param table the table to initialize internals from - * @return a list containing all columns from 'table' that the result depends on - */ - List initInputs(Table table); - /** * Initialize the column from the provided set of underlying columns and row set. * diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/SourceColumn.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/SourceColumn.java index 99b95da6f77..bebb014aabd 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/SourceColumn.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/SourceColumn.java @@ -51,15 +51,6 @@ private SourceColumn(String sourceName, String destName, boolean unused) { this.destName = destName; } - @Override - public List initInputs(Table table) { - this.sourceColumn = table.getColumnSource(sourceName); - if (sourceColumn == null) { - throw new NoSuchColumnException(table.getDefinition().getColumnNames(), sourceName); - } - return Collections.singletonList(sourceName); - } - @Override public List initInputs(TrackingRowSet rowSet, Map> columnsOfInterest) { this.sourceColumn = columnsOfInterest.get(sourceName); diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/SwitchColumn.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/SwitchColumn.java index 584dadd3816..d2483b6433c 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/SwitchColumn.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/SwitchColumn.java @@ -32,18 +32,6 @@ public SwitchColumn(String columnName, String expression, FormulaParserConfigura this.parser = parserConfiguration; } - @Override - public List initInputs(Table table) { - if (realColumn == null) { - if (table.getDefinition().getColumn(expression) != null) { - realColumn = new SourceColumn(expression, columnName); - } else { - realColumn = FormulaColumn.createFormulaColumn(columnName, expression, parser); - } - } - return realColumn.initInputs(table); - } - @Override public List initInputs(TrackingRowSet rowSet, Map> columnsOfInterest) { if (realColumn == null) { diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/sources/NullValueColumnSource.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/sources/NullValueColumnSource.java index da10ae46990..bc576c7eb25 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/sources/NullValueColumnSource.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/sources/NullValueColumnSource.java @@ -5,6 +5,7 @@ import io.deephaven.base.Pair; import io.deephaven.base.verify.Assert; +import io.deephaven.chunk.Chunk; import io.deephaven.chunk.LongChunk; import io.deephaven.chunk.attributes.Values; import io.deephaven.engine.rowset.chunkattributes.RowKeys; @@ -12,10 +13,10 @@ import io.deephaven.engine.table.ColumnDefinition; import io.deephaven.engine.table.TableDefinition; import io.deephaven.engine.rowset.RowSequence; +import io.deephaven.engine.table.WritableColumnSource; import io.deephaven.engine.table.impl.AbstractColumnSource; import io.deephaven.hash.KeyedObjectHashMap; import io.deephaven.hash.KeyedObjectKey; -import io.deephaven.util.QueryConstants; import io.deephaven.chunk.WritableChunk; import io.deephaven.engine.table.impl.util.ShiftData; import org.jetbrains.annotations.NotNull; @@ -24,11 +25,21 @@ import java.util.LinkedHashMap; import java.util.stream.Collectors; +import static io.deephaven.util.QueryConstants.NULL_BYTE; +import static io.deephaven.util.QueryConstants.NULL_CHAR; +import static io.deephaven.util.QueryConstants.NULL_DOUBLE; +import static io.deephaven.util.QueryConstants.NULL_FLOAT; +import static io.deephaven.util.QueryConstants.NULL_INT; +import static io.deephaven.util.QueryConstants.NULL_LONG; +import static io.deephaven.util.QueryConstants.NULL_SHORT; + /** - * A column source that returns null for all keys. + * A column source that returns null for all keys. Trivially "writable" since it can only contain null values. */ -public class NullValueColumnSource extends AbstractColumnSource - implements ShiftData.ShiftCallback, InMemoryColumnSource, RowKeyAgnosticChunkSource { +public final class NullValueColumnSource extends AbstractColumnSource + implements ShiftData.ShiftCallback, InMemoryColumnSource, RowKeyAgnosticChunkSource, + WritableColumnSource { + private static final KeyedObjectKey.Basic, Class>, NullValueColumnSource> KEY_TYPE = new KeyedObjectKey.Basic<>() { @Override @@ -78,37 +89,37 @@ public Boolean getBoolean(long rowKey) { @Override public byte getByte(long rowKey) { - return QueryConstants.NULL_BYTE; + return NULL_BYTE; } @Override public char getChar(long rowKey) { - return QueryConstants.NULL_CHAR; + return NULL_CHAR; } @Override public double getDouble(long rowKey) { - return QueryConstants.NULL_DOUBLE; + return NULL_DOUBLE; } @Override public float getFloat(long rowKey) { - return QueryConstants.NULL_FLOAT; + return NULL_FLOAT; } @Override public int getInt(long rowKey) { - return QueryConstants.NULL_INT; + return NULL_INT; } @Override public long getLong(long rowKey) { - return QueryConstants.NULL_LONG; + return NULL_LONG; } @Override public short getShort(long rowKey) { - return QueryConstants.NULL_SHORT; + return NULL_SHORT; } @Override @@ -123,37 +134,37 @@ public Boolean getPrevBoolean(long rowKey) { @Override public byte getPrevByte(long rowKey) { - return QueryConstants.NULL_BYTE; + return NULL_BYTE; } @Override public char getPrevChar(long rowKey) { - return QueryConstants.NULL_CHAR; + return NULL_CHAR; } @Override public double getPrevDouble(long rowKey) { - return QueryConstants.NULL_DOUBLE; + return NULL_DOUBLE; } @Override public float getPrevFloat(long rowKey) { - return QueryConstants.NULL_FLOAT; + return NULL_FLOAT; } @Override public int getPrevInt(long rowKey) { - return QueryConstants.NULL_INT; + return NULL_INT; } @Override public long getPrevLong(long rowKey) { - return QueryConstants.NULL_LONG; + return NULL_LONG; } @Override public short getPrevShort(long rowKey) { - return QueryConstants.NULL_SHORT; + return NULL_SHORT; } @Override @@ -213,4 +224,94 @@ public void fillPrevChunkUnordered(@NotNull FillContext context, @NotNull Writab public boolean providesFillUnordered() { return true; } + + private static void throwUnsupported() { + throw new UnsupportedOperationException("NullValueColumnSource cannot contain non-null values"); + } + + @Override + public void set(final long key, final T value) { + if (value != null) { + throwUnsupported(); + } + } + + @Override + public void set(final long key, final byte value) { + if (value != NULL_BYTE) { + throwUnsupported(); + } + } + + @Override + public void set(final long key, final char value) { + if (value != NULL_CHAR) { + throwUnsupported(); + } + } + + @Override + public void set(final long key, final double value) { + if (value != NULL_DOUBLE) { + throwUnsupported(); + } + } + + @Override + public void set(final long key, final float value) { + if (value != NULL_FLOAT) { + throwUnsupported(); + } + } + + @Override + public void set(final long key, final int value) { + if (value != NULL_INT) { + throwUnsupported(); + } + } + + @Override + public void set(final long key, final long value) { + if (value != NULL_LONG) { + throwUnsupported(); + } + } + + @Override + public void set(final long key, final short value) { + if (value != NULL_SHORT) { + throwUnsupported(); + } + } + + @Override + public void setNull(final long key) {} + + @Override + public void setNull(@NotNull final RowSequence orderedKeys) {} + + @Override + public void ensureCapacity(final long capacity, final boolean nullFilled) {} + + @Override + public FillFromContext makeFillFromContext(int chunkCapacity) { + return DEFAULT_FILL_FROM_INSTANCE; + } + + @Override + public void fillFromChunk( + @NotNull final FillFromContext context, + @NotNull final Chunk src, + @NotNull final RowSequence rowSequence) { + // Assume all values in src are null, which will be true for any correct usage. + } + + @Override + public void fillFromChunkUnordered( + @NotNull final FillFromContext context, + @NotNull final Chunk src, + @NotNull final LongChunk keys) { + // Assume all values in src are null, which will be true for any correct usage. + } } diff --git a/engine/table/src/test/java/io/deephaven/engine/table/impl/TestFormulaArrayEvaluation.java b/engine/table/src/test/java/io/deephaven/engine/table/impl/TestFormulaArrayEvaluation.java index 60dd4fc8fde..a83c3e7ddf7 100644 --- a/engine/table/src/test/java/io/deephaven/engine/table/impl/TestFormulaArrayEvaluation.java +++ b/engine/table/src/test/java/io/deephaven/engine/table/impl/TestFormulaArrayEvaluation.java @@ -270,7 +270,9 @@ public void testViewIncrementalRandomizedPerformanceTest() { simulateShiftAwareStep(size, random, queryTable, columnInfo, en); } final long duration = System.currentTimeMillis() - startTm; - Assert.assertTrue("test finishes in less than 15 seconds", duration < 15_000); + Assert.assertTrue( + String.format("Test finishes in less than 15 seconds, instead duration was %d ms", duration), + duration < 15_000); } @Test diff --git a/engine/table/src/test/java/io/deephaven/engine/table/impl/select/TestFormulaColumn.java b/engine/table/src/test/java/io/deephaven/engine/table/impl/select/TestFormulaColumn.java index e784ed72dc8..79ba3d9182f 100644 --- a/engine/table/src/test/java/io/deephaven/engine/table/impl/select/TestFormulaColumn.java +++ b/engine/table/src/test/java/io/deephaven/engine/table/impl/select/TestFormulaColumn.java @@ -357,7 +357,7 @@ public void testCasts() { { FormulaColumn formulaColumn = FormulaColumn.createFormulaColumn("Foo", "(double)IntCol"); formulaColumn.initDef(availableColumns); - formulaColumn.initInputs(testDataTable); + formulaColumn.initInputs(testDataTable.getRowSet(), testDataTable.getColumnSourceMap()); result = formulaColumn.getDataView().getDouble(0); assertEquals((double) BASE_VALUES[0], result); @@ -557,7 +557,7 @@ private void testWrapWithCastHelper(final Class type, final String cast) { private FormulaColumn initCheck(String formulaString) { FormulaColumn formulaColumn = FormulaColumn.createFormulaColumn("Foo", formulaString); formulaColumn.initDef(availableColumns); - formulaColumn.initInputs(testDataTable); + formulaColumn.initInputs(testDataTable.getRowSet(), testDataTable.getColumnSourceMap()); return formulaColumn; } diff --git a/engine/table/src/test/java/io/deephaven/engine/table/impl/select/TestFormulaColumnGeneration.java b/engine/table/src/test/java/io/deephaven/engine/table/impl/select/TestFormulaColumnGeneration.java index 57b3c9080ce..1265f4ae1a1 100644 --- a/engine/table/src/test/java/io/deephaven/engine/table/impl/select/TestFormulaColumnGeneration.java +++ b/engine/table/src/test/java/io/deephaven/engine/table/impl/select/TestFormulaColumnGeneration.java @@ -74,7 +74,7 @@ private static FormulaColumn getFormulaColumn() { // final DhFormulaColumn fc = new DhFormulaColumn("Value", "k * i * ii"); // final DhFormulaColumn fc = new DhFormulaColumn("Value", "'2019-04-11T09:30 NY'"); final FormulaColumn fc = FormulaColumn.createFormulaColumn("Value", "I * II + q * ii + II_[i - 1]"); - fc.initInputs(table); + fc.initInputs(table.getRowSet(), table.getColumnSourceMap()); return fc; } }