更新时间:2022-12-12 10:19:51
你可以使用java hex to Long converter
java.lang.Long.parseLong(hex.trim(), 16)
你只需要定义一个udf
函数如下
All you need is to define a udf
function as below
import org.apache.spark.sql.functions.udf
def hexToLong = udf((hex: String) => java.lang.Long.parseLong(hex.trim(), 16))
并使用.withColumn
api
df.withColumn("Icao", hexToLong($"Icao")).show(false)