cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

org.apache.spark.SparkException: Job aborted due to stage failure: Authorized committer failed while pushing dataframe to azure cosmos db.

manasa
Contributor

I am writing data to the azure cosmos db using OLTP connector using below code

cfg["spark.cosmos.write.strategy"]="ItemOverwrite"   
 json_df.write.format("cosmos.oltp").options(**cfg).mode("APPEND").save()

I am getting below error

image.pngimage.png 

Please let me know if you have faced similar issue or if you have any fix.

Feel free to ask more details

4 REPLIES 4

Debayan
Databricks Employee
Databricks Employee

Hi, could you please post the whole text of the error (not the screenshot.)?

Please tag @Debayan​ with your next response which will notify me, Thank you!

Hi @Debayan Mukherjee​ 

Here is the error message

An error occurred while calling o1616.save.

: org.apache.spark.SparkException: Job aborted due to stage failure: Authorized committer (attemptNumber=0, stage=1306, partition=0) failed; but task commit success, data duplication may happen. reason=TaskKilled(preempted by scheduler,Vector(AccumulableInfo(61880,None,Some(248166),None,false,true,None), AccumulableInfo(61882,None,Some(0),None,false,true,None), AccumulableInfo(61883,None,Some(430),None,false,true,None), AccumulableInfo(61901,None,Some(19155841),None,false,true,None), AccumulableInfo(61902,None,Some(4240),None,false,true,None), AccumulableInfo(61903,None,Some(134710060),None,false,true,None), AccumulableInfo(61904,None,Some(19155841),None,false,true,None), AccumulableInfo(61909,None,Some(0),None,false,true,None), AccumulableInfo(61910,None,Some(19155841),None,false,true,None), AccumulableInfo(61911,None,Some(8),None,false,true,None), AccumulableInfo(61912,None,Some(395),None,false,true,None), AccumulableInfo(61913,None,Some(0),None,false,true,None), AccumulableInfo(61914,None,Some(0),None,false,true,None)),Vector(LongAccumulator(id: 61880, name: Some(internal.metrics.executorRunTime), value: 248166), LongAccumulator(id: 61882, name: Some(internal.metrics.resultSize), value: 0), LongAccumulator(id: 61883, name: Some(internal.metrics.jvmGCTime), value: 430), LongAccumulator(id: 61901, name: Some(internal.metrics.input.bytesRead), value: 19155841), LongAccumulator(id: 61902, name: Some(internal.metrics.input.recordsRead), value: 4240), LongAccumulator(id: 61903, name: Some(internal.metrics.input.sampledTimeReadNano), value: 134710060), LongAccumulator(id: 61904, name: Some(internal.metrics.input.sampledBytesRead), value: 19155841), LongAccumulator(id: 61909, name: Some(internal.metrics.io.requestBytesCount), value: 0), LongAccumulator(id: 61910, name: Some(internal.metrics.io.responseBytesCount), value: 19155841), LongAccumulator(id: 61911, name: Some(internal.metrics.io.requestCount), value: 8), LongAccumulator(id: 61912, name: Some(internal.metrics.io.requestMsDuration), value: 395), LongAccumulator(id: 61913, name: Some(internal.metrics.io.retryCount), value: 0), LongAccumulator(id: 61914, name: Some(internal.metrics.io.retryDelayMsDuration), value: 0)),WrappedArray(1757792296, 367759552, 0, 0, 4755036, 0, 4755036, 0, 14168641, 0, 0, 0, 0, 0, 0, 0, 64, 4546, 7, 3349, 7895))

at org.apache.spark.scheduler.DAGScheduler.failJobAndIndependentStages(DAGScheduler.scala:3334)

at org.apache.spark.scheduler.DAGScheduler.$anonfun$abortStage$2(DAGScheduler.scala:3266)

at org.apache.spark.scheduler.DAGScheduler.$anonfun$abortStage$2$adapted(DAGScheduler.scala:3257)

at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62)

at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55)

at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49)

at org.apache.spark.scheduler.DAGScheduler.abortStage(DAGScheduler.scala:3257)

at org.apache.spark.scheduler.DAGScheduler.$anonfun$handleStageFailed$1(DAGScheduler.scala:1418)

at org.apache.spark.scheduler.DAGScheduler.$anonfun$handleStageFailed$1$adapted(DAGScheduler.scala:1418)

at scala.Option.foreach(Option.scala:407)

at org.apache.spark.scheduler.DAGScheduler.handleStageFailed(DAGScheduler.scala:1418)

at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.doOnReceive(DAGScheduler.scala:3543)

at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:3484)

at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:3472)

at org.apache.spark.util.EventLoop$$anon$1.run(EventLoop.scala:51)

at org.apache.spark.scheduler.DAGScheduler.$anonfun$runJob$1(DAGScheduler.scala:1172)

at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)

at com.databricks.spark.util.FrameProfiler$.record(FrameProfiler.scala:80)

at org.apache.spark.scheduler.DAGScheduler.runJob(DAGScheduler.scala:1160)

at org.apache.spark.SparkContext.runJobInternal(SparkContext.scala:2731)

at org.apache.spark.SparkContext.runJob(SparkContext.scala:2714)

at org.apache.spark.sql.execution.datasources.v2.V2TableWriteExec.writeWithV2(WriteToDataSourceV2Exec.scala:388)

at org.apache.spark.sql.execution.datasources.v2.V2TableWriteExec.writeWithV2$(WriteToDataSourceV2Exec.scala:364)

at org.apache.spark.sql.execution.datasources.v2.AppendDataExec.writeWithV2(WriteToDataSourceV2Exec.scala:250)

at org.apache.spark.sql.execution.datasources.v2.V2ExistingTableWriteExec.run(WriteToDataSourceV2Exec.scala:343)

at org.apache.spark.sql.execution.datasources.v2.V2ExistingTableWriteExec.run$(WriteToDataSourceV2Exec.scala:342)

at org.apache.spark.sql.execution.datasources.v2.AppendDataExec.run(WriteToDataSourceV2Exec.scala:250)

at org.apache.spark.sql.execution.datasources.v2.V2CommandExec.$anonfun$result$1(V2CommandExec.scala:47)

at com.databricks.spark.util.FrameProfiler$.record(FrameProfiler.scala:80)

at org.apache.spark.sql.execution.datasources.v2.V2CommandExec.result$lzycompute(V2CommandExec.scala:47)

at org.apache.spark.sql.execution.datasources.v2.V2CommandExec.result(V2CommandExec.scala:45)

at org.apache.spark.sql.execution.datasources.v2.V2CommandExec.executeCollect(V2CommandExec.scala:54)

at org.apache.spark.sql.execution.QueryExecution$$anonfun$$nestedInanonfun$eagerlyExecuteCommands$1$1.$anonfun$applyOrElse$3(QueryExecution.scala:238)

at org.apache.spark.sql.catalyst.QueryPlanningTracker$.withTracker(QueryPlanningTracker.scala:153)

at org.apache.spark.sql.execution.QueryExecution$$anonfun$$nestedInanonfun$eagerlyExecuteCommands$1$1.$anonfun$applyOrElse$2(QueryExecution.scala:238)

at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withCustomExecutionEnv$8(SQLExecution.scala:227)

at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:410)

at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withCustomExecutionEnv$1(SQLExecution.scala:172)

at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:1035)

at org.apache.spark.sql.execution.SQLExecution$.withCustomExecutionEnv(SQLExecution.scala:122)

at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:360)

at org.apache.spark.sql.execution.QueryExecution$$anonfun$$nestedInanonfun$eagerlyExecuteCommands$1$1.$anonfun$applyOrElse$1(QueryExecution.scala:237)

at org.apache.spark.sql.execution.QueryExecution.org$apache$spark$sql$execution$QueryExecution$$withMVTagsIfNecessary(QueryExecution.scala:220)

at org.apache.spark.sql.execution.QueryExecution$$anonfun$$nestedInanonfun$eagerlyExecuteCommands$1$1.applyOrElse(QueryExecution.scala:233)

at org.apache.spark.sql.execution.QueryExecution$$anonfun$$nestedInanonfun$eagerlyExecuteCommands$1$1.applyOrElse(QueryExecution.scala:226)

at org.apache.spark.sql.catalyst.trees.TreeNode.$anonfun$transformDownWithPruning$1(TreeNode.scala:519)

at org.apache.spark.sql.catalyst.trees.CurrentOrigin$.withOrigin(TreeNode.scala:106)

at org.apache.spark.sql.catalyst.trees.TreeNode.transformDownWithPruning(TreeNode.scala:519)

at org.apache.spark.sql.catalyst.plans.logical.LogicalPlan.org$apache$spark$sql$catalyst$plans$logical$AnalysisHelper$$super$transformDownWithPruning(LogicalPlan.scala:31)

at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper.transformDownWithPruning(AnalysisHelper.scala:316)

at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper.transformDownWithPruning$(AnalysisHelper.scala:312)

at org.apache.spark.sql.catalyst.plans.logical.LogicalPlan.transformDownWithPruning(LogicalPlan.scala:31)

at org.apache.spark.sql.catalyst.plans.logical.LogicalPlan.transformDownWithPruning(LogicalPlan.scala:31)

at org.apache.spark.sql.catalyst.trees.TreeNode.transformDown(TreeNode.scala:495)

at org.apache.spark.sql.execution.QueryExecution.$anonfun$eagerlyExecuteCommands$1(QueryExecution.scala:226)

at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper$.allowInvokingTransformsInAnalyzer(AnalysisHelper.scala:372)

at org.apache.spark.sql.execution.QueryExecution.eagerlyExecuteCommands(QueryExecution.scala:226)

at org.apache.spark.sql.execution.QueryExecution.commandExecuted$lzycompute(QueryExecution.scala:180)

at org.apache.spark.sql.execution.QueryExecution.commandExecuted(QueryExecution.scala:171)

at org.apache.spark.sql.execution.QueryExecution.assertCommandExecuted(QueryExecution.scala:287)

at org.apache.spark.sql.DataFrameWriter.runCommand(DataFrameWriter.scala:964)

at org.apache.spark.sql.DataFrameWriter.saveInternal(DataFrameWriter.scala:346)

at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:258)

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)

Debayan
Databricks Employee
Databricks Employee

Hi, I do not see any exact error on the issue, primarily it is looking there is connection issue from control plane to data plane. It would be better if you could raise a case to Databricks support on the same and we can triage it.

Anonymous
Not applicable

Hi @Manasa Kalluri​ 

Thank you for your question! To assist you better, please take a moment to review the answer and let me know if it best fits your needs.

Please help us select the best solution by clicking on "Select As Best" if it does.

Your feedback will help us ensure that we are providing the best possible service to you.

Thank you!

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group