Thursday, September 23, 2021

How to access Azure Open Dataset from Spark

Goal:

This article explains how to access Azure Open Dataset from Spark.

Env:

spark-3.1.1-bin-hadoop2.7

Solution:

Microsoft Azure Open Dataset is curated and cleansed data - including weather, census, and holidays - that you can use with minimal preparation to enrich ML models.

If we want to access it from local Spark environment, we need 2 jars :

  • azure-storage-<version>.jar
  • hadoop-azure-<version>.jar

My Spark is built on Hadoop 2.7, so I have to use a relatively older hadoop-zure jar. 

In this example, I downloaded below two jars:

1. Add above 2 jars into Spark classpath.

spark.executor.extraClassPath
spark.driver.extraClassPath

2. Add Azure Blob Storage related Hadoop configs

For example, I choose to add them directly into Jupyter notebook(or you can add them into core-site.xml):

sc._jsc.hadoopConfiguration().set("fs.azure","org.apache.hadoop.fs.azure.NativeAzureFileSystem")
sc._jsc.hadoopConfiguration().set("spark.hadoop.fs.wasbs.impl","org.apache.hadoop.fs.azure.NativeAzureFileSystem")
sc._jsc.hadoopConfiguration().set("fs.wasbs.impl","org.apache.hadoop.fs.azure.NativeAzureFileSystem")
sc._jsc.hadoopConfiguration().set("fs.AbstractFileSystem.wasbs.impl", "org.apache.hadoop.fs.azure.Wasbs")
sc._jsc.hadoopConfiguration().set("spark.hadoop.fs.adl.impl", "org.apache.hadoop.fs.adl.AdlFileSystem")

3.  Follow PySpark commands to access Azure Open Dataset

For example, the PySpark commands are here for accessing "NYC Taxi - Yellow" Azure Open Dataset.







13 comments:

  1. This configuration solved my problem. I am able to run pyspark commands. Thanks to you

    ReplyDelete
    Replies
    1. This article provides a practical walkthrough for accessing Azure Open Dataset from a local Spark environment. The explanation of required JAR files, Hadoop configuration, and Azure Blob Storage settings makes the process easier to understand for anyone working with distributed data processing.

      The use of Spark and PySpark commands makes PySpark Training particularly relevant, especially for learning how PySpark interacts with external storage and large datasets.

      Delete
    2. The article also demonstrates several core data engineering concepts, including Hadoop dependencies, filesystem configuration, and dataset access, making Data Engineering Training a useful related resource for understanding the broader workflow.

      Delete
    3. Since the solution works with Azure Open Dataset and Azure Blob Storage, the cloud component is also significant. This makes Cloud Computing Projects a natural connection for exploring practical applications involving cloud-based data services.

      Delete
    4. Overall, the combination of Spark, Hadoop, Azure storage, and curated datasets illustrates a practical big-data workflow, making Big Data Projects another relevant direction for applying similar technologies to larger data-processing scenarios.

      Delete
  2. Very informative post! The step-by-step explanation of accessing Azure Open Datasets through Azure Machine Learning makes the process much easier to understand. A valuable resource for anyone working with cloud-based data science and machine learning projects. 🚀

    fine wine store

    ReplyDelete
  3. Great guide on accessing Azure Open Dataset from Spark! The clear steps make it easier to understand data access and simplify large-scale data processing workflows. eCommerce accountant

    ReplyDelete
  4. This is a useful technical guide for working with Azure Open Datasets from a Databricks environment. I like the practical, step-by-step focus, especially for readers looking to simplify data access and integration.

    gym equipment auction

    ReplyDelete