从 Spark 读取所有 Impala 表名称

发布于 2025-01-10 17:25:06 字数 834 浏览 2 评论 0原文

我想使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文