kgyrtkirk commented on a change in pull request #2556:
URL: https://github.com/apache/hive/pull/2556#discussion_r682520895



##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/StatObjectConverter.java
##########
@@ -525,6 +531,16 @@ public static MPartitionColumnStatistics 
convertToMPartitionColumnStatistics(
     return mColStats;
   }
 
+  private static byte[] getBitVector(byte[] bytes) {

Review comment:
       you could move this logic into `MTableColumnStatistics#getBitVector` ;
   

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
##########
@@ -9538,7 +9538,7 @@ private void writeMPartitionColumnStatistics(Table table, 
Partition partition,
     if (oldStats != null) {
       StatObjectConverter.setFieldsIntoOldStats(mStatsObj, oldStats);
     } else {
-      if (sqlGenerator.getDbProduct().isPOSTGRES() && mStatsObj.getBitVector() 
== null) {

Review comment:
       you could aslo move this into the `setBitVector` / defaults stuff into 
the `MTableColumnStatistics`

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/model/MPartitionColumnStatistics.java
##########
@@ -281,11 +281,20 @@ public void setDecimalHighValue(String decimalHighValue) {
   }
 
   public byte[] getBitVector() {
+    // workaround for DN bug in persisting nulls in pg bytea column
+    // instead set empty bit vector with header.
+    // https://issues.apache.org/jira/browse/HIVE-17836
+    if (bitVector != null && bitVector.length == 2 && bitVector[0] == 'H' && 
bitVector[1] == 'L') {
+      return null;
+    }
     return bitVector;
   }
 
   public void setBitVector(byte[] bitVector) {
-    this.bitVector = bitVector;
+    // workaround for DN bug in persisting nulls in pg bytea column

Review comment:
       is the DN serialization happens thru the getters or thru the fields? 
   if its reading the fields; what happens if we create an instance of this 
class and never call the `setBitVector(null)`? will that be okay?
   




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to