apache/dolphinscheduler · error · TaskException

read hive sql content error

Error message

read hive sql content error

What it means

In buildCommand (TYPE_FILE mode), reading the hive SQL resource from storage threw — the referenced resource file could not be fetched via the storage operator (missing file, storage permission/path issue) or opening its stream failed. The offending input is the first resource in the task's resource list; the message is the sentinel 'read hive sql content error' with the storage exception as cause.

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-hivecli/src/main/java/org/apache/dolphinscheduler/plugin/task/hivecli/HiveCliTask.java:143

        String sqlContent = "";
        String resourceFileName = "";
        // TODO: make sure type is not unknown
        if (HiveCliConstants.TYPE_FILE.equals(type)) {
            final List<ResourceInfo> resourceInfos = hiveCliParameters.getResourceList();
            if (resourceInfos.size() > 1) {
                log.warn("more than 1 files detected, use the first one by default");
            }

            try {
                resourceFileName = resourceInfos.get(0).getResourceName();
                ResourceContext resourceContext = taskRequest.getResourceContext();
                sqlContent = FileUtils.readFileToString(
                        new File(resourceContext.getResourceItem(resourceFileName).getResourceAbsolutePathInLocal()),
                        StandardCharsets.UTF_8);
            } catch (IOException e) {
                log.error("read hive sql content from file {} error ", resourceFileName, e);
                throw new TaskException("read hive sql content error", e);
            }
        } else {
            sqlContent = hiveCliParameters.getHiveSqlScript();
        }

        final Map<String, Property> paramsMap = taskRequest.getPrepareParamsMap();
        sqlContent = ParameterUtils.convertParameterPlaceholders(sqlContent, ParameterUtils.convert(paramsMap));
        log.info("HiveCli sql content: {}", sqlContent);
        String sqlFilePath = generateSqlScriptFile(sqlContent);

        args.add(HiveCliConstants.HIVE_CLI_EXECUTE_FILE);
        args.add(new File(sqlFilePath).getName());
        final String hiveCliOptions = hiveCliParameters.getHiveCliOptions();
        if (StringUtils.isNotEmpty(hiveCliOptions)) {
            args.add(hiveCliOptions);
        }

        String command = String.join(" ", args);

View on GitHub (pinned to 02eac45a1b)

Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-hivecli/src/main/java/org/apache/dolphinscheduler/plugin/task/hivecli/HiveCliTask.java:143 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/a8c61dc1f79a273e. Report an issue: GitHub.