You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by gs...@apache.org on 2023/02/28 14:30:36 UTC

[hive] branch master updated: HIVE-27091: Add double quotes for tables in PartitionProjectionEvaluator (#4071) (Zhihua Deng, reviewed by Sai Hemanth Gantasala)

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

gsaihemanth pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new ff17b8e7a3f HIVE-27091: Add double quotes for tables in PartitionProjectionEvaluator (#4071) (Zhihua Deng, reviewed by Sai Hemanth Gantasala)
ff17b8e7a3f is described below

commit ff17b8e7a3fa83ad1d71042f3daffd8b555eafa3
Author: dengzh <de...@gmail.com>
AuthorDate: Tue Feb 28 22:30:24 2023 +0800

    HIVE-27091: Add double quotes for tables in PartitionProjectionEvaluator (#4071) (Zhihua Deng, reviewed by Sai Hemanth Gantasala)
---
 .../metastore/PartitionProjectionEvaluator.java    | 32 ++++++++++++----------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PartitionProjectionEvaluator.java b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PartitionProjectionEvaluator.java
index c3a00933228..b1a1328c18b 100644
--- a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PartitionProjectionEvaluator.java
+++ b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PartitionProjectionEvaluator.java
@@ -175,14 +175,14 @@ public class PartitionProjectionEvaluator {
     this.excludeParamKeyPattern = excludeParamKeyPattern;
     this.PARTITIONS =
         fieldNameToTableName.containsKey("PARTITIONS_TABLE_NAME") ? fieldNameToTableName
-            .get("PARTITIONS_TABLE_NAME") : "PARTITIONS";
+            .get("PARTITIONS_TABLE_NAME") : "\"PARTITIONS\"";
     this.SDS = fieldNameToTableName.containsKey("SDS_TABLE_NAME") ? fieldNameToTableName
-        .get("SDS_TABLE_NAME") : "SDS";
+        .get("SDS_TABLE_NAME") : "\"SDS\"";
     this.SERDES = fieldNameToTableName.containsKey("SERDES_TABLE_NAME") ? fieldNameToTableName
-        .get("SERDES_TABLE_NAME") : "SERDES";
+        .get("SERDES_TABLE_NAME") : "\"SERDES\"";
     this.PARTITION_PARAMS =
         fieldNameToTableName.containsKey("PARTITION_PARAMS") ? fieldNameToTableName
-            .get("PARTITION_PARAMS") : "PARTITION_PARAMS";
+            .get("PARTITION_PARAMS") : "\"PARTITION_PARAMS\"";
 
     roots = parse(projectionFields);
 
@@ -410,6 +410,8 @@ public class PartitionProjectionEvaluator {
                   // string to a boolean value
                   if (node.fieldName.equals("sd.compressed") || node.fieldName.equals("sd.storedAsSubDirectories")) {
                     value = MetastoreDirectSqlUtils.extractSqlBoolean(value);
+                  } else if (node.fieldName.equals("lastAccessTime") || node.fieldName.equals("createTime")) {
+                    value = MetastoreDirectSqlUtils.extractSqlInt(value);
                   }
                   MetaStoreServerUtils.setNestedProperty(partition, node.fieldName, value, true);
                 }
@@ -684,7 +686,7 @@ public class PartitionProjectionEvaluator {
         throws MetaException {
       final String tableName =
           fieldNameToTableName.containsKey("PARTITION_KEY_VALS") ? fieldNameToTableName
-              .get("PARTITION_KEY_VALS") : "PARTITION_KEY_VALS";
+              .get("PARTITION_KEY_VALS") : "\"PARTITION_KEY_VALS\"";
       MetastoreDirectSqlUtils
           .setPartitionValues(tableName, pm, Joiner.on(',').join(partitions.keySet()), partitions);
     }
@@ -719,7 +721,7 @@ public class PartitionProjectionEvaluator {
       // children field names would be sd.cols.name, sd.cols.type or sd.cols.description
       List<String> childFields = getChildrenFieldNames(root);
       final String tableName = fieldNameToTableName.containsKey("COLUMNS_V2") ? fieldNameToTableName
-          .get("COLUMNS_V2") : "COLUMNS_V2";
+          .get("COLUMNS_V2") : "\"COLUMNS_V2\"";
       MetastoreDirectSqlUtils
           .setSDCols(tableName, childFields, pm, cds, Joiner.on(',').join(cds.keySet()));
     }
@@ -736,7 +738,7 @@ public class PartitionProjectionEvaluator {
         throws MetaException {
       final String tableName =
           fieldNameToTableName.containsKey("BUCKETING_COLS") ? fieldNameToTableName
-              .get("BUCKETING_COLS") : "BUCKETING_COLS";
+              .get("BUCKETING_COLS") : "\"BUCKETING_COLS\"";
       MetastoreDirectSqlUtils
           .setSDBucketCols(tableName, pm, sds, Joiner.on(',').join(sds.keySet()));
     }
@@ -753,7 +755,7 @@ public class PartitionProjectionEvaluator {
         throws MetaException {
       List<String> childFieldNames = getChildrenFieldNames(root);
       final String tableName = fieldNameToTableName.containsKey("SORT_COLS") ? fieldNameToTableName
-          .get("SORT_COLS") : "SORT_COLS";
+          .get("SORT_COLS") : "\"SORT_COLS\"";
       MetastoreDirectSqlUtils
           .setSDSortCols(tableName, childFieldNames, pm, sds, Joiner.on(',').join(sds.keySet()));
     }
@@ -780,7 +782,7 @@ public class PartitionProjectionEvaluator {
         TreeMap<Long, SerDeInfo> serdes, TreeMap<Long, List<FieldSchema>> cds)
         throws MetaException {
       final String tableName = fieldNameToTableName.containsKey("SD_PARAMS") ? fieldNameToTableName
-          .get("SD_PARAMS") : "SD_PARAMS";
+          .get("SD_PARAMS") : "\"SD_PARAMS\"";
       MetastoreDirectSqlUtils.setSDParameters(tableName, convertMapNullsToEmptyStrings, pm, sds,
           Joiner.on(',').join(sds.keySet()));
     }
@@ -797,7 +799,7 @@ public class PartitionProjectionEvaluator {
         throws MetaException {
       final String tableName =
           fieldNameToTableName.containsKey("SERDE_PARAMS") ? fieldNameToTableName
-              .get("SERDE_PARAMS") : "SERDE_PARAMS";
+              .get("SERDE_PARAMS") : "\"SERDE_PARAMS\"";
       MetastoreDirectSqlUtils.setSerdeParams(tableName, convertMapNullsToEmptyStrings, pm, serdes,
           Joiner.on(',').join(serdes.keySet()));
     }
@@ -814,7 +816,7 @@ public class PartitionProjectionEvaluator {
         throws MetaException {
       final String tableName =
           fieldNameToTableName.containsKey("SKEWED_COL_NAMES") ? fieldNameToTableName
-              .get("SKEWED_COL_NAMES") : "SKEWED_COL_NAMES";
+              .get("SKEWED_COL_NAMES") : "\"SKEWED_COL_NAMES\"";
       MetastoreDirectSqlUtils
           .setSkewedColNames(tableName, pm, sds, Joiner.on(',').join(sds.keySet()));
     }
@@ -831,10 +833,10 @@ public class PartitionProjectionEvaluator {
         throws MetaException {
       final String skewedStringListVals =
           fieldNameToTableName.containsKey("SKEWED_STRING_LIST_VALUES") ? fieldNameToTableName
-              .get("SKEWED_STRING_LIST_VALUES") : "SKEWED_STRING_LIST_VALUES";
+              .get("SKEWED_STRING_LIST_VALUES") : "\"SKEWED_STRING_LIST_VALUES\"";
       final String skewedVals =
           fieldNameToTableName.containsKey("SKEWED_VALUES") ? fieldNameToTableName
-              .get("SKEWED_VALUES") : "SKEWED_VALUES";
+              .get("SKEWED_VALUES") : "\"SKEWED_VALUES\"";
       MetastoreDirectSqlUtils.setSkewedColValues(skewedStringListVals, skewedVals, pm, sds,
           Joiner.on(',').join(sds.keySet()));
     }
@@ -851,10 +853,10 @@ public class PartitionProjectionEvaluator {
         throws MetaException {
       final String skewedStringListVals =
           fieldNameToTableName.containsKey("SKEWED_STRING_LIST_VALUES") ? fieldNameToTableName
-              .get("SKEWED_STRING_LIST_VALUES") : "SKEWED_STRING_LIST_VALUES";
+              .get("SKEWED_STRING_LIST_VALUES") : "\"SKEWED_STRING_LIST_VALUES\"";
       final String skewedColValLocMap =
           fieldNameToTableName.containsKey("SKEWED_COL_VALUE_LOC_MAP") ? fieldNameToTableName
-              .get("SKEWED_COL_VALUE_LOC_MAP") : "SKEWED_COL_VALUE_LOC_MAP";
+              .get("SKEWED_COL_VALUE_LOC_MAP") : "\"SKEWED_COL_VALUE_LOC_MAP\"";
       MetastoreDirectSqlUtils
           .setSkewedColLocationMaps(skewedColValLocMap, skewedStringListVals, pm, sds,
               Joiner.on(',').join(sds.keySet()));