GroupBy Node Not Working because of data type changed

Hi All,

I have a GroupBy node which takes input from an Excel Reader.
In the aggregation setting I choose a column “Delta Start Absolute” with data type Double.

Using data set A, the workflow works fine.
But when using data set B, the GroupBy node throws an error:

Execute failed: Runtime class of object “6475505.0” (index 1) in row “Row0” is Number (double) and does not comply with its supposed superclass Number (integer)

Apparently, ExcelReader automatically classify “Delta Start Absolute” in data set B as Integer, therefore causing error in GroupBy nodes because of data type mismatch.

What’s the best way to fix this?

Workflow

testDbl2.xlsx (9.3 KB) testInt.xlsx (8.8 KB)

1 Like

Hi there @ryudhanto,

welcome to KNIME Community!

I see your point. Seems there are two things (that poop on my mind) you can do depending on your case/data set. One is Type Based Aggregation in GroupBy node in case you have only one numeric column in your data set. There you choose Double type with your aggregation method and Type matching Include sub-types.

GroupByTypes

This will perform aggregation on every double, long and int column. As said this makes sense only if you have one numeric column in your data set which obviously might not be the case so second approach is to use Math Formula node after Excel Reader to always make sure your column of interest is Double. Just don’t check convert to Int :wink:

MathFormulaDouble

Hope this helps!

Br,
Ivan

1 Like

Hi @ipazin ,

I chose the second approach: using Math Formula, cause (as you have might have guessed it) I have quite a number of numeric columns in my data.

And it’s working perfectly right now, thanks for the solutions!

1 Like

Glad it works @ryudhanto!
Br,
Ivan

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.