Hi,
I'm currently migrating from kettle 4.2 to 6. I have a bunch of non-regression tests for all the transformations we have. One of the test fails (ClassCastException in DatabaseLookup) in 6 (and is working fine in 4.2 of course).
The transformation has a DatabaseLookup step that queries a DB and returns 2 fields that are defined in the step as Number.
The code fails because it tries to cast a BigDecimal to Double. I checked the differences of DatabaseLookup source between 4.2 and 6 and I found a piece of code that was added in determineFieldsTypesQueryingDb method:
final String[] returnFields = meta.getReturnValueField();
final int returnFieldsOffset = getInputRowMeta().size();
for ( int i = 0; i < returnFields.length; i++ ) {
ValueMetaInterface returnValueMeta = fields.searchValueMeta( returnFields[ i ] );
if ( returnValueMeta != null ) {
ValueMetaInterface v = data.outputRowMeta.getValueMeta( returnFieldsOffset + i );
if ( v.getType() != returnValueMeta.getType() ) {
ValueMetaInterface clone = returnValueMeta.clone();
clone.setName( v.getName() );
data.outputRowMeta.setValueMeta( returnFieldsOffset + i, clone );
}
}
}
When I comment out this code, it works fine in kettle 6.
Any clue on what this piece of code is supposed to do?
Thanks a lot,
Regards,
Nicolas
I'm currently migrating from kettle 4.2 to 6. I have a bunch of non-regression tests for all the transformations we have. One of the test fails (ClassCastException in DatabaseLookup) in 6 (and is working fine in 4.2 of course).
The transformation has a DatabaseLookup step that queries a DB and returns 2 fields that are defined in the step as Number.
The code fails because it tries to cast a BigDecimal to Double. I checked the differences of DatabaseLookup source between 4.2 and 6 and I found a piece of code that was added in determineFieldsTypesQueryingDb method:
final String[] returnFields = meta.getReturnValueField();
final int returnFieldsOffset = getInputRowMeta().size();
for ( int i = 0; i < returnFields.length; i++ ) {
ValueMetaInterface returnValueMeta = fields.searchValueMeta( returnFields[ i ] );
if ( returnValueMeta != null ) {
ValueMetaInterface v = data.outputRowMeta.getValueMeta( returnFieldsOffset + i );
if ( v.getType() != returnValueMeta.getType() ) {
ValueMetaInterface clone = returnValueMeta.clone();
clone.setName( v.getName() );
data.outputRowMeta.setValueMeta( returnFieldsOffset + i, clone );
}
}
}
When I comment out this code, it works fine in kettle 6.
Any clue on what this piece of code is supposed to do?
Thanks a lot,
Regards,
Nicolas