How to add external jar to spark in HDInsight? How to add external jar to spark in HDInsight? azure azure

How to add external jar to spark in HDInsight?


You can add extra dependencies starting you spark-shell with:

spark-shell --packages maven-coordinates of the package

In you case:

    spark-shell --packages com.microsoft.azure:azure-cosmosdb-spark_2.1.0_2.11:jar:1.1.2

A good practice is to package your app with all its dependencies:

https://spark.apache.org/docs/latest/submitting-applications.html#bundling-your-applications-dependencies

This should work on livy as well.