calcite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jh...@apache.org
Subject [1/4] calcite git commit: Add file headers; fix rat, assembly and checkstyle warnings
Date Fri, 24 Mar 2017 03:13:33 GMT
Repository: calcite
Updated Branches:
  refs/heads/master 9c8b59797 -> 0f9225108


Add file headers; fix rat, assembly and checkstyle warnings

Rename a few private Druid rule classes to be consistent with naming
convention, and fix javadoc.


Project: http://git-wip-us.apache.org/repos/asf/calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite/commit/a89c62cd
Tree: http://git-wip-us.apache.org/repos/asf/calcite/tree/a89c62cd
Diff: http://git-wip-us.apache.org/repos/asf/calcite/diff/a89c62cd

Branch: refs/heads/master
Commit: a89c62cd6d6cc181c90881afa0bf099746739a91
Parents: 9c8b597
Author: Julian Hyde <jhyde@apache.org>
Authored: Wed Mar 15 11:36:20 2017 -0700
Committer: Julian Hyde <jhyde@apache.org>
Committed: Mon Mar 20 18:25:55 2017 -0700

----------------------------------------------------------------------
 .../calcite/adapter/druid/DruidRules.java       | 132 +++++++++++--------
 pom.xml                                         |   3 +
 site/_docs/avatica_json_reference.md            |  18 +++
 site/_docs/avatica_overview.md                  |  19 +++
 site/_docs/avatica_protobuf_reference.md        |  19 +++
 site/_docs/avatica_roadmap.md                   |  19 +++
 src/main/config/assemblies/source-assembly.xml  |   6 +-
 7 files changed, 160 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/a89c62cd/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java
----------------------------------------------------------------------
diff --git a/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java b/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java
index b22809c..2054c11 100644
--- a/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java
+++ b/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java
@@ -75,35 +75,37 @@ public class DruidRules {
   public static final DruidFilterRule FILTER = new DruidFilterRule();
   public static final DruidProjectRule PROJECT = new DruidProjectRule();
   public static final DruidAggregateRule AGGREGATE = new DruidAggregateRule();
-  public static final DruidProjectAggregateRule PROJECT_AGGREGATE = new DruidProjectAggregateRule();
+  public static final DruidAggregateProjectRule AGGREGATE_PROJECT =
+      new DruidAggregateProjectRule();
   public static final DruidSortRule SORT = new DruidSortRule();
-  public static final DruidProjectSortRule PROJECT_SORT = new DruidProjectSortRule();
-  public static final DruidSortProjectRule SORT_PROJECT = new DruidSortProjectRule();
-
-  public static final DruidProjectFilterTransposeRule PROJECT_FILTER_TRANSPOSE_RULE =
+  public static final DruidSortProjectTransposeRule SORT_PROJECT_TRANSPOSE =
+      new DruidSortProjectTransposeRule();
+  public static final DruidProjectSortTransposeRule PROJECT_SORT_TRANSPOSE =
+      new DruidProjectSortTransposeRule();
+  public static final DruidProjectFilterTransposeRule PROJECT_FILTER_TRANSPOSE =
       new DruidProjectFilterTransposeRule();
-
-  public static final DruidFilterProjectTransposeRule FILTER_PROJECT_TRANSPOSE_RULE =
+  public static final DruidFilterProjectTransposeRule FILTER_PROJECT_TRANSPOSE =
       new DruidFilterProjectTransposeRule();
-
-  public static final DruidAggregateFilterTransposeRule AGGREGATE_FILTER_TRANSPOSE_RULE =
+  public static final DruidAggregateFilterTransposeRule AGGREGATE_FILTER_TRANSPOSE =
       new DruidAggregateFilterTransposeRule();
-
-  public static final DruidFilterAggregateTransposeRule FILTER_AGGREGATE_TRANSPOSE_RULE =
+  public static final DruidFilterAggregateTransposeRule FILTER_AGGREGATE_TRANSPOSE =
       new DruidFilterAggregateTransposeRule();
 
   public static final List<RelOptRule> RULES =
       ImmutableList.of(FILTER,
-          PROJECT_FILTER_TRANSPOSE_RULE,
+          PROJECT_FILTER_TRANSPOSE,
           // Disabled, per
           //   [CALCITE-1706] DruidAggregateFilterTransposeRule
           //   causes very fine-grained aggregations to be pushed to Druid
-          // AGGREGATE_FILTER_TRANSPOSE_RULE,
-          PROJECT_AGGREGATE,
-          PROJECT, AGGREGATE,
-          FILTER_AGGREGATE_TRANSPOSE_RULE,
-          FILTER_PROJECT_TRANSPOSE_RULE,
-          PROJECT_SORT, SORT, SORT_PROJECT);
+          // AGGREGATE_FILTER_TRANSPOSE,
+          AGGREGATE_PROJECT,
+          PROJECT,
+          AGGREGATE,
+          FILTER_AGGREGATE_TRANSPOSE,
+          FILTER_PROJECT_TRANSPOSE,
+          PROJECT_SORT_TRANSPOSE,
+          SORT,
+          SORT_PROJECT_TRANSPOSE);
 
   /** Predicate that returns whether Druid can not handle an aggregate. */
   private static final Predicate<Aggregate> BAD_AGG =
@@ -201,10 +203,10 @@ public class DruidRules {
       call.transformTo(newDruidQuery);
     }
 
-    /* Splits the filter condition in two groups: those that filter on the timestamp column
-     * and those that filter on other fields */
+    /** Splits the filter condition in two groups: those that filter on the timestamp column
+     * and those that filter on other fields. */
     private static Pair<List<RexNode>, List<RexNode>> splitFilters(final
RexBuilder rexBuilder,
-            final DruidQuery input, RexNode cond, final int timestampFieldIdx) {
+        final DruidQuery input, RexNode cond, final int timestampFieldIdx) {
       final List<RexNode> timeRangeNodes = new ArrayList<>();
       final List<RexNode> otherNodes = new ArrayList<>();
       List<RexNode> conjs = RelOptUtil.conjunctions(cond);
@@ -370,9 +372,12 @@ public class DruidRules {
    * Rule to push an {@link org.apache.calcite.rel.core.Aggregate} and
    * {@link org.apache.calcite.rel.core.Project} into a {@link DruidQuery}.
    */
-  private static class DruidProjectAggregateRule extends RelOptRule {
-    private DruidProjectAggregateRule() {
-      super(operand(Aggregate.class, operand(Project.class, operand(DruidQuery.class, none()))));
+  private static class DruidAggregateProjectRule extends RelOptRule {
+    private DruidAggregateProjectRule() {
+      super(
+          operand(Aggregate.class,
+              operand(Project.class,
+                  operand(DruidQuery.class, none()))));
     }
 
     public void onMatch(RelOptRuleCall call) {
@@ -465,9 +470,12 @@ public class DruidRules {
    * {@link org.apache.calcite.rel.core.Project}. Useful to transform
    * to complex Druid queries.
    */
-  private static class DruidProjectSortRule extends SortProjectTransposeRule {
-    private DruidProjectSortRule() {
-      super(operand(Sort.class, operand(Project.class, operand(DruidQuery.class, none()))));
+  private static class DruidSortProjectTransposeRule
+      extends SortProjectTransposeRule {
+    private DruidSortProjectTransposeRule() {
+      super(
+          operand(Sort.class,
+              operand(Project.class, operand(DruidQuery.class, none()))));
     }
   }
 
@@ -476,14 +484,18 @@ public class DruidRules {
    * {@link org.apache.calcite.rel.core.Sort}. Useful if after pushing Sort,
    * we could not push it inside DruidQuery.
    */
-  private static class DruidSortProjectRule extends ProjectSortTransposeRule {
-    private DruidSortProjectRule() {
-      super(operand(Project.class, operand(Sort.class, operand(DruidQuery.class, none()))));
+  private static class DruidProjectSortTransposeRule
+      extends ProjectSortTransposeRule {
+    private DruidProjectSortTransposeRule() {
+      super(
+          operand(Project.class,
+              operand(Sort.class, operand(DruidQuery.class, none()))));
     }
   }
 
   /**
-   * Rule to push an {@link org.apache.calcite.rel.core.Aggregate} into a {@link DruidQuery}.
+   * Rule to push a {@link org.apache.calcite.rel.core.Sort}
+   * into a {@link DruidQuery}.
    */
   private static class DruidSortRule extends RelOptRule {
     private DruidSortRule() {
@@ -510,7 +522,7 @@ public class DruidRules {
       call.transformTo(DruidQuery.extendQuery(query, newSort));
     }
 
-    /* Check sort valid */
+    /** Checks whether sort is valid. */
     private static boolean validSortLimit(Sort sort, DruidQuery query) {
       if (sort.offset != null && RexLiteral.intValue(sort.offset) != 0) {
         // offset not supported by Druid
@@ -557,7 +569,7 @@ public class DruidRules {
     }
   }
 
-  /* Check if any of the references leads to the timestamp column */
+  /** Checks whether any of the references leads to the timestamp column. */
   private static boolean checkTimestampRefOnQuery(ImmutableBitSet set, RelNode top,
       DruidQuery query) {
     if (top instanceof Project) {
@@ -589,52 +601,66 @@ public class DruidRules {
   }
 
   /**
-   * Rule to push an {@link org.apache.calcite.rel.core.Project} past a
-   * {@link org.apache.calcite.rel.core.Filter} when filter is on top of {@link org.apache.calcite.adapter.druid.DruidQuery}
+   * Rule to push a {@link org.apache.calcite.rel.core.Project}
+   * past a {@link org.apache.calcite.rel.core.Filter}
+   * when {@code Filter} is on top of a {@link DruidQuery}.
    */
-  private static class DruidProjectFilterTransposeRule extends ProjectFilterTransposeRule
{
+  private static class DruidProjectFilterTransposeRule
+      extends ProjectFilterTransposeRule {
     private DruidProjectFilterTransposeRule() {
       super(
-          operand(Project.class, operand(Filter.class, any())), PushProjector.ExprCondition.FALSE,
+          operand(Project.class,
+              operand(Filter.class, any())),
+          PushProjector.ExprCondition.FALSE,
           RelFactories.LOGICAL_BUILDER);
     }
   }
 
   /**
-   * Rule to push an {@link org.apache.calcite.rel.core.Filter} past a
-   * {@link org.apache.calcite.rel.core.Project} when project is on top of {@link org.apache.calcite.adapter.druid.DruidQuery}
+   * Rule to push a {@link org.apache.calcite.rel.core.Filter}
+   * past a {@link org.apache.calcite.rel.core.Project}
+   * when {@code Project} is on top of a {@link DruidQuery}.
    */
-  private static class DruidFilterProjectTransposeRule extends FilterProjectTransposeRule
{
+  private static class DruidFilterProjectTransposeRule
+      extends FilterProjectTransposeRule {
     private DruidFilterProjectTransposeRule() {
       super(
-          operand(Filter.class, operand(Project.class, operand(DruidQuery.class, none()))),
true,
-          true, RelFactories.LOGICAL_BUILDER
-      );
+          operand(Filter.class,
+              operand(Project.class,
+                  operand(DruidQuery.class, none()))),
+          true, true, RelFactories.LOGICAL_BUILDER);
     }
   }
 
   /**
-   * Rule to push an {@link org.apache.calcite.rel.core.Filter} past a
-   * {@link org.apache.calcite.rel.core.Project} when project is on top of {@link org.apache.calcite.adapter.druid.DruidQuery}
+   * Rule to push an {@link org.apache.calcite.rel.core.Aggregate}
+   * past a {@link org.apache.calcite.rel.core.Filter}
+   * when {@code Filter} is on top of a {@link DruidQuery}.
    */
-  private static class DruidAggregateFilterTransposeRule extends AggregateFilterTransposeRule
{
+  private static class DruidAggregateFilterTransposeRule
+      extends AggregateFilterTransposeRule {
     private DruidAggregateFilterTransposeRule() {
       super(
-          operand(Aggregate.class, operand(Filter.class, operand(DruidQuery.class, none()))),
+          operand(Aggregate.class,
+              operand(Filter.class,
+                  operand(DruidQuery.class, none()))),
           RelFactories.LOGICAL_BUILDER);
     }
   }
 
   /**
-   * Rule to push an {@link org.apache.calcite.rel.core.Aggregate} past a
-   * {@link org.apache.calcite.rel.core.Filter} when filter is on top of {@link org.apache.calcite.adapter.druid.DruidQuery}
+   * Rule to push an {@link org.apache.calcite.rel.core.Filter}
+   * past an {@link org.apache.calcite.rel.core.Aggregate}
+   * when {@code Aggregate} is on top of a {@link DruidQuery}.
    */
-  private static class DruidFilterAggregateTransposeRule extends FilterAggregateTransposeRule
{
+  private static class DruidFilterAggregateTransposeRule
+      extends FilterAggregateTransposeRule {
     private DruidFilterAggregateTransposeRule() {
       super(
-          operand(Filter.class, operand(Aggregate.class, operand(DruidQuery.class, none()))),
-          RelFactories.LOGICAL_BUILDER
-      );
+          operand(Filter.class,
+              operand(Aggregate.class,
+                  operand(DruidQuery.class, none()))),
+          RelFactories.LOGICAL_BUILDER);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/calcite/blob/a89c62cd/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 51fbab5..827e335 100644
--- a/pom.xml
+++ b/pom.xml
@@ -513,8 +513,11 @@ limitations under the License.
                  license notices. -->
             <exclude>src/main/resources/META-INF/services/java.sql.Driver</exclude>
             <exclude>**/src/test/resources/**/*.csv</exclude>
+            <exclude>**/src/test/resources/**/*.txt</exclude>
             <exclude>**/src/test/resources/bug/archers.json</exclude>
             <exclude>**/src/test/resources/foodmart-schema.spec</exclude>
+            <exclude>**/data.txt</exclude>
+            <exclude>**/data2.txt</exclude>
 
             <!-- Exclude all of avatica, RAT is run in Avatica -->
             <exclude>avatica/**</exclude>

http://git-wip-us.apache.org/repos/asf/calcite/blob/a89c62cd/site/_docs/avatica_json_reference.md
----------------------------------------------------------------------
diff --git a/site/_docs/avatica_json_reference.md b/site/_docs/avatica_json_reference.md
index ead7c62..b4d1772 100644
--- a/site/_docs/avatica_json_reference.md
+++ b/site/_docs/avatica_json_reference.md
@@ -6,3 +6,21 @@ redirect_to: /avatica/docs/json_reference.html
 permalink: /docs/avatica_json_reference.html
 ---
 
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->

http://git-wip-us.apache.org/repos/asf/calcite/blob/a89c62cd/site/_docs/avatica_overview.md
----------------------------------------------------------------------
diff --git a/site/_docs/avatica_overview.md b/site/_docs/avatica_overview.md
index a8f4ea3..f07130f 100644
--- a/site/_docs/avatica_overview.md
+++ b/site/_docs/avatica_overview.md
@@ -5,3 +5,22 @@ sidebar_title: Overview
 permalink: /docs/avatica_overview.html
 redirect_to: /avatica/docs/index.html
 ---
+
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->

http://git-wip-us.apache.org/repos/asf/calcite/blob/a89c62cd/site/_docs/avatica_protobuf_reference.md
----------------------------------------------------------------------
diff --git a/site/_docs/avatica_protobuf_reference.md b/site/_docs/avatica_protobuf_reference.md
index 9335558..250b6cd 100644
--- a/site/_docs/avatica_protobuf_reference.md
+++ b/site/_docs/avatica_protobuf_reference.md
@@ -5,3 +5,22 @@ sidebar_title: Protobuf Reference
 redirect_to: /avatica/docs/protobuf_reference.html
 permalink: /docs/avatica_protobuf_reference.html
 ---
+
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->

http://git-wip-us.apache.org/repos/asf/calcite/blob/a89c62cd/site/_docs/avatica_roadmap.md
----------------------------------------------------------------------
diff --git a/site/_docs/avatica_roadmap.md b/site/_docs/avatica_roadmap.md
index d98ff02..54d3f18 100644
--- a/site/_docs/avatica_roadmap.md
+++ b/site/_docs/avatica_roadmap.md
@@ -5,3 +5,22 @@ sidebar_title: Roadmap
 permalink: /docs/avatica_roadmap.html
 redirect_to: /avatica/docs/roadmap.html
 ---
+
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->

http://git-wip-us.apache.org/repos/asf/calcite/blob/a89c62cd/src/main/config/assemblies/source-assembly.xml
----------------------------------------------------------------------
diff --git a/src/main/config/assemblies/source-assembly.xml b/src/main/config/assemblies/source-assembly.xml
index bb38693..d4148de 100644
--- a/src/main/config/assemblies/source-assembly.xml
+++ b/src/main/config/assemblies/source-assembly.xml
@@ -25,7 +25,7 @@ limitations under the License.
     <!-- main project directory structure -->
     <fileSet>
       <directory>.</directory>
-      <outputDirectory>/</outputDirectory>
+      <outputDirectory/>
       <useDefaultExcludes>true</useDefaultExcludes>
       <excludes>
         <!-- build output -->
@@ -93,14 +93,14 @@ limitations under the License.
     <fileSet>
       <directory>${project.build.directory}/maven-shared-archive-resources/META-INF
       </directory>
-      <outputDirectory>/</outputDirectory>
+      <outputDirectory/>
     </fileSet>
     <fileSet>
       <directory>${project.build.directory}</directory>
       <includes>
         <include>git.properties</include>
       </includes>
-      <outputDirectory>/</outputDirectory>
+      <outputDirectory/>
     </fileSet>
   </fileSets>
 </assembly>


Mime
View raw message