Closed ddwolf715 closed 10 months ago
自己顶一下帖子
验证是正常执行的
验证是正常执行的
- 确认任务提交的时候 是否将参数替换规则带上 在taier的数据库查询 select info -> '$.taskParamsToReplace' from schedule_task_shade_info where task_id = (select task_id from schedule_task_shade where name = 'testParamcyc');
- 任务执行的时候在控制台上查看任务真实SQL 是否语法正确
回应
1.用您提供的语句查询结果如下: "[{\"gmtCreate\":1699600519000,\"gmtModified\":1699600519000,\"id\":230,\"isDeleted\":0,\"paramCommand\":\"yyyyMMddHHmmss\",\"paramName\":\"bdp.system.cyctime\",\"taskId\":649,\"type\":0},{\"gmtCreate\":1699600519000,\"gmtModified\":1699600519000,\"id\":231,\"isDeleted\":0,\"paramCommand\":\"${bdp.system.currenttime}\",\"paramName\":\"bdp.system.runtime\",\"taskId\":649,\"type\":0}]" 2.任务在手工执行时,无论是加了单引号还是没有加单引号,都可以正常执行的,没有报出SQL语法错误。 调度按周期运行时,有两种结果: 不加单引号的:报语法错误,见上面的 错误-1 截图 加单引号的:语法没报错,但结果是把参数当字符串写到数据库里了,见上面的 结果-2 截图
另外:补充一个问题: SQL中使用系统参数或自定义参数时,正确的写法是 加单引号,还是不加单引号,以下哪个是正确写法??
正常的使用是加'${bdp.system.cyctime}' 控制台上查看任务真实SQL 是否已经替换过了呢
正常的使用是加'${bdp.system.cyctime}' 控制台上查看任务真实SQL 是否已经替换过了呢
手动运行时显示已经替换了,但是根据调度运行保存到数据库的时间见上面 结果-2图片 控制台见下图
控制台是在这里查看 确认替换后的语法是否正确
控制台是在这里查看 确认替换后的语法是否正确
同样的写法,为什么我这边就没替换过来,如下图
更新到最新版本后,发现没有此问题了,正在做进一步的细致测试。 之前用的1.4版本,发生此贴的问题。
Search before asking
[X] I had searched in the issues and found no similar question.
[X] I had searched my question on the internet but i didn't get any help.
[X] I had read the documentation: Taier doc but it didn't help me.
Description
任务参数的使用,遇到了问题,周期性运行都有问题,见周期实例的截图,我创建的是每10分钟运行一次,每一次都是报出同样的错误信息。
周期实例
用计划时间 ${bdp.system.cyctime} 为例说明,我在SQL语句中使用了这个系统变量,但分别在手工运行和调度运行时有差异:
SQL-1 insert into dmp_dataquality_test_data_y select reflect("java.util.UUID","randomUUID") id, -- 检查结果数据的主键 from_unixtime(unix_timestamp()+28800,'yyyy-MM-dd HH:mm:ss') start_flag, '${bdp.system.cyctime}' dataquality_exec_cyc_time, -- 计划开始时间 '${bdp.system.runtime}' dataquality_exec_start_time, -- 实际开始时间 'end' end_flag from dmp_dataquality_test_child;
结果-1
结果-2
2.不给参数 ${bdp.system.cyctime} 加单引号,见下方SQL-2 手工运行时也是正确的,结果-3 但如果调度运行,就报错了,错误日志见下方错误-1
SQL-2 insert into dmp_dataquality_test_data select reflect("java.util.UUID","randomUUID") id, -- 检查结果数据的主键 'start' start_flag, ${bdp.system.cyctime} dataquality_exec_cyc_time, -- 计划开始时间 ${bdp.system.runtime} dataquality_exec_start_time, -- 实际开始时间 'end' end_flag from dmp_dataquality_test_child;
结果-3
错误-1
Code of Conduct