Jdbc Azure DataRicks Scala Dataframe:将字符串类型列值插入SQLServer varbinary()类型列
我有一个dataframe,它在其中一列中保存hashvalue。我使用sha2_512生成如下哈希值Jdbc Azure DataRicks Scala Dataframe:将字符串类型列值插入SQLServer varbinary()类型列,jdbc,apache-spark-sql,databricks,jdbc-odbc,Jdbc,Apache Spark Sql,Databricks,Jdbc Odbc,我有一个dataframe,它在其中一列中保存hashvalue。我使用sha2_512生成如下哈希值 sha2(concat_ws(" ", forHashColumnNameListBuffer.map(col): _*), 512) 当我试图使用JDBC连接将这个数据帧插入SQLServer中的表时,我得到了下面的错误 Job aborted due to stage failure: Task 0 in stage 8.0 failed 4 times, most
sha2(concat_ws(" ", forHashColumnNameListBuffer.map(col): _*), 512)
当我试图使用JDBC连接将这个数据帧插入SQLServer中的表时,我得到了下面的错误
Job aborted due to stage failure: Task 0 in stage 8.0 failed 4 times, most recent failure: Lost task 0.3 in stage 8.0 (TID 20, 10.171.93.5, executor 1): java.sql.BatchUpdateException: Implicit conversion from data type nvarchar to varbinary is not allowed. Use the CONVERT function to run this query.
这是因为dataframe中的Hashvalue列的类型为string,而目标列的数据类型为varbinary(64)
我尝试了以下两种方法来消除错误。但是没有用