You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2018/11/06 09:52:47 UTC

[GitHub] vvysotskyi commented on a change in pull request #1524: DRILL-6830: Remove Hook.REL_BUILDER_SIMPLIFY handler after use

vvysotskyi commented on a change in pull request #1524: DRILL-6830: Remove Hook.REL_BUILDER_SIMPLIFY handler after use
URL: https://github.com/apache/drill/pull/1524#discussion_r231056622
 
 

 ##########
 File path: exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/SqlConverter.java
 ##########
 @@ -377,11 +377,15 @@ public RelRoot toRel(final SqlNode validatedNode) {
      * during creating new projects since it may cause changing data mode
      * which causes to assertion errors during type validation
      */
-    Hook.REL_BUILDER_SIMPLIFY.add(Hook.propertyJ(false));
+    Hook.Closeable closeable = Hook.REL_BUILDER_SIMPLIFY.add(Hook.propertyJ(false));
 
-    //To avoid unexpected column errors set a value of top to false
-    final RelRoot rel = sqlToRelConverter.convertQuery(validatedNode, false, false);
-    return rel.withRel(sqlToRelConverter.flattenTypes(rel.rel, true));
+    try {
+      //To avoid unexpected column errors set a value of top to false
+      final RelRoot rel = sqlToRelConverter.convertQuery(validatedNode, false, false);
+      return rel.withRel(sqlToRelConverter.flattenTypes(rel.rel, true));
+    } finally {
+      closeable.close();
 
 Review comment:
   Could you please replace it with `try with resources` block?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services