Azure / spark-cdm-connector

MIT License
76 stars 33 forks source link

[Issue] Issue with connecting to ADSLG2 from Databricks #145

Closed cegladanych closed 1 year ago

cegladanych commented 1 year ago

Did you read the pinned issues and search the error message?

No, but I will read and search it now before creating an issue.

Summary of issue

I tried reading CDM from Databricks but it fails with error.

There is no documentation how to set up permissions with storage using Databricks. Can you help

Depending on a cluster I see error 1 java.lang.NoSuchMethodError: com.databricks.backend.daemon.data.client.adl.AdlGen2CredentialContextTokenProvider.getToken()Lshaded/databricks/v20180920_b33d810/org/apache/hadoop/fs/azurebfs/oauth2/AzureADToken;

Depending on a cluster I see error 2 java.lang.SecurityException: Only default session catalog is supported, for Credential Passthourh or Table ACL enabled cluster. Try to load: com.microsoft.cdm.CDMCatalot

readExplicit = (spark.read.format("com.microsoft.cdm")
  .option("storage", storageAccountName)
  .option("manifestPath", container + "/nestedExplicit/default.manifest.cdm.json")
  .option("entity", "NestedExampleExplicit")
  .load())

Error stack trace

Py4JJavaError Traceback (most recent call last) File :4 1 container= "raw" 2 storageAccountName = "bronzedatalake.dfs.core.windows.net" ----> 4 readExplicit = (spark.read.format("com.microsoft.cdm") 5 .option("storage", storageAccountName) 6 .option("manifestPath", container + "/nestedExplicit/default.manifest.cdm.json") 7 .option("entity", "NestedExampleExplicit") 8 .load())

File /databricks/spark/python/pyspark/instrumentation_utils.py:48, in _wrap_function..wrapper(*args, *kwargs) 46 start = time.perf_counter() 47 try: ---> 48 res = func(args, **kwargs) 49 logger.log_success( 50 module_name, class_name, function_name, time.perf_counter() - start, signature 51 ) 52 return res

File /databricks/spark/python/pyspark/sql/readwriter.py:309, in DataFrameReader.load(self, path, format, schema, **options) 307 return self._df(self._jreader.load(self._spark._sc._jvm.PythonUtils.toSeq(path))) 308 else: --> 309 return self._df(self._jreader.load())

File /databricks/spark/python/lib/py4j-0.10.9.5-src.zip/py4j/java_gateway.py:1321, in JavaMember.call(self, *args) 1315 command = proto.CALL_COMMAND_NAME +\ 1316 self.command_header +\ 1317 args_command +\ 1318 proto.END_COMMAND_PART 1320 answer = self.gateway_client.send_command(command) -> 1321 return_value = get_return_value( 1322 answer, self.gateway_client, self.target_id, self.name) 1324 for temp_arg in temp_args: 1325 temp_arg._detach()

File /databricks/spark/python/pyspark/errors/exceptions.py:228, in capture_sql_exception..deco(*a, kw) 226 def deco(*a: Any, *kw: Any) -> Any: 227 try: --> 228 return f(a, kw) 229 except Py4JJavaError as e: 230 converted = convert_exception(e.java_exception)

File /databricks/spark/python/lib/py4j-0.10.9.5-src.zip/py4j/protocol.py:326, in get_return_value(answer, gateway_client, target_id, name) 324 value = OUTPUT_CONVERTER[type](answer[2:], gateway_client) 325 if answer[1] == REFERENCE_TYPE: --> 326 raise Py4JJavaError( 327 "An error occurred while calling {0}{1}{2}.\n". 328 format(target_id, ".", name), value) 329 else: 330 raise Py4JError( 331 "An error occurred while calling {0}{1}{2}. Trace:\n{3}\n". 332 format(target_id, ".", name, value))

Py4JJavaError: An error occurred while calling o389.load. : java.lang.NoSuchMethodError: com.databricks.backend.daemon.data.client.adl.AdlGen2CredentialContextTokenProvider.getToken()Lshaded/databricks/v20180920_b33d810/org/apache/hadoop/fs/azurebfs/oauth2/AzureADToken; at com.microsoft.cdm.utils.CDMTokenProvider.(CDMTokenProvider.scala:15) at com.microsoft.cdm.HadoopTables.load(HadoopTables.scala:11) at com.microsoft.cdm.CDMCatalog.loadTable(CDMCatalog.scala:33) at com.microsoft.cdm.CDMCatalog.loadTable(CDMCatalog.scala:15) at org.apache.spark.sql.connector.catalog.CatalogV2Util$.getTable(CatalogV2Util.scala:363) at org.apache.spark.sql.execution.datasources.v2.DataSourceV2Utils$.loadV2Source(DataSourceV2Utils.scala:135) at org.apache.spark.sql.DataFrameReader.$anonfun$load$1(DataFrameReader.scala:333) at scala.Option.flatMap(Option.scala:271) at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:331) at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:226) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244) at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:380) at py4j.Gateway.invoke(Gateway.java:306) at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132) at py4j.commands.CallCommand.execute(CallCommand.java:79) at py4j.ClientServerConnection.waitForCommands(ClientServerConnection.java:195) at py4j.ClientServerConnection.run(ClientServerConnection.java:115) at java.lang.Thread.run(Thread.java:750)

Platform name

Databricks

Spark version

3.3

CDM jar version

spark_cdm_connector_assembly_synapse_spark3_3_1_19_5.jar

What is the format of the data you are trying to read/write?

.csv

kecheung commented 1 year ago

The pinned issues mention:

As referenced in #134, credential passthrough is a Synapse specific feature. Use app registration or SAS token auth if you are not using Synapse.