【问题标题】:In Spark 2.4, Doesn't Spark JDBC allow to specifying Built in function as the partitionColumn?在 Spark 2.4 中,Spark JDBC 是否不允许将内置函数指定为 partitionColumn?
【发布时间】:2019-05-15 21:24:31
【问题描述】:

我正在尝试将 spark 版本 2.2.1 更改为 2.4.0 在 spark 2.2 中,Following 工作正常。

val query = "(select id, myPartitionColumnString from myTable) query"
val splitColumn = "CHECKSUM(myPartitionColumnString)"
spark.read.jdbc(jdbcUrl, query, splitColumn, lowerBound, upperBound, numPartitions, connectionProperties)

但在 spark 2.4 中,它会导致这样的错误

User-defined partition column CHECKSUM(myPartitionColumnString) not found in the JDBC relation: struct<id: int, myPartitionColumnString: string>

我确定 CheckSum 已定义。

【问题讨论】:

    标签: apache-spark apache-spark-sql


    【解决方案1】:

    他们在引入“传递直接 SQL 查询”功能时将其删除。 2.4.0 中引入了重大更改。这更像是一种黑客行为,现在没有办法实现这一点。你仍然可以在 2.3 中获得它

    PS:如果有人找到另一种实现相同行为的方法,请与我联系,我很感兴趣

    【讨论】:

      猜你喜欢
      • 2019-09-21
      • 1970-01-01
      • 2022-12-17
      • 2019-07-03
      • 2019-09-12
      • 2020-06-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多