Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Everyone,
i have a talend job which use tHiveRow to run query , how can i add some validation before run query.
So for example ,
Query Test1= insert into table a select * from table B.
Validation Test2=select max(date) from B.
if the result of Test2='2019-09-05' , then exit running but not throw excepting or error log, if Test2='2019-10-05' , then run query.
i am very novice in talend , please help and thanks so much in advance.
Hi
Use a tHiveInput to query the max date and use runIf trigger to control the tHiveRow execution, eg:
tHiveInput--main--tJavaRow--runIf--tHiveRow
on tJavaRow:
if(TalendDate.compareDate(input_row.dateColumnName, TalendDate.parseDate("yyyy-MM-dd", "2019-10-05"))==0){
context.isContinue=true;
}else{
context.isContinue=false;
}
//Define a context variable isContinue with boolean type.
Set the condition of runIf as:
context.isContinue
Regards
Shong
Hi
Use a tHiveInput to query the max date and use runIf trigger to control the tHiveRow execution, eg:
tHiveInput--main--tJavaRow--runIf--tHiveRow
on tJavaRow:
if(TalendDate.compareDate(input_row.dateColumnName, TalendDate.parseDate("yyyy-MM-dd", "2019-10-05"))==0){
context.isContinue=true;
}else{
context.isContinue=false;
}
//Define a context variable isContinue with boolean type.
Set the condition of runIf as:
context.isContinue
Regards
Shong