The table input step does not execute when variable substitution is done for the query in Pentaho -
below query.
select * tablex 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<=(select convert(datetime,dateadd(day,-1,(select dateadd(month,1,(select concat(1,'-',(substring('${short_filename}',charindex('.','${short_filename}',1)-5,3)), '-',substring('${short_filename}',charindex('.','${short_filename}',1)-2,2)))))),121))
the error says
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 transformation execution. 2017/08/18 10:25:54 - statex_data_pull - dispatching started transformation [statex_data_pull] 2017/08/18 10:25:54 - input table.0 - error (version 6.1.0.1-196, build 1 2016-04-07 12.08.49 buildguy) : unexpected error 2017/08/18 10:25:54 - input table.0 - error (version 6.1.0.1-196, build 1 2016-04-07 12.08.49 buildguy) : org.pentaho.di.core.exception.kettledatabaseexception: 2017/08/18 10:25:54 - input table.0 - couldn't row result set 2017/08/18 10:25:54 - input table.0 - conversion failed when converting date and/or time character string. 2017/08/18 10:25:54 - input table.0 - 2017/08/18 10:25:54 - input table.0 - @ org.pentaho.di.core.database.database.getrow(database.java:2374) 2017/08/18 10:25:54 - input table.0 - @ org.pentaho.di.core.database.database.getrow(database.java:2344) 2017/08/18 10:25:54 - input table.0 - @ org.pentaho.di.core.database.database.getrow(database.java:2322) 2017/08/18 10:25:54 - input table.0 - @ org.pentaho.di.trans.steps.tableinput.tableinput.doquery(tableinput.java:247) 2017/08/18 10:25:54 - input table.0 - @ org.pentaho.di.trans.steps.tableinput.tableinput.processrow(tableinput.java:138) 2017/08/18 10:25:54 - input table.0 - @ org.pentaho.di.trans.step.runthread.run(runthread.java:62) 2017/08/18 10:25:54 - input table.0 - @ 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 character string. 2017/08/18 10:25:54 - input table.0 - @ com.microsoft.sqlserver.jdbc.sqlserverexception.makefromdatabaseerror(sqlserverexception.java:216) 2017/08/18 10:25:54 - input table.0 - @ com.microsoft.sqlserver.jdbc.sqlserverresultset$fetchbuffer.nextrow(sqlserverresultset.java:4853) 2017/08/18 10:25:54 - input table.0 - @ com.microsoft.sqlserver.jdbc.sqlserverresultset.fetchbuffernext(sqlserverresultset.java:1781) 2017/08/18 10:25:54 - input table.0 - @ com.microsoft.sqlserver.jdbc.sqlserverresultset.next(sqlserverresultset.java:1034) 2017/08/18 10:25:54 - input table.0 - @ 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 1 or more steps errors. 2017/08/18 10:25:54 - statex_data_pull - transformation killing other steps! 2017/08/18 10:25:54 - statex_data_pull - error (version 6.1.0.1-196, build 1 2016-04-07 12.08.49 buildguy) : errors detected! 2017/08/18 10:25:54 - spoon - transformation has finished!! 2017/08/18 10:25:54 - statex_data_pull - error (version 6.1.0.1-196, build 1 2016-04-07 12.08.49 buildguy) : errors detected! 2017/08/18 10:25:54 - statex_data_pull - error (version 6.1.0.1-196, build 1 2016-04-07 12.08.49 buildguy) : errors detected!
btw, works fine when query executed in sqlserver.
ahhrggg... oh no ... please nooooo ... datetimeformat runs in ms-server not in pdi ... not 1 ... not again...
first check enable lazy conversion
checkbox on input table
step not on.
if problem persist, can try edit connection. on left panel, select advanced
, check/uncheck support timestamp data type
.
if problem persist, have find out where. read table select * , try convert dates select value
/metadata
step , play format.
if still cannot find bug, try solve problem in more pdi style rather in 1 sql. far understand, data format depends on ${short_filename}
, can use variable switch/case
appropriate select value
/metadata
/date format
, , migrate sub select in corresponding lookups
, filter rows
. [and please, make me favor of running test before complaining bad performance].
Comments
Post a Comment