Skip to content

Commit 7514b40

Browse files
committed
Cast column values for the appropriate data type (for type overrides)
1 parent 72c332e commit 7514b40

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

query-engine/src/main/java/uk/co/spudsoft/query/exec/sources/sql/RowStreamWrapper.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,13 @@ private DataRow sqlRowToDataRow(Row row) {
160160
String name = row.getColumnName(col);
161161
Object value = row.getValue(col);
162162
Comparable<?> compValue = DataRow.convert(value);
163-
result.put(name, compValue);
163+
DataType type = types.get(name);
164+
try {
165+
Comparable<?> typedValue = type.cast(compValue);
166+
result.put(name, typedValue);
167+
} catch (Exception ex) {
168+
logger.warn("Unable to convert {} to {}: ", compValue, type, ex);
169+
}
164170
}
165171
return result;
166172
}

0 commit comments

Comments
 (0)