Skip to content

Commit

Permalink
add null handle
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-wang committed May 5, 2015
1 parent ec455b9 commit aef0e96
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,13 @@ private[sql] class JDBCRDD(
case BooleanConversion => mutableRow.setBoolean(i, rs.getBoolean(pos))
case DateConversion =>
mutableRow.update(i, DateUtils.fromJavaDate(rs.getDate(pos)))
case DecimalConversion => mutableRow.update(i, Decimal(rs.getBigDecimal(pos)))
case DecimalConversion =>
val decimalVal = rs.getBigDecimal(pos)
if (decimalVal == null) {
mutableRow.update(i, null)
} else {
mutableRow.update(i, Decimal(decimalVal))
}
case DoubleConversion => mutableRow.setDouble(i, rs.getDouble(pos))
case FloatConversion => mutableRow.setFloat(i, rs.getFloat(pos))
case IntegerConversion => mutableRow.setInt(i, rs.getInt(pos))
Expand Down

0 comments on commit aef0e96

Please sign in to comment.