加载时出现以下错误 Null
spark中数据库的值。 Datatype
目标表的 smallint
```
Caused by: java.lang.IllegalArgumentException: Can't get JDBC type for null
代码:
val hivedata = spark.sql(s"""select 1 as column1 , B a column2 , NULL as column3 from table""")
hivedata .write.mode(SaveMode.Append).jdbc(url = con, table = targettable, Pconnectionropertiess)
有人能帮我吗
1条答案
按热度按时间c8ib6hqw1#
cast(NULL as smallint)
你必须做。。。这将把null转换为short
键入如下架构所示。结果:
另一方面,它将是nulltype而不是small int类型。。
这就是你得到例外的原因。