Skip to content

Commit a7b7793

Browse files
committed
update
1 parent 418170e commit a7b7793

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

connector/avro/src/main/scala/org/apache/spark/sql/avro/AvroDeserializer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ private[sql] class AvroDeserializer(
201201
updater.setFloat(ordinal, value.asInstanceOf[Float])
202202

203203
case (FLOAT, DoubleType) => (updater, ordinal, value) =>
204-
updater.setDouble(ordinal, value.asInstanceOf[Float].toString.toDouble)
204+
updater.setDouble(ordinal, value.asInstanceOf[Float])
205205

206206
case (DOUBLE, DoubleType) => (updater, ordinal, value) =>
207207
updater.setDouble(ordinal, value.asInstanceOf[Double])

connector/avro/src/test/scala/org/apache/spark/sql/avro/AvroSuite.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -940,15 +940,15 @@ abstract class AvroSuite
940940

941941
// Float -> Double
942942
val floatPath = s"$tempPath/float_data"
943-
val floatDf = Seq(1.34F,
943+
val floatDf = Seq(1F,
944944
Float.MinValue, Float.MinPositiveValue, Float.MaxValue,
945945
Float.NaN, Float.NegativeInfinity, Float.PositiveInfinity
946946
).toDF("col")
947947
floatDf.write.format("avro").save(floatPath)
948948
checkAnswer(
949949
spark.read.schema("col Double").format("avro").load(floatPath),
950-
Seq(Row(1.34D),
951-
Row(-3.4028235E38D), Row(1.4E-45D), Row(3.4028235E38D),
950+
Seq(Row(1D),
951+
Row(-3.4028234663852886E38D), Row(1.401298464324817E-45D), Row(3.4028234663852886E38D),
952952
Row(Double.NaN), Row(Double.NegativeInfinity), Row(Double.PositiveInfinity))
953953
)
954954
}

0 commit comments

Comments
 (0)