Skip to content
Open
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 @@ -69,10 +69,10 @@ private 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_double", "f_boolean", "f_varchar"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
"type": "BIGINT",
"mapping": "f_bigint"
},
{
"name": "f_float",
"type": "REAL",
"mapping": "f_float"
},
{
"name": "f_double",
"type": "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
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,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 PrestoException(DECODER_CONVERSION_NOT_SUPPORTED, format("cannot decode object of '%s' as '%s' for column '%s'", value.getClass(), columnType, columnName));
}

Expand Down