fjy closed pull request #6601: SQL: Support AVG on system tables.
URL: https://github.com/apache/incubator-druid/pull/6601
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/planner/Rules.java
b/sql/src/main/java/org/apache/druid/sql/calcite/planner/Rules.java
index 7fa66ef3b42..e5883fad244 100644
--- a/sql/src/main/java/org/apache/druid/sql/calcite/planner/Rules.java
+++ b/sql/src/main/java/org/apache/druid/sql/calcite/planner/Rules.java
@@ -34,6 +34,7 @@
import org.apache.calcite.rel.rules.AggregateJoinTransposeRule;
import org.apache.calcite.rel.rules.AggregateProjectMergeRule;
import org.apache.calcite.rel.rules.AggregateProjectPullUpConstantsRule;
+import org.apache.calcite.rel.rules.AggregateReduceFunctionsRule;
import org.apache.calcite.rel.rules.AggregateRemoveRule;
import org.apache.calcite.rel.rules.AggregateStarTableRule;
import org.apache.calcite.rel.rules.AggregateValuesRule;
@@ -209,6 +210,7 @@ private Rules()
return ImmutableList.<RelOptRule>builder()
.addAll(baseRuleSet(plannerContext, queryMaker))
.addAll(Bindables.RULES)
+ .add(AggregateReduceFunctionsRule.INSTANCE)
.build();
}
diff --git
a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
index 9261e71679c..89dd10c769f 100644
--- a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
+++ b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
@@ -610,15 +610,21 @@ public void testExplainInformationSchemaColumns() throws
Exception
}
@Test
- public void testMinOnInformationSchemaColumns() throws Exception
+ public void testAggregatorsOnInformationSchemaColumns() throws Exception
{
+ // Not including COUNT DISTINCT, since it isn't supported by
BindableAggregate, and so it can't work.
testQuery(
- "SELECT MIN(JDBC_TYPE)\n"
+ "SELECT\n"
+ + " COUNT(JDBC_TYPE),\n"
+ + " SUM(JDBC_TYPE),\n"
+ + " AVG(JDBC_TYPE),\n"
+ + " MIN(JDBC_TYPE),\n"
+ + " MAX(JDBC_TYPE)\n"
+ "FROM INFORMATION_SCHEMA.COLUMNS\n"
+ "WHERE TABLE_SCHEMA = 'druid' AND TABLE_NAME = 'foo'",
ImmutableList.of(),
ImmutableList.of(
- new Object[]{-5L}
+ new Object[]{8L, 1249L, 156L, -5L, 1111L}
)
);
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]