ayushtkn commented on code in PR #7003:
URL: https://github.com/apache/hive/pull/7003#discussion_r4779382185


##########
ql/src/java/org/apache/hadoop/hive/ql/metadata/VirtualColumn.java:
##########
@@ -60,8 +61,13 @@ public enum VirtualColumn {
   ROW_POSITION("ROW__POSITION", TypeInfoFactory.longTypeInfo),
   SNAPSHOT_ID("SNAPSHOT__ID", TypeInfoFactory.longTypeInfo),
   PARTITION_NAME("PARTITION__NAME", TypeInfoFactory.stringTypeInfo),
-  ROW_LINEAGE_ID("ROW__LINEAGE__ID", TypeInfoFactory.longTypeInfo),
-  LAST_UPDATED_SEQUENCE_NUMBER("LAST__UPDATED__SEQUENCE__NUMBER", 
TypeInfoFactory.longTypeInfo),
+  /**
+   * Iceberg v3 row lineage.{@code _row_id} and {@code 
_last_updated_sequence_number} is the
+   * metadata column name Iceberg and Spark expose to queries.

Review Comment:
   nit:
   are the metadata column names



##########
ql/src/java/org/apache/hadoop/hive/ql/parse/RowResolver.java:
##########
@@ -113,6 +116,26 @@ public void put(String tabAlias, String colAlias, 
ColumnInfo colInfo) {
     }
   }
 
+  /**
+   * Registers a virtual column and any query aliases that refer to the same 
value.
+   * An alias that is already a real column is left alone.
+   */
+  public void putVirtualColumn(String tabAlias, VirtualColumn virtualColumn) {
+    ColumnInfo columnInfo = new ColumnInfo(virtualColumn.getName(), 
virtualColumn.getTypeInfo(),
+        tabAlias, true, virtualColumn.getIsHidden());
+    put(tabAlias, virtualColumn.getName().toLowerCase(Locale.ROOT), 
columnInfo);
+    for (String alias : virtualColumn.getAliases()) {
+      String key = alias.toLowerCase(Locale.ROOT);
+      try {
+        if (get(tabAlias, key) == null) {
+          addMappingOnly(tabAlias, key, columnInfo);
+        }
+      } catch (SemanticException e) {
+        throw new IllegalStateException("Cannot register virtual column alias 
" + alias, e);
+      }

Review Comment:
   the caller method handles `SemanticException` we can throw it from here I 
think



##########
ql/src/java/org/apache/hadoop/hive/ql/parse/RowResolver.java:
##########
@@ -28,10 +28,13 @@
 import java.util.Map;
 import java.util.Set;
 
+import java.util.Locale;

Review Comment:
   nit, it should be with same block



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