From 4a304f9d149333d8a86eaf7ae5fd2f084bfda3cd Mon Sep 17 00:00:00 2001
From: Larry Booker <lbooker42@gmail.com>
Date: Thu, 28 Dec 2023 11:57:45 -0800
Subject: [PATCH] Adjusted test parameters and corrected some initialization in
 UpdateBy

---
 .../updateby/BucketedPartitionedUpdateByManager.java | 12 ++++++------
 .../table/impl/updateby/ZeroKeyUpdateByManager.java  | 12 ++++++------
 .../engine/table/impl/QueryTableAggregationTest.java |  3 +--
 .../engine/table/impl/updateby/BaseUpdateByTest.java |  3 +--
 4 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/updateby/BucketedPartitionedUpdateByManager.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/updateby/BucketedPartitionedUpdateByManager.java
index 84b18ab74b8..9b766dd9d12 100644
--- a/engine/table/src/main/java/io/deephaven/engine/table/impl/updateby/BucketedPartitionedUpdateByManager.java
+++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/updateby/BucketedPartitionedUpdateByManager.java
@@ -102,12 +102,6 @@ class BucketedPartitionedUpdateByManager extends UpdateBy {
         }, source::isRefreshing, DynamicNode::isRefreshing);
 
         if (source.isRefreshing()) {
-            // this is a refreshing source, we will need a listener
-            sourceListener = newUpdateByListener();
-            source.addUpdateListener(sourceListener);
-            // result will depend on listener
-            result.addParentReference(sourceListener);
-
             // create input and output modified column sets
             forAllOperators(op -> {
                 op.createInputModifiedColumnSet(source);
@@ -121,6 +115,12 @@ class BucketedPartitionedUpdateByManager extends UpdateBy {
             transformFailureListener = new TransformFailureListener(transformedTable);
             transformedTable.addUpdateListener(transformFailureListener);
             result.addParentReference(transformFailureListener);
+
+            // this is a refreshing source, we will need a listener
+            sourceListener = newUpdateByListener();
+            source.addUpdateListener(sourceListener);
+            // result will depend on listener
+            result.addParentReference(sourceListener);
         } else {
             sourceListener = null;
             mcsTransformer = null;
diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/updateby/ZeroKeyUpdateByManager.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/updateby/ZeroKeyUpdateByManager.java
index a09d433d0ab..f359af199a2 100644
--- a/engine/table/src/main/java/io/deephaven/engine/table/impl/updateby/ZeroKeyUpdateByManager.java
+++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/updateby/ZeroKeyUpdateByManager.java
@@ -58,12 +58,6 @@ public class ZeroKeyUpdateByManager extends UpdateBy {
         if (source.isRefreshing()) {
             result = new QueryTable(source.getRowSet(), resultSources);
 
-            // this is a refreshing source, we will need a listener
-            sourceListener = newUpdateByListener();
-            source.addUpdateListener(sourceListener);
-            // result will depend on listener
-            result.addParentReference(sourceListener);
-
             // create input and output modified column sets
             forAllOperators(op -> {
                 op.createInputModifiedColumnSet(source);
@@ -80,6 +74,12 @@ public class ZeroKeyUpdateByManager extends UpdateBy {
 
             // result will depend on zeroKeyUpdateBy
             result.addParentReference(zeroKeyUpdateBy.result);
+
+            // this is a refreshing source, we will need a listener
+            sourceListener = newUpdateByListener();
+            source.addUpdateListener(sourceListener);
+            // result will depend on listener
+            result.addParentReference(sourceListener);
         } else {
             zeroKeyUpdateBy = new UpdateByBucketHelper(bucketDescription, source, windows, resultSources,
                     timestampColumnName, control, (oe, se) -> {
diff --git a/engine/table/src/test/java/io/deephaven/engine/table/impl/QueryTableAggregationTest.java b/engine/table/src/test/java/io/deephaven/engine/table/impl/QueryTableAggregationTest.java
index d62c00397e9..ba050092fb9 100644
--- a/engine/table/src/test/java/io/deephaven/engine/table/impl/QueryTableAggregationTest.java
+++ b/engine/table/src/test/java/io/deephaven/engine/table/impl/QueryTableAggregationTest.java
@@ -2791,8 +2791,7 @@ public void testTDigestIncremental() {
         final QueryTable queryTable = getTable(size, random,
                 columnInfos = initColumnInfos(new String[] {"Sym", "doubleCol", "longCol"},
                         new SetGenerator<>("a", "b", "c", "d"),
-                        // TODO (deephaven-core#4743) verify this change in range
-                        new DoubleGenerator(0, 10000, 0.05, 0.05),
+                        new DoubleGenerator(10.1, 20.1, 0.05, 0.05),
                         new LongGenerator(0, 1_000_000_000L)));
 
         final Collection<? extends Aggregation> aggregations = List.of(
diff --git a/engine/table/src/test/java/io/deephaven/engine/table/impl/updateby/BaseUpdateByTest.java b/engine/table/src/test/java/io/deephaven/engine/table/impl/updateby/BaseUpdateByTest.java
index fcb3daec101..fcaaa038cf5 100644
--- a/engine/table/src/test/java/io/deephaven/engine/table/impl/updateby/BaseUpdateByTest.java
+++ b/engine/table/src/test/java/io/deephaven/engine/table/impl/updateby/BaseUpdateByTest.java
@@ -68,8 +68,7 @@ static CreateResult createTestTable(int tableSize,
                 new ShortGenerator((short) -6000, (short) 65535, .1),
                 new IntGenerator(10, 100, .1),
                 new LongGenerator(10, 100, .1),
-                // TODO (deephaven-core#4743) verify this change in range
-                new FloatGenerator(0, 100, .1),
+                new FloatGenerator(10.1F, 20.1F, .1),
                 new DoubleGenerator(10.1, 20.1, .1),
                 new BooleanGenerator(.5, .1),
                 new BigIntegerGenerator(new BigInteger("-10"), new BigInteger("10"), .1),