diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/QueryTable.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/QueryTable.java index 750f15b5175..5f8f22944fe 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/QueryTable.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/QueryTable.java @@ -1177,8 +1177,8 @@ private Table selectOrUpdate(Flavor flavor, final SelectColumn... selectColumns) checkInitiateOperation(); final SelectAndViewAnalyzer.Mode mode; if (isRefreshing()) { - if (!isFlat() && (flavor == Flavor.Update && USE_REDIRECTED_COLUMNS_FOR_UPDATE) - || (flavor == Flavor.Select && USE_REDIRECTED_COLUMNS_FOR_SELECT)) { + if (!isFlat() && ((flavor == Flavor.Update && USE_REDIRECTED_COLUMNS_FOR_UPDATE) + || (flavor == Flavor.Select && USE_REDIRECTED_COLUMNS_FOR_SELECT))) { mode = SelectAndViewAnalyzer.Mode.SELECT_REDIRECTED_REFRESHING; } else { mode = SelectAndViewAnalyzer.Mode.SELECT_REFRESHING; 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 c7ed6f3e485..ef08082ae6d 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 @@ -12,6 +12,8 @@ import io.deephaven.engine.rowset.RowSetFactory; import io.deephaven.engine.table.ShiftObliviousListener; import io.deephaven.engine.table.Table; +import io.deephaven.engine.table.impl.sources.RedirectedColumnSource; +import io.deephaven.engine.table.impl.sources.SparseArrayColumnSource; import io.deephaven.engine.testutil.*; import io.deephaven.engine.testutil.generator.IntGenerator; import io.deephaven.engine.testutil.generator.SetGenerator; @@ -516,6 +518,31 @@ private void doTestSparseRedirectedUpdate() { } } + @Test + public void testSelectRedirectionFlat() { + final boolean startSelect = QueryTable.USE_REDIRECTED_COLUMNS_FOR_SELECT; + final boolean startUpdate = QueryTable.USE_REDIRECTED_COLUMNS_FOR_UPDATE; + + try { + QueryTable.USE_REDIRECTED_COLUMNS_FOR_SELECT = true; + QueryTable.USE_REDIRECTED_COLUMNS_FOR_UPDATE = true; + + final QueryTable test1 = TstUtils.testRefreshingTable(i(2, 4, 6, 8).toTracking(), + intCol("Sentinel", 1, 2, 3, 4)); + + final Table select1 = test1.select(); + final Table selectFlat = test1.flatten().select(); + + final ColumnSource select1Column = select1.getColumnSource("Sentinel"); + final ColumnSource selectFlatColumn = selectFlat.getColumnSource("Sentinel"); + Assert.assertTrue(select1Column instanceof RedirectedColumnSource); + Assert.assertTrue(selectFlatColumn instanceof SparseArrayColumnSource); + } finally { + QueryTable.USE_REDIRECTED_COLUMNS_FOR_SELECT = startSelect; + QueryTable.USE_REDIRECTED_COLUMNS_FOR_UPDATE = startUpdate; + } + } + @Test public void testUpdateIncremental() { for (int seed = 0; seed < 3; ++seed) {