To demonstrate the error, I can simply follow the instructions from Using Opaque SQL in the documentation but substitute the given integers for floats:
scala> df.show()
+----+------+
|word| count|
+----+------+
| foo|508.41|
| bar|717.13|
| baz| 82.31|
+----+------+
scala> df.printSchema
root
|-- word: string (nullable = true)
|-- count: float (nullable = false)
If I encrypt the dataframe, then decrypt it I get the following:
scala> dfEncrypted.show()
+----+----------+
|word| count|
+----+----------+
| foo|508.410004|
| bar|717.130005|
| baz| 82.309998|
+----+----------+
scala> dfEncrypted.printSchema
root
|-- word: string (nullable = true)
|-- count: float (nullable = false)
scala> dfEncrypted.collect()
res18: Array[org.apache.spark.sql.Row] = Array([foo,508.41], [bar,717.13], [baz,82.31])
So it appears that there is an error in de-serializing the floats to a string as the displayed numbers are incorrect when using show() but not collect().
One thing I noticed when debugging is that, if I set breakpoints in the various cases here, running collect() shows that both the StringField and FloatField cases are entered (as expected), but running show() prints out that StringField is visited twice so it would seem that the float value is being turned into a string (incorrectly) somewhere in C++ code before Scala? But I am not sure.
To demonstrate the error, I can simply follow the instructions from
Using Opaque SQLin the documentation but substitute the given integers for floats:If I encrypt the dataframe, then decrypt it I get the following:
So it appears that there is an error in de-serializing the floats to a string as the displayed numbers are incorrect when using
show()but notcollect().One thing I noticed when debugging is that, if I set breakpoints in the various cases here, running
collect()shows that both theStringFieldandFloatFieldcases are entered (as expected), but runningshow()prints out thatStringFieldis visited twice so it would seem that the float value is being turned into a string (incorrectly) somewhere in C++ code before Scala? But I am not sure.