[ 
https://issues.apache.org/jira/browse/DRILL-8303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17604850#comment-17604850
 ] 

ASF GitHub Bot commented on DRILL-8303:
---------------------------------------

vvysotskyi commented on code in PR #2646:
URL: https://github.com/apache/drill/pull/2646#discussion_r971063658


##########
exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillSqlWorker.java:
##########
@@ -219,11 +220,14 @@ private static PhysicalPlan getQueryPlan(QueryContext 
context, String sql, Point
           handler = new SetOptionHandler(context);

Review Comment:
   Thanks, fixed it.



##########
exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/InsertHandler.java:
##########
@@ -0,0 +1,61 @@
+/*
+ * 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.sql.handlers;
+
+import org.apache.calcite.sql.SqlNode;
+import org.apache.calcite.tools.RelConversionException;
+import org.apache.calcite.tools.ValidationException;
+import org.apache.drill.common.exceptions.DrillRuntimeException;
+import org.apache.drill.common.exceptions.UserException;
+import org.apache.drill.exec.planner.sql.SchemaUtilites;
+import org.apache.drill.exec.store.StoragePluginRegistry;
+import org.apache.drill.exec.util.Pointer;
+import org.apache.drill.exec.work.foreman.ForemanSetupException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Constructs plan to be executed for collecting metadata and storing it to 
the Metastore.

Review Comment:
   Oh, thanks, fixed.



##########
exec/java-exec/src/main/java/org/apache/drill/exec/planner/index/generators/NonCoveringIndexPlanGenerator.java:
##########
@@ -188,7 +188,7 @@ public RelNode convertChild(final RelNode topRel, final 
RelNode input) throws In
     if (indexDesc.getCollation() != null &&
          !settings.isIndexForceSortNonCovering()) {
       collation = IndexPlanUtils.buildCollationNonCoveringIndexScan(indexDesc, 
indexScanRowType, dbscanRowType, indexContext);
-      if (restrictedScanTraitSet.contains(RelCollationTraitDef.INSTANCE)) { // 
replace existing trait
+      if (restrictedScanTraitSet.getTrait(RelCollationTraitDef.INSTANCE) != 
null) { // replace existing trait

Review Comment:
   The existing code wouldn't work as expected, trait set doesn't contain 
RelCollationTraitDef instances.



##########
contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/DrillJdbcConvention.java:
##########
@@ -98,4 +98,31 @@ public Set<RelOptRule> getRules() {
   public JdbcStoragePlugin getPlugin() {
     return plugin;
   }
+
+  private static List<RelOptRule> rules(
+    RelTrait inputTrait, JdbcConvention out) {
+    ImmutableList.Builder<RelOptRule> b = ImmutableList.builder();
+    foreachRule(out, r ->
+      b.add(r.config
+        .as(ConverterRule.Config.class)
+        .withConversion(r.getOperand().getMatchedClass(), inputTrait, out, 
r.config.description())
+        .withRelBuilderFactory(DrillRelFactories.LOGICAL_BUILDER)
+        .toRule()));
+    return b.build();
+  }
+
+  private static void foreachRule(JdbcConvention out,

Review Comment:
   It is related not only to INSERT but to general JDBC functionality. With 
this change, rules will match not only to the `NONE` convention but also to the 
`DRILL_LOGICAL` one, so as a result, Drill will be able to push down more 
operators for complex queries, where possible.





> Add support for inserts into JDBC storage
> -----------------------------------------
>
>                 Key: DRILL-8303
>                 URL: https://issues.apache.org/jira/browse/DRILL-8303
>             Project: Apache Drill
>          Issue Type: Sub-task
>            Reporter: Vova Vysotskyi
>            Assignee: Vova Vysotskyi
>            Priority: Major
>
> Allow inserting into JDBC tables and pushing down complete insert statement 
> where possible.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to