0

我正在使用spark.read.format("jdbc").option("query", tmpSql)从 Mysql 加载表,并且可以select * from (xxx) where 1=0从数据库监视器中看到查询,后来我知道该查询用于推断 Spark 中的表模式。但是,当我使用时spark.read.format("jdbc").option("query", tmpSql).schema(xxx),表模式推断查询仍然存在。为什么在已经指定 customSchema 时 Spark 仍然需要推断表模式?

4

1 回答 1

0

尝试使用customSchemaspark jdbc的参数。

.option("customSchema", schema_str)
于 2021-12-09T01:45:57.933 回答