From 1fd2addc6e9d84faa292ddf7ea5b61f74545537f Mon Sep 17 00:00:00 2001 From: Zoltan Haindrich Date: Thu, 5 Dec 2024 10:03:22 +0000 Subject: [PATCH] cleanup --- .../org/apache/druid/sql/calcite/rule/logical/Unnest.java | 2 +- .../sql/calcite/rule/logical/UnnestInputCleanupRule.java | 7 ++----- .../apache/druid/sql/calcite/CalciteArraysQueryTest.java | 5 ----- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/rule/logical/Unnest.java b/sql/src/main/java/org/apache/druid/sql/calcite/rule/logical/Unnest.java index 21c3f952061..77b82e1c817 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/rule/logical/Unnest.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/rule/logical/Unnest.java @@ -50,7 +50,7 @@ public abstract class Unnest extends SingleRel @Override protected RelDataType deriveRowType() { - List fields =new ArrayList<>(); + List fields = new ArrayList<>(); fields.addAll(input.getRowType().getFieldList()); fields.add(unnestFieldType); return new RelRecordType(fields); diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/rule/logical/UnnestInputCleanupRule.java b/sql/src/main/java/org/apache/druid/sql/calcite/rule/logical/UnnestInputCleanupRule.java index e611f3a6e2b..a699c926e73 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/rule/logical/UnnestInputCleanupRule.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/rule/logical/UnnestInputCleanupRule.java @@ -85,12 +85,12 @@ public class UnnestInputCleanupRule extends RelOptRule implements SubstitutionRu RexNode newUnnestExpr = unnestInput.accept(new ExpressionPullerRexShuttle(newProjects, inputIndex)); - if(newUnnestExpr instanceof RexInputRef) { + if (newUnnestExpr instanceof RexInputRef) { // this won't make it simpler return; } - if(newProjects.get(inputIndex) == null ) { + if (newProjects.get(inputIndex) == null) { newProjects.set( inputIndex, rexBuilder.makeInputRef(oldProject.getInput(), 0) @@ -118,9 +118,6 @@ public class UnnestInputCleanupRule extends RelOptRule implements SubstitutionRu // not-anymore referenced input columns beneath oldProject List projectFields = new ArrayList<>(builder.fields()); int hideCount = newProjects.size() - oldProject.getProjects().size(); - if(hideCount>0) { -// return; - } for (int i = 0; i < hideCount; i++) { projectFields.remove(unnest.getRowType().getFieldCount() - 2); } diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteArraysQueryTest.java b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteArraysQueryTest.java index 395492c9e21..9c8f5beac5d 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteArraysQueryTest.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteArraysQueryTest.java @@ -5310,7 +5310,6 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest ); } -// @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.UNNEST_EXTRA_SCAN, separateDefaultModeTest = true) @Test public void testUnnestWithFilters() { @@ -5460,7 +5459,6 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest ); } -// @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.UNNEST_EXTRA_SCAN, separateDefaultModeTest = true) @Test public void testUnnestWithFiltersInsideAndOutside() { @@ -5498,7 +5496,6 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest ); } -// @DecoupledTestConfig(ignoreExpectedQueriesReason = IgnoreQueriesReason.UNNEST_EXTRA_SCANQUERY) @Test public void testUnnestWithFiltersInsideAndOutside1() { @@ -5539,7 +5536,6 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest ); } -// @DecoupledTestConfig(ignoreExpectedQueriesReason = IgnoreQueriesReason.UNNEST_EXTRA_SCANQUERY) @Test public void testUnnestWithFiltersOutside() { @@ -6769,7 +6765,6 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest ); } -// @DecoupledTestConfig(ignoreExpectedQueriesReason = IgnoreQueriesReason.UNNEST_EXTRA_SCANQUERY) @Test public void testUnnestWithTimeFilterAndAnotherFilter() {