Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ public long getLong()
if (value instanceof Long || value instanceof Integer) {
return ((Number) value).longValue();
}
if (value instanceof Float && columnType == RealType.REAL) {
return floatToIntBits((float) value);
}
throw new TrinoException(DECODER_CONVERSION_NOT_SUPPORTED, format("cannot decode object of '%s' as '%s' for column '%s'", value.getClass(), columnType, columnName));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -742,10 +742,10 @@ private static List<RoundTripTestCase> roundTripAllFormatsData()
return ImmutableList.<RoundTripTestCase>builder()
.add(new RoundTripTestCase(
"all_datatypes_avro",
ImmutableList.of("f_bigint", "f_double", "f_boolean", "f_varchar"),
ImmutableList.of("f_bigint", "f_float", "f_double", "f_boolean", "f_varchar"),
ImmutableList.of(
ImmutableList.of(100000, 1000.001, true, "'test'"),
ImmutableList.of(123456, 1234.123, false, "'abcd'"))))
ImmutableList.of(100000, 999.999f, 1000.001, true, "'test'"),
ImmutableList.of(123456, -123.456f, 1234.123, false, "'abcd'"))))
.add(new RoundTripTestCase(
"all_datatypes_csv",
ImmutableList.of("f_bigint", "f_int", "f_smallint", "f_tinyint", "f_double", "f_boolean", "f_varchar"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
"mapping": "f_bigint"
},
{
"name": "f_float",
"type": "REAL",
"mapping": "f_float"
},
{
"name": "f_double",
"type": "DOUBLE",
"mapping": "f_double"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
"type":["null", "long"],
"default": null
},
{
"name": "f_float",
"type":["null", "float"],
"default": null
},
{
"name": "f_double",
"type":["null", "double"],
Expand Down