从 Spark 读取所有 Impala 表名称
我想使用 JDBC 连接从 Spark 读取所有 Impala 表名称。
这是 Pyspark 中的代码示例:
df = spark.read.format('jdbc').option('url','jdbc:impala://172.25.0.1:21050/default').option('driver','com.cloudera.impala.jdbc41.Driver').option('dbtable', '(show tables) t').load()
这是出现的错误:
Caused by: com.cloudera.impala.support.exceptions.GeneralException: [Cloudera][ImpalaJDBCDriver](500051) ERROR processing query/statement. Error Code: 0, SQL state: TStatus(statusCode:ERROR_STATUS, sqlState:HY000, errorMessage:ParseException: Syntax error in line 1:
SELECT * FROM (show tables) t WHERE 1=0
^
Encountered: SHOW
Expected: SELECT, VALUES, WITH
CAUSED BY: Exception: Syntax error
), Query: SELECT * FROM (show tables) t WHERE 1=0.
... 32 more
似乎不支持“SHOW”命令。还有其他方法可以实现目标吗?
I want to read all the Impala table name from Spark, using a JDBC connection.
This is an example of the code in Pyspark:
df = spark.read.format('jdbc').option('url','jdbc:impala://172.25.0.1:21050/default').option('driver','com.cloudera.impala.jdbc41.Driver').option('dbtable', '(show tables) t').load()
And this is the error that appears:
Caused by: com.cloudera.impala.support.exceptions.GeneralException: [Cloudera][ImpalaJDBCDriver](500051) ERROR processing query/statement. Error Code: 0, SQL state: TStatus(statusCode:ERROR_STATUS, sqlState:HY000, errorMessage:ParseException: Syntax error in line 1:
SELECT * FROM (show tables) t WHERE 1=0
^
Encountered: SHOW
Expected: SELECT, VALUES, WITH
CAUSED BY: Exception: Syntax error
), Query: SELECT * FROM (show tables) t WHERE 1=0.
... 32 more
It seems that the "SHOW" command is not supported. Is there another way to achieve the goal?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论