0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【備忘録】Azure Databricks(Spark)に対して、JDBC接続を実施する場合におけるExists句利用時のエラーへの対応方法

Last updated at Posted at 2020-04-27

概要

 Azure Databricks(Spark)に対して、JDBC接続によりExists句を含むクエリを実行する場合には、”UseNativeQuery=1”を指定する必要があるようです。サブクエリを含むクエリを実行する場合にも同様の方法で解決できます。

 Azure DatabricksではSimba社のjdbcドライバーを利用することが想定されており、Simba社のSpark jdbcドライバーを利用する他のソフトウェアにおいても同様の解決ができるかと。

エラーメッセージと解決策について

エラーメッセージについて

Response message:java.sql.SQLException: [Simba]SparkJDBCDriver ERROR processing query/statement. Error Code: 42000, SQL state: Syntax error or access violation, Query: AEExistsPredicate is not supported.

問題点

JDBCドライバーのデフォルト設定にて、クエリを、HiveQLに変換することが原因なようです。下記が、Simba社のドキュメント記載内容となります。

UseNativeQuery

Default Value Data Type Required
0 Integer No

This property specifies whether the driver transforms the queries emitted by applications.

  • 1: The driver does not transform the queries emitted by applications, so the native query is used.
  • 0: The driver transforms the queries emitted by applications and converts them into an equivalent form in HiveQL.

引用元: Simba Spark JDBC Driver with SQL Connector 2.6.3 Installation and Configuration Guide

解決策

Database URLにて、”UseNativeQuery=1”を追記してください。

標準のDatabase URL

jdbc:spark://japaneast.azuredatabricks.net:443/default;transportMode=http;ssl=1;httpPath=sql/protocolv1/o/6164547948198512/0418-005719-reins180;AuthMech=3;UID=token;PWD=<personal-access-token>

変更後のDatabase URL

jdbc:spark://japaneast.azuredatabricks.net:443/default;transportMode=http;ssl=1;httpPath=sql/protocolv1/o/6164547948198512/0418-005719-reins180;AuthMech=3;UID=token;PWD=<personal-access-token>;UseNativeQuery=1;

関連リンク

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?