This is an automated email from the ASF dual-hosted git repository.

agozhiy pushed a commit to branch MERGE-200221-00
in repository https://gitbox.apache.org/repos/asf/drill.git

commit 75171761f4d5620375ef0328e7c070a3199dd262
Author: Igor Guzenko <[email protected]>
AuthorDate: Thu Feb 20 11:20:42 2020 +0200

    DRILL-7594: Remove unused DrillStoreRel
    
    closes #1990
---
 .../exec/planner/common/DrillStoreRelBase.java     | 43 ----------------
 .../drill/exec/planner/logical/DrillStoreRel.java  | 46 -----------------
 .../planner/sql/handlers/AnalyzeTableHandler.java  | 57 +++++++++-------------
 .../planner/sql/handlers/DefaultSqlHandler.java    | 25 ++++------
 4 files changed, 33 insertions(+), 138 deletions(-)

diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillStoreRelBase.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillStoreRelBase.java
deleted file mode 100644
index 2781564..0000000
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillStoreRelBase.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.
- */
-package org.apache.drill.exec.planner.common;
-
-import java.util.List;
-
-import org.apache.calcite.prepare.Prepare.CatalogReader;
-
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.TableModify;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptTable;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rex.RexNode;
-
-/**
- * Base class for logical and physical Store implemented in Drill
- */
-public abstract class DrillStoreRelBase extends TableModify implements 
DrillRelNode {
-  static final org.slf4j.Logger logger = 
org.slf4j.LoggerFactory.getLogger(DrillStoreRelBase.class);
-
-  protected DrillStoreRelBase(RelOptCluster cluster, RelTraitSet traits, 
RelOptTable table, CatalogReader catalogReader, RelNode child,
-                              Operation operation, List<String> 
updateColumnList, List<RexNode> sourceExpressionList, boolean flattened) {
-    super(cluster, traits, table, catalogReader, child, operation, 
updateColumnList, sourceExpressionList, flattened);
-
-  }
-
-}
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillStoreRel.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillStoreRel.java
deleted file mode 100644
index 9872f95..0000000
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillStoreRel.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-package org.apache.drill.exec.planner.logical;
-
-import java.util.List;
-
-import org.apache.calcite.prepare.Prepare.CatalogReader;
-
-import org.apache.calcite.rex.RexNode;
-import org.apache.drill.common.logical.data.LogicalOperator;
-import org.apache.drill.exec.planner.common.DrillStoreRelBase;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptTable;
-import org.apache.calcite.plan.RelTraitSet;
-
-public class DrillStoreRel extends DrillStoreRelBase implements DrillRel{
-  static final org.slf4j.Logger logger = 
org.slf4j.LoggerFactory.getLogger(DrillStoreRel.class);
-
-  protected DrillStoreRel(RelOptCluster cluster, RelTraitSet traits, 
RelOptTable table, CatalogReader catalogReader, RelNode child,
-                          Operation operation, List<String> updateColumnList, 
List<RexNode> sourceExpressionList, boolean flattened) {
-    super(cluster, traits, table, catalogReader, child, operation, 
updateColumnList, sourceExpressionList, flattened);
-
-  }
-
-  @Override
-  public LogicalOperator implement(DrillImplementor implementor) {
-    return null;
-  }
-
-}
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/AnalyzeTableHandler.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/AnalyzeTableHandler.java
index 232e81a..b7a5add 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/AnalyzeTableHandler.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/AnalyzeTableHandler.java
@@ -39,7 +39,6 @@ import org.apache.drill.exec.planner.logical.DrillAnalyzeRel;
 import org.apache.drill.exec.planner.logical.DrillRel;
 import org.apache.drill.exec.planner.logical.DrillScanRel;
 import org.apache.drill.exec.planner.logical.DrillScreenRel;
-import org.apache.drill.exec.planner.logical.DrillStoreRel;
 import org.apache.drill.exec.planner.logical.DrillTable;
 import org.apache.drill.exec.planner.logical.DrillWriterRel;
 import org.apache.drill.exec.planner.physical.Prel;
@@ -100,40 +99,36 @@ public class AnalyzeTableHandler extends DefaultSqlHandler 
{
           .message("No table with given name [%s] exists in schema [%s]", 
tableName,
               drillSchema.getFullSchemaName())
           .build(logger);
+    } else if (!(table instanceof DrillTable)) {
+      return DrillStatsTable.notSupported(context, tableName);
     }
 
-    if(! (table instanceof DrillTable)) {
+    DrillTable drillTable = (DrillTable) table;
+    final Object selection = drillTable.getSelection();
+    if (!(selection instanceof FormatSelection)) {
+      return DrillStatsTable.notSupported(context, tableName);
+    }
+    // Do not support non-parquet tables
+    FormatSelection formatSelection = (FormatSelection) selection;
+    FormatPluginConfig formatConfig = formatSelection.getFormat();
+    if (!((formatConfig instanceof ParquetFormatConfig)
+          || ((formatConfig instanceof NamedFormatPluginConfig)
+               && ((NamedFormatPluginConfig) 
formatConfig).name.equals("parquet")))) {
       return DrillStatsTable.notSupported(context, tableName);
     }
 
-    if (table instanceof DrillTable) {
-      DrillTable drillTable = (DrillTable) table;
-      final Object selection = drillTable.getSelection();
-      if (!(selection instanceof FormatSelection)) {
-        return DrillStatsTable.notSupported(context, tableName);
-      }
-      // Do not support non-parquet tables
-      FormatSelection formatSelection = (FormatSelection) selection;
-      FormatPluginConfig formatConfig = formatSelection.getFormat();
-      if (!((formatConfig instanceof ParquetFormatConfig)
-            || ((formatConfig instanceof NamedFormatPluginConfig)
-                 && ((NamedFormatPluginConfig) 
formatConfig).name.equals("parquet")))) {
-        return DrillStatsTable.notSupported(context, tableName);
-      }
-
-      FileSystemPlugin plugin = (FileSystemPlugin) drillTable.getPlugin();
-      DrillFileSystem fs = new DrillFileSystem(plugin.getFormatPlugin(
-          formatSelection.getFormat()).getFsConf());
+    FileSystemPlugin plugin = (FileSystemPlugin) drillTable.getPlugin();
+    DrillFileSystem fs = new DrillFileSystem(plugin.getFormatPlugin(
+        formatSelection.getFormat()).getFsConf());
 
-      Path selectionRoot = formatSelection.getSelection().getSelectionRoot();
-      if (!selectionRoot.toUri().getPath().endsWith(tableName) || 
!fs.getFileStatus(selectionRoot).isDirectory()) {
-        return DrillStatsTable.notSupported(context, tableName);
-      }
-      // Do not recompute statistics, if stale
-      Path statsFilePath = new Path(selectionRoot, 
DotDrillType.STATS.getEnding());
-      if (fs.exists(statsFilePath) && !isStatsStale(fs, statsFilePath)) {
-       return DrillStatsTable.notRequired(context, tableName);
-      }
+    Path selectionRoot = formatSelection.getSelection().getSelectionRoot();
+    if (!selectionRoot.toUri().getPath().endsWith(tableName) || 
!fs.getFileStatus(selectionRoot).isDirectory()) {
+      return DrillStatsTable.notSupported(context, tableName);
+    }
+    // Do not recompute statistics, if stale
+    Path statsFilePath = new Path(selectionRoot, 
DotDrillType.STATS.getEnding());
+    if (fs.exists(statsFilePath) && !isStatsStale(fs, statsFilePath)) {
+     return DrillStatsTable.notRequired(context, tableName);
     }
     // Convert the query to Drill Logical plan and insert a writer operator on 
top.
     DrillRel drel = convertToDrel(relScan, drillSchema, tableName, 
sqlAnalyzeTable.getSamplePercent());
@@ -201,10 +196,6 @@ public class AnalyzeTableHandler extends DefaultSqlHandler 
{
       double samplePercent) throws SqlUnsupportedException {
     DrillRel convertedRelNode = convertToRawDrel(relNode);
 
-    if (convertedRelNode instanceof DrillStoreRel) {
-      throw new UnsupportedOperationException();
-    }
-
     final RelNode analyzeRel = new DrillAnalyzeRel(
         convertedRelNode.getCluster(), convertedRelNode.getTraitSet(), 
convertedRelNode, samplePercent);
 
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
index 4cc7a4f..a59d8a4 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
@@ -77,7 +77,6 @@ import org.apache.drill.exec.planner.logical.DrillProjectRel;
 import org.apache.drill.exec.planner.logical.DrillRel;
 import org.apache.drill.exec.planner.logical.DrillRelFactories;
 import org.apache.drill.exec.planner.logical.DrillScreenRel;
-import org.apache.drill.exec.planner.logical.DrillStoreRel;
 import org.apache.drill.exec.planner.logical.PreProcessLogicalRel;
 import org.apache.drill.exec.planner.physical.DrillDistributionTrait;
 import org.apache.drill.exec.planner.physical.PhysicalPlanCreator;
@@ -275,23 +274,17 @@ public class DefaultSqlHandler extends AbstractSqlHandler 
{
       // Convert SUM to $SUM0
       final RelNode convertedRelNodeWithSum0 = 
transform(PlannerType.HEP_BOTTOM_UP, PlannerPhase.SUM_CONVERSION, 
convertedRelNode);
 
-      final DrillRel drillRel = (DrillRel) convertedRelNodeWithSum0;
-
-      if (drillRel instanceof DrillStoreRel) {
-        throw new UnsupportedOperationException();
-      } else {
-
-        // If the query contains a limit 0 clause, disable distributed mode 
since it is overkill for determining schema.
-        if (FindLimit0Visitor.containsLimit0(convertedRelNodeWithSum0) &&
-            
FindHardDistributionScans.canForceSingleMode(convertedRelNodeWithSum0)) {
-          context.getPlannerSettings().forceSingleMode();
-          if (context.getOptions().getOption(ExecConstants.LATE_LIMIT0_OPT)) {
-            return FindLimit0Visitor.addLimitOnTopOfLeafNodes(drillRel);
-          }
+      DrillRel drillRel = (DrillRel) convertedRelNodeWithSum0;
+      // If the query contains a limit 0 clause, disable distributed mode 
since it is overkill for determining schema.
+      if (FindLimit0Visitor.containsLimit0(convertedRelNodeWithSum0) &&
+          
FindHardDistributionScans.canForceSingleMode(convertedRelNodeWithSum0)) {
+        context.getPlannerSettings().forceSingleMode();
+        if (context.getOptions().getOption(ExecConstants.LATE_LIMIT0_OPT)) {
+          drillRel = FindLimit0Visitor.addLimitOnTopOfLeafNodes(drillRel);
         }
-
-        return drillRel;
       }
+
+      return drillRel;
     } catch (RelOptPlanner.CannotPlanException ex) {
       logger.error(ex.getMessage());
 

Reply via email to