okumin commented on code in PR #5036:
URL: https://github.com/apache/hive/pull/5036#discussion_r1484338606


##########
beeline/src/java/org/apache/hive/beeline/schematool/HiveSchemaTool.java:
##########
@@ -112,6 +121,40 @@ protected void execSql(String sqlScriptFile) throws 
IOException {
     }
   }
 
+  void replaceLocationForProtoLogTables(String sqlScriptFile) throws 
IOException {
+    TezConfiguration tezConf = new TezConfiguration(true);
+    String hiveProtoBaseDir = HiveConf.getVar(conf, 
HiveConf.ConfVars.HIVE_PROTO_EVENTS_BASE_PATH);
+    String tezProtoBaseDir = 
tezConf.get(TezConfiguration.TEZ_HISTORY_LOGGING_PROTO_BASE_DIR);
+
+    if (isEmpty(hiveProtoBaseDir)) {
+      throw new IOException("Hive conf variable hive.hook.proto.base-directory 
is not set for creating protologging tables");
+    }
+    if (isEmpty(tezProtoBaseDir)) {
+      throw new IOException("Tez conf variable 
tez.history.logging.proto-base-dir is not set for creating protologging 
tables");
+    }
+
+    Map<String, String> replacements = new HashMap<>();
+    replacements.put("_REPLACE_WITH_QUERY_DATA_LOCATION_", "hdfs:///" + 
hiveProtoBaseDir);

Review Comment:
   I would say we may avoid hardcoding the prefix, i.e., following the logic 
using HIVE_PROTO_EVENTS_BASE_PATH.
   
https://github.com/apache/hive/blob/rel/release-4.0.0-beta-1/ql/src/java/org/apache/tez/dag/history/logging/proto/DatePartitionedLogger.java#L67
   
   As far as I tested, `hive.hook.proto.base-directory` can accept 
`hdfs://path/to/proto` or `s3a://bucket/path/to/proto`.



##########
beeline/src/java/org/apache/hive/beeline/schematool/HiveSchemaTool.java:
##########
@@ -112,6 +121,40 @@ protected void execSql(String sqlScriptFile) throws 
IOException {
     }
   }
 
+  void replaceLocationForProtoLogTables(String sqlScriptFile) throws 
IOException {
+    TezConfiguration tezConf = new TezConfiguration(true);
+    String hiveProtoBaseDir = HiveConf.getVar(conf, 
HiveConf.ConfVars.HIVE_PROTO_EVENTS_BASE_PATH);
+    String tezProtoBaseDir = 
tezConf.get(TezConfiguration.TEZ_HISTORY_LOGGING_PROTO_BASE_DIR);
+
+    if (isEmpty(hiveProtoBaseDir)) {
+      throw new IOException("Hive conf variable hive.hook.proto.base-directory 
is not set for creating protologging tables");
+    }
+    if (isEmpty(tezProtoBaseDir)) {
+      throw new IOException("Tez conf variable 
tez.history.logging.proto-base-dir is not set for creating protologging 
tables");
+    }
+
+    Map<String, String> replacements = new HashMap<>();
+    replacements.put("_REPLACE_WITH_QUERY_DATA_LOCATION_", "hdfs:///" + 
hiveProtoBaseDir);
+    replacements.put("_REPLACE_WITH_APP_DATA_LOCATION_", "hdfs:///" + 
tezProtoBaseDir + "/app_data");
+    replacements.put("_REPLACE_WITH_DAG_DATA_LOCATION_", "hdfs:///" + 
tezProtoBaseDir + "/dag_data");
+    replacements.put("_REPLACE_WITH_DAG_META_LOCATION_", "hdfs:///" + 
tezProtoBaseDir + "/dag_meta");

Review Comment:
   I presume we may also avoid hardcoding it for 
TEZ_HISTORY_LOGGING_PROTO_BASE_DIR.



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