kokila-19 commented on code in PR #6407:
URL: https://github.com/apache/hive/pull/6407#discussion_r3071914095
##########
ql/src/java/org/apache/hadoop/hive/ql/metadata/RowLineageUtils.java:
##########
@@ -81,17 +82,54 @@ public static boolean supportsRowLineage(Table table) {
return table.getStorageHandler().supportsRowLineage(table.getParameters());
}
+ /**
+ * Returns the row lineage virtual columns with the leading comma for string
concatenation.
+ * Example: {@code ", ROW__LINEAGE__ID, LAST__UPDATED__SEQUENCE__NUMBER"}.
+ */
+ public static String getRowLineageSelectColumns(boolean rowLineageEnabled) {
+ return rowLineageEnabled
+ ? ", " + VirtualColumn.ROW_LINEAGE_ID.getName() + ", " +
VirtualColumn.LAST_UPDATED_SEQUENCE_NUMBER.getName()
+ : "";
+ }
+
+ /**
+ * Enables or disables row lineage for the current query/session context.
+ */
+ public static void setRowLineage(Configuration conf, boolean enabled) {
+ SessionStateUtil.addResource(conf, SessionStateUtil.ROW_LINEAGE, enabled);
+ }
+
+ private static void setRowLineageConfFlag(Configuration conf, boolean
enabled) {
+ if (enabled) {
+ conf.setBoolean(SessionStateUtil.ROW_LINEAGE, true);
+ } else {
+ conf.unset(SessionStateUtil.ROW_LINEAGE);
+ }
+ }
+
+ /**
+ * Enable the row lineage session flag for the current statement execution.
+ * Returns {@code true} if the flag was enabled
+ */
+ public static void enableRowLineage(SessionState sessionState) {
+ setRowLineageConfFlag(sessionState.getConf(), true);
+ }
+
+ public static void disableRowLineage(SessionState sessionState) {
+ setRowLineageConfFlag(sessionState.getConf(), false);
+ }
+
Review Comment:
Done
--
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]