shameersss1 commented on a change in pull request #1105:
URL: https://github.com/apache/hive/pull/1105#discussion_r452133627



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/ddl/misc/msck/MsckAnalyzer.java
##########
@@ -63,13 +67,24 @@ public void analyzeInternal(ASTNode root) throws 
SemanticException {
     }
 
     Table table = getTable(tableName);
-    List<Map<String, String>> specs = getPartitionSpecs(table, root);
+    Map<Integer, List<ExprNodeGenericFuncDesc>> partitionSpecs = 
getFullPartitionSpecs(root, table, conf, false);
+    byte[] filterExp = null;
+    if (partitionSpecs != null & !partitionSpecs.isEmpty()) {
+      // explicitly set expression proxy class to 
PartitionExpressionForMetastore since we intend to use the
+      // filterPartitionsByExpr of PartitionExpressionForMetastore for 
partition pruning down the line.
+      conf.set(MetastoreConf.ConfVars.EXPRESSION_PROXY_CLASS.getVarname(),
+          PartitionExpressionForMetastore.class.getCanonicalName());
+      // fetch the first value of partitionSpecs map since it will always have 
one key, value pair
+      filterExp = SerializationUtilities.serializeExpressionToKryo(

Review comment:
       PartitionPruner and msc.listPartitionsByExpr() expects serialized byte 
array, Hence it is required to flatten out.

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java
##########
@@ -837,6 +844,118 @@ public static void checkColumnName(String columnName) 
throws SemanticException {
     return colList;
   }
 
+  /**
+   * Get the partition specs from the tree. This stores the full specification
+   * with the comparator operator into the output list.
+   *
+   * @return Map of partitions by prefix length. Most of the time prefix 
length will
+   *         be the same for all partition specs, so we can just OR the 
expressions.
+   */
+  public static Map<Integer, List<ExprNodeGenericFuncDesc>> 
getFullPartitionSpecs(

Review comment:
       Fixed!




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to