I have following code
String sql = "(select mod_col, 1 as count_col from ( " +
"select mod(col1, 10) as mod_col " +
"from table1 c " +
"where c.col2 = 1) temp " +
"group by mod_col, count_col ) as temp2";
DataFrame df = getDSEDataFrame(sql);
Note that the col1 is defined in mysql with type int(11) NOT NULL.
However, when I check the df, the mod_col has the correct value as a bigint. This cause an exception java.math.BigDecimal cannot be cast to java.lang.Integer for my following code
List<Row> col1List = df.collectAsList();
for (Row r : col1List) {
Integer col1Val = r.getAs("mod_col"); // exception thrown here
}
Is there any way in above sql that I can force it return an integer instead of a big integer?