@@ -74,10 +74,10 @@ public static Get copyAndSetTargetToIfNot(
7474 Get get , Optional <String > namespace , Optional <String > tableName ) {
7575 GetBuilder .BuildableGetOrGetWithIndexFromExisting builder = Get .newBuilder (get ); // copy
7676 if (!get .forNamespace ().isPresent () && namespace .isPresent ()) {
77- builder .namespace (namespace .get ());
77+ builder = builder .namespace (namespace .get ());
7878 }
7979 if (!get .forTable ().isPresent () && tableName .isPresent ()) {
80- builder .table (tableName .get ());
80+ builder = builder .table (tableName .get ());
8181 }
8282 Get ret = builder .build ();
8383 checkIfTargetIsSet (ret );
@@ -88,10 +88,10 @@ public static Scan copyAndSetTargetToIfNot(
8888 Scan scan , Optional <String > namespace , Optional <String > tableName ) {
8989 ScanBuilder .BuildableScanOrScanAllFromExisting builder = Scan .newBuilder (scan ); // copy
9090 if (!scan .forNamespace ().isPresent () && namespace .isPresent ()) {
91- builder .namespace (namespace .get ());
91+ builder = builder .namespace (namespace .get ());
9292 }
9393 if (!scan .forTable ().isPresent () && tableName .isPresent ()) {
94- builder .table (tableName .get ());
94+ builder = builder .table (tableName .get ());
9595 }
9696 Scan ret = builder .build ();
9797 checkIfTargetIsSet (ret );
@@ -118,10 +118,10 @@ public static Put copyAndSetTargetToIfNot(
118118 Put put , Optional <String > namespace , Optional <String > tableName ) {
119119 PutBuilder .BuildableFromExisting builder = Put .newBuilder (put ); // copy
120120 if (!put .forNamespace ().isPresent () && namespace .isPresent ()) {
121- builder .namespace (namespace .get ());
121+ builder = builder .namespace (namespace .get ());
122122 }
123123 if (!put .forTable ().isPresent () && tableName .isPresent ()) {
124- builder .table (tableName .get ());
124+ builder = builder .table (tableName .get ());
125125 }
126126 Put ret = builder .build ();
127127 checkIfTargetIsSet (ret );
@@ -132,10 +132,10 @@ public static Delete copyAndSetTargetToIfNot(
132132 Delete delete , Optional <String > namespace , Optional <String > tableName ) {
133133 DeleteBuilder .BuildableFromExisting builder = Delete .newBuilder (delete ); // copy
134134 if (!delete .forNamespace ().isPresent () && namespace .isPresent ()) {
135- builder .namespace (namespace .get ());
135+ builder = builder .namespace (namespace .get ());
136136 }
137137 if (!delete .forTable ().isPresent () && tableName .isPresent ()) {
138- builder .table (tableName .get ());
138+ builder = builder .table (tableName .get ());
139139 }
140140 Delete ret = builder .build ();
141141 checkIfTargetIsSet (ret );
@@ -146,10 +146,10 @@ public static Insert copyAndSetTargetToIfNot(
146146 Insert insert , Optional <String > namespace , Optional <String > tableName ) {
147147 InsertBuilder .BuildableFromExisting builder = Insert .newBuilder (insert ); // copy
148148 if (!insert .forNamespace ().isPresent () && namespace .isPresent ()) {
149- builder .namespace (namespace .get ());
149+ builder = builder .namespace (namespace .get ());
150150 }
151151 if (!insert .forTable ().isPresent () && tableName .isPresent ()) {
152- builder .table (tableName .get ());
152+ builder = builder .table (tableName .get ());
153153 }
154154 Insert ret = builder .build ();
155155 checkIfTargetIsSet (ret );
@@ -160,10 +160,10 @@ public static Upsert copyAndSetTargetToIfNot(
160160 Upsert upsert , Optional <String > namespace , Optional <String > tableName ) {
161161 UpsertBuilder .BuildableFromExisting builder = Upsert .newBuilder (upsert ); // copy
162162 if (!upsert .forNamespace ().isPresent () && namespace .isPresent ()) {
163- builder .namespace (namespace .get ());
163+ builder = builder .namespace (namespace .get ());
164164 }
165165 if (!upsert .forTable ().isPresent () && tableName .isPresent ()) {
166- builder .table (tableName .get ());
166+ builder = builder .table (tableName .get ());
167167 }
168168 Upsert ret = builder .build ();
169169 checkIfTargetIsSet (ret );
@@ -174,10 +174,10 @@ public static Update copyAndSetTargetToIfNot(
174174 Update update , Optional <String > namespace , Optional <String > tableName ) {
175175 UpdateBuilder .BuildableFromExisting builder = Update .newBuilder (update ); // copy
176176 if (!update .forNamespace ().isPresent () && namespace .isPresent ()) {
177- builder .namespace (namespace .get ());
177+ builder = builder .namespace (namespace .get ());
178178 }
179179 if (!update .forTable ().isPresent () && tableName .isPresent ()) {
180- builder .table (tableName .get ());
180+ builder = builder .table (tableName .get ());
181181 }
182182 Update ret = builder .build ();
183183 checkIfTargetIsSet (ret );
@@ -316,9 +316,11 @@ public static Get copyAndPrepareForDynamicFiltering(Get get) {
316316 List <String > projections = get .getProjections ();
317317 if (!projections .isEmpty ()) {
318318 // Add columns in conditions into projections to use them in dynamic filtering
319- ScalarDbUtils .getColumnNamesUsedIn (get .getConjunctions ()).stream ()
320- .filter (columnName -> !projections .contains (columnName ))
321- .forEach (builder ::projection );
319+ for (String columnName : getColumnNamesUsedIn (get .getConjunctions ())) {
320+ if (!projections .contains (columnName )) {
321+ builder = builder .projection (columnName );
322+ }
323+ }
322324 }
323325 return builder .build ();
324326 }
@@ -329,14 +331,16 @@ public static Scan copyAndPrepareForDynamicFiltering(Scan scan) {
329331 List <String > projections = scan .getProjections ();
330332 if (!projections .isEmpty ()) {
331333 // Add columns in conditions into projections to use them in dynamic filtering
332- ScalarDbUtils .getColumnNamesUsedIn (scan .getConjunctions ()).stream ()
333- .filter (columnName -> !projections .contains (columnName ))
334- .forEach (builder ::projection );
334+ for (String columnName : getColumnNamesUsedIn (scan .getConjunctions ())) {
335+ if (!projections .contains (columnName )) {
336+ builder = builder .projection (columnName );
337+ }
338+ }
335339 }
336340 return builder .build ();
337341 }
338342
339- public static Set <String > getColumnNamesUsedIn (Set <Conjunction > conjunctions ) {
343+ private static Set <String > getColumnNamesUsedIn (Set <Conjunction > conjunctions ) {
340344 Set <String > columns = new HashSet <>();
341345 conjunctions .forEach (
342346 conjunction ->
0 commit comments