Describe the bug
Broadcast throws exception on Databricks on AWS.
Error Logs
20/10/26 16:43:55 WARN DotnetBackendHandler: cannot find matching method class org.apache.spark.api.python.PythonRDD.setupBroadcast. Candidates are:
20/10/26 16:43:55 WARN DotnetBackendHandler: setupBroadcast(class org.apache.spark.api.java.JavaSparkContext,class java.lang.String)
20/10/26 16:43:55 ERROR DotnetBackendHandler: Failed to execute 'setupBroadcast' on 'NullObject' with args=([Type=java.lang.String, Value: /local_disk0/spark-0b4511c2-19cd-4849-9fe6-583b1ea94fac/sparkdotnet/5w3ohffw.2m0])
HelloSpark Program.cs Code
using Microsoft.Spark;
using Microsoft.Spark.Sql;
using Microsoft.Spark.Sql.Types;
namespace HelloSpark
{
class Program
{
static void Main(string[] args)
{
var spark = SparkSession.Builder().GetOrCreate();
var broadcastTest = spark.SparkContext.Broadcast("test");
}
}
}
To Reproduce
Expected behavior
Broadcast works without any errors.
Environment Info
Additional Info
For whatever reason it seems like in the Databricks environment PythonRDD setupBroadcast takes the javaSparkContext and the path.
https://github.com/dotnet/spark/blob/master/src/csharp/Microsoft.Spark/Broadcast.cs#L177
Updating the Broadcast.cs to also pass in the javaSparkContext resolved the issue when running on Databricks but of course breaks it in other enviornments like AWS EMR.
This example uses 2.4, but I have seen the same issues on spark 3.
This may also happen on Azure, but can only confirm on AWS.
Hi @jonathantonic , thanks for reporting this and sorry for the error you are facing. Could you please attach the full stacktrace of the error logs?
Hi @jonathantonic , thanks for reporting this and sorry for the error you are facing. Could you please attach the full stacktrace of the error logs?
full error logs:
log4j-active.txt
stderr.txt
stdout.txt
Thanks for providing the complete logs @jonathantonic . Just to clarify, are you able to run your application in AWS EMR without any of the changes you had to make for AWS Databricks? (Such as passing javaSparkContext to setupBroadcast ?)
Thanks for providing the complete logs @jonathantonic . Just to clarify, are you able to run your application in AWS EMR without any of the changes you had to make for AWS Databricks? (Such as passing
javaSparkContexttosetupBroadcast?)
Yes that is correct.
Thanks @jonathantonic I'm going to repro this bug and get back to you with our suggestions.
Hey @Niharikadutta, any luck reproducing?
Hey @jonathantonic I am sorry for the delay have been a little occupied, I am working on it and will get back to you soon. Thanks for your patience!
Hi @jonathantonic I was able to reproduce this on AWS as well as Azure Databricks for Spark versions 2.4.5 and 3.0.1. We are working on coming up with a solution/workaround and will update you as soon as we have a plan. Thanks!
HI @jonathantonic , the fix for this bug is in PR - https://github.com/dotnet/spark/pull/766 and will be available in v1.0.1, which is the next release.