Binary Data to Float using Spark SQL

Often when there is massive data communication among the enterprise applications, the data is converted to binary datatype, for reasons like:
Faster I/O, Smaller Size, any type of data can be represented, etc.

This brings in need to convert binary back to known/readable data type for further analysis/processing etc.


For example, here floating point data is represented in Decimal Array[Byte] then stored in Binary format.

Ex: [62, -10, 0, 0]
Whole floating point equivalent is: 0.480


To achieve above conversion using Apache Spark Sql DataFrames:



Voila!

Comments

Anonymous said…
Hi!

Thanks for the post.

Your reference for https://gist.github.com/springbrain/3c372ace182b8e645c3b7c2b5c5b6f67.js is broken, though.

Popular posts from this blog

Spark Cluster Mode - Too many open files

Spark Scala - Perform data aggregation on last or next n seconds time window