szlta commented on code in PR #3479:
URL: https://github.com/apache/hive/pull/3479#discussion_r931934208


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergSerDe.java:
##########
@@ -105,8 +106,18 @@ public void initialize(@Nullable Configuration 
configuration, Properties serDePr
     } else {
       try {
         Table table = IcebergTableUtil.getTable(configuration, 
serDeProperties);
-        // always prefer the original table schema if there is one
-        this.tableSchema = table.schema();
+        if (serDeProperties.containsKey(serdeConstants.AS_OF_VERSION)) {
+          this.tableSchema = SnapshotUtil.schemaFor(table,
+              
Long.valueOf(serDeProperties.getProperty(serdeConstants.AS_OF_VERSION)));
+          serDeProperties.remove(serdeConstants.AS_OF_VERSION);

Review Comment:
   Let's explain in a comment why we need to remove this from serdeProperties, 
and perhaps also why we need serdeProperties to carry this information nstead 
of job configuration in the first place.



##########
ql/src/java/org/apache/hadoop/hive/ql/metadata/Table.java:
##########
@@ -347,7 +351,15 @@ final public Deserializer getDeserializer(boolean 
skipConfError) {
 
   final public Deserializer getDeserializerFromMetaStore(boolean 
skipConfError) {
     try {
-      return HiveMetaStoreUtils.getDeserializer(SessionState.getSessionConf(), 
tTable, metaTable, skipConfError);
+      String asOfTimestamp = null;
+      if (getAsOfTimestamp() != null) {
+        ZoneId zoneId = SessionState.get() == null ? new 
HiveConf().getLocalTimeZone() :
+            SessionState.get().getConf().getLocalTimeZone();
+        TimestampTZ time = 
TimestampTZUtil.parse(PlanUtils.stripQuotes(getAsOfTimestamp()), zoneId);
+        asOfTimestamp = Long.toString(time.toEpochMilli());

Review Comment:
   This calculation of Iceberg As Of information from string to long is found 
in multiple places, I think we should refactor this logic into a utility class 
of ql perhaps.



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