【问题标题】:The table input step does not execute when variable substitution is done for the query in Pentaho在 Pentaho 中对查询进行变量替换时不执行表输入步骤
【发布时间】:2017-08-18 10:28:16
【问题描述】:

下面是查询。

select * from tablex where c_trans_date>= (select CONVERT(DATETIME,concat(1,'-',(substring('${SHORT_FILENAME}',charindex('.','${SHORT_FILENAME}',1)-5,3)),'-',substring( '${SHORT_FILENAME}',charindex('.','${SHORT_FILENAME}',1)-2,2)),121)) 和 c_trans_date

错误提示

2017/08/18 10:25:54 - Spoon - Transformation opened.
2017/08/18 10:25:54 - Spoon - Launching transformation [STATEX_DATA_PULL]...
2017/08/18 10:25:54 - Spoon - Started the transformation execution.
2017/08/18 10:25:54 - STATEX_DATA_PULL - Dispatching started for transformation [STATEX_DATA_PULL]
2017/08/18 10:25:54 - Input table.0 - ERROR (version 6.1.0.1-196, build 1 from 2016-04-07 12.08.49 by buildguy) : Unexpected error
2017/08/18 10:25:54 - Input table.0 - ERROR (version 6.1.0.1-196, build 1 from 2016-04-07 12.08.49 by buildguy) : org.pentaho.di.core.exception.KettleDatabaseException: 
2017/08/18 10:25:54 - Input table.0 - Couldn't get row from result set
2017/08/18 10:25:54 - Input table.0 - Conversion failed when converting date and/or time from character string.
2017/08/18 10:25:54 - Input table.0 - 
2017/08/18 10:25:54 - Input table.0 -   at org.pentaho.di.core.database.Database.getRow(Database.java:2374)
2017/08/18 10:25:54 - Input table.0 -   at org.pentaho.di.core.database.Database.getRow(Database.java:2344)
2017/08/18 10:25:54 - Input table.0 -   at org.pentaho.di.core.database.Database.getRow(Database.java:2322)
2017/08/18 10:25:54 - Input table.0 -   at org.pentaho.di.trans.steps.tableinput.TableInput.doQuery(TableInput.java:247)
2017/08/18 10:25:54 - Input table.0 -   at org.pentaho.di.trans.steps.tableinput.TableInput.processRow(TableInput.java:138)
2017/08/18 10:25:54 - Input table.0 -   at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62)
2017/08/18 10:25:54 - Input table.0 -   at java.lang.Thread.run(Unknown Source)
2017/08/18 10:25:54 - Input table.0 - Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Conversion failed when converting date and/or time from character string.
2017/08/18 10:25:54 - Input table.0 -   at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
2017/08/18 10:25:54 - Input table.0 -   at com.microsoft.sqlserver.jdbc.SQLServerResultSet$FetchBuffer.nextRow(SQLServerResultSet.java:4853)
2017/08/18 10:25:54 - Input table.0 -   at com.microsoft.sqlserver.jdbc.SQLServerResultSet.fetchBufferNext(SQLServerResultSet.java:1781)
2017/08/18 10:25:54 - Input table.0 -   at com.microsoft.sqlserver.jdbc.SQLServerResultSet.next(SQLServerResultSet.java:1034)
2017/08/18 10:25:54 - Input table.0 -   at org.pentaho.di.core.database.Database.getRow(Database.java:2362)
2017/08/18 10:25:54 - Input table.0 -   ... 6 more
2017/08/18 10:25:54 - Input table.0 - Finished reading query, closing connection.
2017/08/18 10:25:54 - Input table.0 - Finished processing (I=0, O=0, R=0, W=0, U=0, E=1)
2017/08/18 10:25:54 - STATEX_DATA_PULL - Transformation detected one or more steps with errors.
2017/08/18 10:25:54 - STATEX_DATA_PULL - Transformation is killing the other steps!
2017/08/18 10:25:54 - STATEX_DATA_PULL - ERROR (version 6.1.0.1-196, build 1 from 2016-04-07 12.08.49 by buildguy) : Errors detected!
2017/08/18 10:25:54 - Spoon - The transformation has finished!!
2017/08/18 10:25:54 - STATEX_DATA_PULL - ERROR (version 6.1.0.1-196, build 1 from 2016-04-07 12.08.49 by buildguy) : Errors detected!
2017/08/18 10:25:54 - STATEX_DATA_PULL - ERROR (version 6.1.0.1-196, build 1 from 2016-04-07 12.08.49 by buildguy) : Errors detected!

顺便说一句,在 SQLServer 中执行查询时它工作正常。

【问题讨论】:

    标签: pentaho pentaho-spoon pentaho-data-integration


    【解决方案1】:

    Ahhrggg...哦不...请不... DateTimeFormat 在 MS-server 中运行,但不在 PDI 中...不是那个...不再... p>

    首先选中Input Table 步骤上的Enable Lazy Conversion 复选框未打开。

    如果问题仍然存在,您可以尝试编辑连接。在左侧面板中,选择Advanced 并选中/取消选中Support timestamp data type

    如果问题仍然存在,那么您必须找出问题所在。使用 SELECT * 读取表格并尝试使用 Select Value/Metadata 步骤转换日期并使用格式。

    如果还是找不到问题,请尝试以更 PDI 的方式解决问题,而不是在一个 sql 中。据我了解,数据格式取决于${SHORT_FILENAME},因此您可以将该变量用于Switch/Case 到相应的Select Value/Metadata/Date Format,并将您的子选择迁移到相应的@ 987654332@ 和Filter Rows。 [请在抱怨性能不佳之前帮我进行测试]。

    【讨论】:

    • 有帮助吗?您需要更多支持吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多