[NO ISSUE][OTH] Refactor function to validate partitioning expr

- user model changes: no
- storage format changes: no
- interface changes: no

Change-Id: I07630be15f25cd140437e870cdeb4a7523363457
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17954
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Peeyush Gupta <peeyush.gupta@couchbase.com>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
Tested-by: Peeyush Gupta <peeyush.gupta@couchbase.com>
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
index 77c1a9d..e253e07 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
@@ -107,6 +107,7 @@
      * @param keySourceIndicators the key sources (record vs. meta)
      * @param autogenerated       true if auto generated, false otherwise
      * @param sourceLoc
+     * @param partitioningExprTypes types of partitioning keys
      * @return a list of partitioning expressions types
      * @throws AlgebricksException if composite key is autogenerated.
      *                             if autogenerated and of a type that can't be autogenerated.
@@ -116,13 +117,6 @@
      */
     public static List<IAType> validatePartitioningExpressions(ARecordType recType, ARecordType metaRecType,
             List<List<String>> partitioningExprs, List<Integer> keySourceIndicators, boolean autogenerated,
-            SourceLocation sourceLoc) throws AlgebricksException {
-        return validatePartitioningExpressionsImpl(recType, metaRecType, partitioningExprs, keySourceIndicators,
-                autogenerated, true, sourceLoc, null);
-    }
-
-    public static List<IAType> validatePartitioningExpressions(ARecordType recType, ARecordType metaRecType,
-            List<List<String>> partitioningExprs, List<Integer> keySourceIndicators, boolean autogenerated,
             SourceLocation sourceLoc, List<TypeExpression> partitioningExprTypes) throws AlgebricksException {
         return validatePartitioningExpressionsImpl(recType, metaRecType, partitioningExprs, keySourceIndicators,
                 autogenerated, true, sourceLoc, partitioningExprTypes);
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
index c4ce19d..d52429f 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
@@ -954,9 +954,8 @@
                             ((InternalDetailsDecl) dd.getDatasetDetailsDecl()).getKeySourceIndicators();
                     boolean autogenerated = ((InternalDetailsDecl) dd.getDatasetDetailsDecl()).isAutogenerated();
                     ARecordType aRecordType = (ARecordType) itemType;
-                    List<IAType> partitioningTypes =
-                            ValidateUtil.validatePartitioningExpressions(aRecordType, metaRecType, partitioningExprs,
-                                    keySourceIndicators, autogenerated, sourceLoc, partitioningExprTypes);
+                    List<IAType> partitioningTypes = validatePartitioningExpressions(aRecordType, metaRecType,
+                            partitioningExprs, keySourceIndicators, autogenerated, sourceLoc, partitioningExprTypes);
 
                     List<String> filterField = ((InternalDetailsDecl) dd.getDatasetDetailsDecl()).getFilterField();
                     Integer filterSourceIndicator =
@@ -1900,6 +1899,13 @@
         ValidateUtil.validateIndexFieldType(indexType, fieldType, displayFieldName, sourceLoc);
     }
 
+    protected List<IAType> validatePartitioningExpressions(ARecordType recType, ARecordType metaRecType,
+            List<List<String>> partitioningExprs, List<Integer> keySourceIndicators, boolean autogenerated,
+            SourceLocation sourceLoc, List<TypeExpression> partitioningExprTypes) throws AlgebricksException {
+        return ValidateUtil.validatePartitioningExpressions(recType, metaRecType, partitioningExprs,
+                keySourceIndicators, autogenerated, sourceLoc, partitioningExprTypes);
+    }
+
     protected void handleCreateTypeStatement(MetadataProvider metadataProvider, Statement stmt) throws Exception {
         TypeDecl stmtCreateType = (TypeDecl) stmt;
         SourceLocation sourceLoc = stmtCreateType.getSourceLocation();