Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-27006

SPIP: .NET bindings for Apache Spark

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0
    • Fix Version/s: None
    • Component/s: Spark Core
    • Labels:
      None

      Description

      Background and Motivation: 

      Apache Spark provides programming language support for Scala/Java (native), and extensions for Python and R. While a variety of other language extensions are possible to include in Apache Spark, .NET would bring one of the largest developer community to the table. Presently, no good Big Data solution exists for .NET developers in open source.  This SPIP aims at discussing how we can bring Apache Spark goodness to the .NET development platform.  

      .NET is a free, cross-platform, open source developer platform for building many different types of applications. With .NET, you can use multiple languages, editors, and libraries to build for web, mobile, desktop, gaming, and IoT types of applications. Even with .NET serving millions of developers, there is no good Big Data solution that exists today, which this SPIP aims to address.  

      The .NET developer community is one of the largest programming language communities in the world. Its flagship programming language C# is listed as one of the most popular programming languages in a variety of articles and statistics: 

      Including a C# language extension in Apache Spark will enable millions of .NET developers to author Big Data applications in their preferred programming language, developer environment, and tooling support. We aim to promote the .NET bindings for Spark through engagements with the Spark community (e.g., we are scheduled to present an early prototype at the SF Spark Summit 2019) and the .NET developer community (e.g., similar presentations will be held at .NET developer conferences this year).  As such, we believe that our efforts will help grow the Spark community by making it accessible to the millions of .NET developers. 

      Furthermore, our early discussions with some large .NET development teams got an enthusiastic reception. 

      We recognize that earlier attempts at this goal (specifically Mobius https://github.com/Microsoft/Mobius) were unsuccessful primarily due to the lack of communication with the Spark community. Therefore, another goal of this proposal is to not only develop .NET bindings for Spark in open source, but also continuously seek feedback from the Spark community via posted Jira’s (like this one) and the Spark developer mailing list. Our hope is that through these engagements, we can build a community of developers that are eager to contribute to this effort or want to leverage the resulting .NET bindings for Spark in their respective Big Data applications. 

      Target Personas: 

      .NET developers looking to build big data solutions.  

      Goals: 

      Our primary goal is to help grow Apache Spark by making it accessible to the large .NET developer base and ecosystem. We will also look for opportunities to generalize the interop layers for Spark for adding other language extensions in the future. SPARK-26257https://issues.apache.org/jira/browse/SPARK-26257) proposes such a generalized interop layer, which we hope to address over the course of this project.  

      Another important goal for us is to not only enable Spark as an application solution for .NET developers, but also opening the door for .NET developers to make contributions to Apache Spark itself.   

      Lastly, we aim to develop a .NET extension in the open, while continually engaging with the Spark community for feedback on designs and code. We will welcome PRs from the Spark community throughout this project and aim to grow a community of developers that want to contribute to this project.  

      Non-Goals: 

      This proposal is focused on adding .NET bindings to Apache Spark, and leave any performance related tasks for future work. Further, we aim to provide support only at the Dataframe level. 

      Proposed API Changes: 

      This work mostly involves introducing new .NET binding APIs. For example, we would introduce .NET UDF related classes such as DotnetUDF, UserDefinedDotnetFunction, etc., along with classes responsible for running .NET UDFs such as DotnetRunner, DotnetWorkerFactory, etc. 

      This work should have minimal impact on existing Spark APIs. However, in order to provide a clean solution, we foresee the possibility of introducing .NET specific hooks in the Dataset API for collecting data in the driver program, for example. 

      We also will be introducing Catalyst rules that will plan the physical operator (that we will introduce) for the DotnetUDF expression in the logical plan. 

      On the C# side, similar to existing language extensions, we will introduce proxy artifacts that mimic the SparkSession, Dataframe, and other APIs related to Spark SQL e.g., column, functions native to Spark SQL, etc.    

      We will also look into augmenting the existing spark-submit and spark-shell scripts with the ability to recognize a .NET environment.  

      Optional Design Sketch: 

      Our design will largely follow the design of Python Spark support, including how worker orchestration is performed (i.e., two-process solution, IPC communication). As such, we will introduce “Runners” specific to executing Dotnet driver and UDF workers.  

      Optional Rejected Designs: 

      The clear alternative is the status quo; developers that want to leverage Apache Spark do so through one of the existing supported languages i.e., Scala/Java, Python, or R. This has some costly consequences, such as: 

      • Learning a new programming language and development environment. 
      • Integrating with existing .NET technologies through complex interop. 
      • Migrating legacy code and library dependencies to a supported language. 

      Another alternative is that third-party languages should only interact with Spark via pure-SQL; possibly via REST. However, this does not enable UDFs or UDAFs written in C#; a key desideratum in this effort, which most notably takes the form of legacy code/UDFs that would need to be ported to a supported language e.g., Scala. This exercise is extremely cumbersome and not always feasible due to the code no longer being available i.e., only the compiled library exists. As mentioned earlier, the .NET developer community is one of the largest in the world, and as such there exist many instances of legacy code (e.g., machine learning routines) that would be difficult to port without the existing .NET library dependencies. 

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              imback82 Terry Kim
            • Votes:
              35 Vote for this issue
              Watchers:
              22 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 4,032h
                4,032h
                Remaining:
                Remaining Estimate - 4,032h
                4,032h
                Logged:
                Time Spent - Not Specified
                Not Specified