You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "Radeity (via GitHub)" <gi...@apache.org> on 2023/06/30 11:46:46 UTC

[GitHub] [dolphinscheduler] Radeity commented on a diff in pull request #14423: [Improvement-14371][Hivecli] Add support for hivevar setting in hivecli task

Radeity commented on code in PR #14423:
URL: https://github.com/apache/dolphinscheduler/pull/14423#discussion_r1247773938


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-hivecli/src/main/java/org/apache/dolphinscheduler/plugin/task/hivecli/HiveCliTask.java:
##########
@@ -108,29 +121,40 @@ protected String buildCommand() {
 
         final String type = hiveCliParameters.getHiveCliTaskExecutionType();
 
+        String sqlContent = "";
+        String resourceFileName = "";
         // TODO: make sure type is not unknown
         if (HiveCliConstants.TYPE_FILE.equals(type)) {
-            args.add(HiveCliConstants.HIVE_CLI_EXECUTE_FILE);
             final List<ResourceInfo> resourceInfos = hiveCliParameters.getResourceList();
             if (resourceInfos.size() > 1) {
                 log.warn("more than 1 files detected, use the first one by default");
             }
 
-            args.add(StringUtils.stripStart(resourceInfos.get(0).getResourceName(), "/"));
+            try {
+                resourceFileName = resourceInfos.get(0).getResourceName();
+                sqlContent = FileUtils.readFileToString(
+                        new File(String.format("%s/%s", taskExecutionContext.getExecutePath(), resourceFileName)),
+                        StandardCharsets.UTF_8);
+            } catch (IOException e) {
+                log.error("read hive sql content from file {} error ", resourceFileName, e);

Review Comment:
   Maybe we should throw exception here.



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org