gpt4 book ai didi

apache-spark - 不允许操作 : STORED BY hive on spark sql

转载 作者:行者123 更新时间:2023-12-04 10:27:36 25 4
gpt4 key购买 nike

我正在尝试通过 Spark 实现 Hive 和 DynamoDB 之间的连接。
为此,我需要执行此代码:

sparkSession.sql("create external table test (id string) STORED BY 'org.apache.hadoop.hive.dynamodb.DynamoDBStorageHandler' TBLPROPERTIES('dynamodb.table.name'='testdb','dynamodb.column.mapping'='id:id')")

但我有一个错误:
ParseException: u"\nOperation not allowed: STORED BY(line 1, pos 111)

我在某处读到 STORED BY Spark 不支持。有什么替代方法吗?总是不支持吗?谢谢你

最佳答案

这是 Spark Docs 的摘录:

Note that, Hive storage handler is not supported yet when creating table, you can create a table using storage handler at Hive side, and use Spark SQL to read it.



如您所见,Spark 无法创建 Hive 的 StorageHandler表,但可以读取已经存在的表。

解决方案可能是直接在 Hive 中创建表定义(使用 beeline、hive 或您喜欢的任何其他 JDBC 客户端),您仍然可以在任何支持 Hive 的 Spark(即 spark.sql("select * from test") )中读取表。

关于apache-spark - 不允许操作 : STORED BY hive on spark sql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60564837/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com