From d8a2f5fe594d11c388bb403488a5493eed3a0726 Mon Sep 17 00:00:00 2001 From: "Charles P. Wright" Date: Mon, 4 Nov 2024 09:18:19 -0500 Subject: [PATCH] spotless --- .../table/impl/select/FunctionalColumn.java | 6 +- .../select/MultiSourceFunctionalColumn.java | 3 +- .../table/impl/select/SelectColumn.java | 1 + .../SelectColumnWithoutAlwaysEvaluate.java | 8 ++- .../table/impl/select/SourceColumn.java | 4 +- .../table/impl/select/SwitchColumn.java | 8 +-- .../select/analyzers/ConstantColumnLayer.java | 3 +- .../impl/QueryTableSelectUpdateTest.java | 62 ++++++++++++------- 8 files changed, 62 insertions(+), 33 deletions(-) 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 3c9654748a6..c5ab566aa26 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 @@ -253,7 +253,8 @@ public boolean isStateless() { @Override public FunctionalColumn copy() { - return new FunctionalColumn<>(sourceName, sourceDataType, destName, destDataType, componentType, function, alwaysEvaluate); + return new FunctionalColumn<>(sourceName, sourceDataType, destName, destDataType, componentType, function, + alwaysEvaluate); } @Override @@ -263,6 +264,7 @@ public boolean alwaysEvaluate() { @Override public SelectColumn alwaysEvaluateCopy() { - return new FunctionalColumn<>(sourceName, sourceDataType, destName, destDataType, componentType, function, true); + return new FunctionalColumn<>(sourceName, sourceDataType, destName, destDataType, componentType, function, + true); } } 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 3a8eaec671d..383fc4c597d 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 @@ -227,7 +227,8 @@ public boolean isStateless() { @Override public MultiSourceFunctionalColumn copy() { - return new MultiSourceFunctionalColumn<>(sourceNames, destName, destDataType, componentType, function, alwaysEvaluate); + return new MultiSourceFunctionalColumn<>(sourceNames, destName, destDataType, componentType, function, + alwaysEvaluate); } @Override 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 f1db7541b31..1392a47497f 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 @@ -234,6 +234,7 @@ default boolean hasVirtualRowVariables() { /** * Should we ignore modified column sets, and always re-evaluate this column? + * * @return true if this column should be evaluated on every row modification */ boolean alwaysEvaluate(); diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/SelectColumnWithoutAlwaysEvaluate.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/SelectColumnWithoutAlwaysEvaluate.java index edb2964e88a..3efe15e618f 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/SelectColumnWithoutAlwaysEvaluate.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/SelectColumnWithoutAlwaysEvaluate.java @@ -1,9 +1,15 @@ +// +// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending +// package io.deephaven.engine.table.impl.select; /** * This is a base class for SelectColumn implementations that do not support {@link SelectColumn#alwaysEvaluate()}. * - *

These columns always return false for {@link #alwaysEvaluate()} and {@link #alwaysEvaluateCopy()} calls {@link #copy()}.

+ *

+ * These columns always return false for {@link #alwaysEvaluate()} and {@link #alwaysEvaluateCopy()} calls + * {@link #copy()}. + *

*/ public abstract class SelectColumnWithoutAlwaysEvaluate implements SelectColumn { @Override 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 e50e476a764..d1843f72307 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 @@ -179,7 +179,7 @@ public boolean isStateless() { public SourceColumn copy() { return new SourceColumn(sourceName, destName); } - + @Override public boolean alwaysEvaluate() { return alwaysEvaluate; @@ -189,4 +189,4 @@ public boolean alwaysEvaluate() { public SelectColumn alwaysEvaluateCopy() { return new SourceColumn(sourceName, destName, true); } -} \ No newline at end of file +} 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 cf49a3d9a75..aeec8a3ac07 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,9 +32,9 @@ public SwitchColumn(String columnName, String expression, FormulaParserConfigura } private SwitchColumn(final String columnName, - final String expression, - final FormulaParserConfiguration parserConfiguration, - final boolean alwaysEvaluate) { + final String expression, + final FormulaParserConfiguration parserConfiguration, + final boolean alwaysEvaluate) { this.expression = Require.neqNull(expression, "expression"); this.columnName = NameValidator.validateColumnName(columnName); this.parser = parserConfiguration; @@ -175,4 +175,4 @@ public boolean alwaysEvaluate() { public SelectColumn alwaysEvaluateCopy() { return new SwitchColumn(columnName, expression, parser, true); } -} \ No newline at end of file +} diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/analyzers/ConstantColumnLayer.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/analyzers/ConstantColumnLayer.java index 7ce085aeef7..10b18e50e3c 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/select/analyzers/ConstantColumnLayer.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/select/analyzers/ConstantColumnLayer.java @@ -23,7 +23,8 @@ public class ConstantColumnLayer extends SelectOrViewColumnLayer { final ModifiedColumnSet mcsBuilder) { super(context, sc, ws, null, deps, mcsBuilder); if (sc.alwaysEvaluate()) { - throw new IllegalArgumentException("SelectColumn may not have alwaysEvaluate set for a constant column: " + sc); + throw new IllegalArgumentException( + "SelectColumn may not have alwaysEvaluate set for a constant column: " + sc); } initialize(ws); } diff --git a/engine/table/src/test/java/io/deephaven/engine/table/impl/QueryTableSelectUpdateTest.java b/engine/table/src/test/java/io/deephaven/engine/table/impl/QueryTableSelectUpdateTest.java index 9bb8d1bb7ed..311213bf09b 100644 --- a/engine/table/src/test/java/io/deephaven/engine/table/impl/QueryTableSelectUpdateTest.java +++ b/engine/table/src/test/java/io/deephaven/engine/table/impl/QueryTableSelectUpdateTest.java @@ -1308,42 +1308,51 @@ public void testAlwaysUpdate() { final MutableInt count2 = new MutableInt(0); QueryScope.addParam("__COUNT1", count); QueryScope.addParam("__COUNT2", count2); - final QueryTable base = testRefreshingTable(intCol("Sentinel", 1,2,3,4,5,6,7,8,9), + final QueryTable base = testRefreshingTable(intCol("Sentinel", 1, 2, 3, 4, 5, 6, 7, 8, 9), stringCol("Thing", "A", "B", "C", "D", "E", "F", "G", "H", "I")); final SelectColumn sc1 = SelectColumnFactory.getExpression("NormalCount=__COUNT1.getAndIncrement()"); - final SelectColumn sc2 = SelectColumnFactory.getExpression("AlwaysCount=__COUNT2.getAndIncrement()").alwaysEvaluateCopy(); + final SelectColumn sc2 = + SelectColumnFactory.getExpression("AlwaysCount=__COUNT2.getAndIncrement()").alwaysEvaluateCopy(); final Table withUpdates = base.update(Arrays.asList(sc1, sc2)); final ControlledUpdateGraph updateGraph = ExecutionContext.getContext().getUpdateGraph().cast(); - assertArrayEquals(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8}, ColumnVectors.ofInt(withUpdates, "NormalCount").toArray()); - assertArrayEquals(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8}, ColumnVectors.ofInt(withUpdates, "AlwaysCount").toArray()); + assertArrayEquals(new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8}, + ColumnVectors.ofInt(withUpdates, "NormalCount").toArray()); + assertArrayEquals(new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8}, + ColumnVectors.ofInt(withUpdates, "AlwaysCount").toArray()); updateGraph.runWithinUnitTestCycle(() -> { addToTable(base, i(9), intCol("Sentinel", 10), stringCol("Thing", "J")); base.notifyListeners(i(9), i(), i()); }); - assertArrayEquals(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, ColumnVectors.ofInt(withUpdates, "NormalCount").toArray()); - assertArrayEquals(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, ColumnVectors.ofInt(withUpdates, "AlwaysCount").toArray()); + assertArrayEquals(new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, + ColumnVectors.ofInt(withUpdates, "NormalCount").toArray()); + assertArrayEquals(new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, + ColumnVectors.ofInt(withUpdates, "AlwaysCount").toArray()); updateGraph.runWithinUnitTestCycle(() -> { - addToTable(base, i(0, 2, 4), intCol("Sentinel", 1, 3 ,5), stringCol("Thing", "a", "c", "e")); - base.notifyListeners(i(), i(), i(0,2,4)); + addToTable(base, i(0, 2, 4), intCol("Sentinel", 1, 3, 5), stringCol("Thing", "a", "c", "e")); + base.notifyListeners(i(), i(), i(0, 2, 4)); }); - assertArrayEquals(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, ColumnVectors.ofInt(withUpdates, "NormalCount").toArray()); - assertArrayEquals(new int[] { 10, 1, 11, 3, 12, 5, 6, 7, 8, 9}, ColumnVectors.ofInt(withUpdates, "AlwaysCount").toArray()); + assertArrayEquals(new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, + ColumnVectors.ofInt(withUpdates, "NormalCount").toArray()); + assertArrayEquals(new int[] {10, 1, 11, 3, 12, 5, 6, 7, 8, 9}, + ColumnVectors.ofInt(withUpdates, "AlwaysCount").toArray()); updateGraph.runWithinUnitTestCycle(() -> { removeRows(base, i(5)); base.notifyListeners(i(), i(5), i()); }); - assertArrayEquals(new int[] { 0, 1, 2, 3, 4, 6, 7, 8, 9}, ColumnVectors.ofInt(withUpdates, "NormalCount").toArray()); - assertArrayEquals(new int[] { 10, 1, 11, 3, 12, 6, 7, 8, 9}, ColumnVectors.ofInt(withUpdates, "AlwaysCount").toArray()); + assertArrayEquals(new int[] {0, 1, 2, 3, 4, 6, 7, 8, 9}, + ColumnVectors.ofInt(withUpdates, "NormalCount").toArray()); + assertArrayEquals(new int[] {10, 1, 11, 3, 12, 6, 7, 8, 9}, + ColumnVectors.ofInt(withUpdates, "AlwaysCount").toArray()); } @Test @@ -1352,48 +1361,57 @@ public void testAlwaysUpdateMCS() { QueryScope.addParam("a", a); final AtomicInteger b = new AtomicInteger(200); QueryScope.addParam("b", b); - final QueryTable base = testRefreshingTable(RowSetFactory.fromKeys(10, 11).toTracking(), intCol("Sentinel", 1, 2), intCol("B",10, 11)); + final QueryTable base = testRefreshingTable(RowSetFactory.fromKeys(10, 11).toTracking(), + intCol("Sentinel", 1, 2), intCol("B", 10, 11)); final SelectColumn x = SelectColumnFactory.getExpression("X = a.getAndIncrement()").alwaysEvaluateCopy(); - final Table withUpdates = base.update(Arrays.asList(x, SelectColumnFactory.getExpression("Y=1"), SelectColumnFactory.getExpression("Z=B+b.getAndIncrement()"))); + final Table withUpdates = base.update(Arrays.asList(x, SelectColumnFactory.getExpression("Y=1"), + SelectColumnFactory.getExpression("Z=B+b.getAndIncrement()"))); final PrintListener pl = new PrintListener("withUpdates", withUpdates, 10); final SimpleListener simpleListener = new SimpleListener(withUpdates); withUpdates.addUpdateListener(simpleListener); - assertTableEquals(TableTools.newTable(intCol("Sentinel", 1, 2), intCol("B", 10, 11), intCol("X", 100, 101), intCol("Y", 1, 1), intCol("Z", 210, 212)), withUpdates); + assertTableEquals(TableTools.newTable(intCol("Sentinel", 1, 2), intCol("B", 10, 11), intCol("X", 100, 101), + intCol("Y", 1, 1), intCol("Z", 210, 212)), withUpdates); final ControlledUpdateGraph updateGraph = ExecutionContext.getContext().getUpdateGraph().cast(); updateGraph.runWithinUnitTestCycle(() -> { addToTable(base, i(10), intCol("Sentinel", 3), intCol("B", 10)); - base.notifyListeners(new TableUpdateImpl(i(), i(), i(10), RowSetShiftData.EMPTY, base.newModifiedColumnSet("Sentinel"))); + base.notifyListeners( + new TableUpdateImpl(i(), i(), i(10), RowSetShiftData.EMPTY, base.newModifiedColumnSet("Sentinel"))); }); - assertTableEquals(TableTools.newTable(intCol("Sentinel", 3, 2), intCol("B", 10, 11), intCol("X", 102, 101), intCol("Y", 1, 1), intCol("Z", 210, 212)), withUpdates); + assertTableEquals(TableTools.newTable(intCol("Sentinel", 3, 2), intCol("B", 10, 11), intCol("X", 102, 101), + intCol("Y", 1, 1), intCol("Z", 210, 212)), withUpdates); assertEquals(1, simpleListener.count); assertEquals(i(), simpleListener.update.added()); assertEquals(i(), simpleListener.update.removed()); assertEquals(i(10), simpleListener.update.modified()); - assertEquals(((QueryTable) withUpdates).newModifiedColumnSet("Sentinel", "X"), simpleListener.update.modifiedColumnSet()); + assertEquals(((QueryTable) withUpdates).newModifiedColumnSet("Sentinel", "X"), + simpleListener.update.modifiedColumnSet()); updateGraph.runWithinUnitTestCycle(() -> { addToTable(base, i(11), intCol("Sentinel", 4), intCol("B", 12)); - base.notifyListeners(new TableUpdateImpl(i(), i(), i(11), RowSetShiftData.EMPTY, base.newModifiedColumnSet("Sentinel", "B"))); + base.notifyListeners(new TableUpdateImpl(i(), i(), i(11), RowSetShiftData.EMPTY, + base.newModifiedColumnSet("Sentinel", "B"))); }); - assertTableEquals(TableTools.newTable(intCol("Sentinel", 3, 4), intCol("B", 10, 12), intCol("X", 102, 103), intCol("Y", 1, 1), intCol("Z", 210, 214)), withUpdates); + assertTableEquals(TableTools.newTable(intCol("Sentinel", 3, 4), intCol("B", 10, 12), intCol("X", 102, 103), + intCol("Y", 1, 1), intCol("Z", 210, 214)), withUpdates); assertEquals(2, simpleListener.count); assertEquals(i(), simpleListener.update.added()); assertEquals(i(), simpleListener.update.removed()); assertEquals(i(11), simpleListener.update.modified()); - assertEquals(((QueryTable) withUpdates).newModifiedColumnSet("Sentinel", "B", "X", "Z"), simpleListener.update.modifiedColumnSet()); + assertEquals(((QueryTable) withUpdates).newModifiedColumnSet("Sentinel", "B", "X", "Z"), + simpleListener.update.modifiedColumnSet()); QueryScope.addParam("a", null); QueryScope.addParam("b", null); } -} \ No newline at end of file +}