user2608613
user2608613

Reputation: 452

Is there a way to read from Parquet files in hdfs into SqlContext from Mobius?

I know in Scala , you can read in a parquet file as follows:

//Create Spark Context
val sparkConf = new SparkConf().setAppName(appName).setMaster(sparkMaster)
val sc = new SparkContext(sparkConf)
val sqlContext = new SQLContext(sc)
import sqlContext.implicits._

 val pf = 
      sqlContext.read.parquet(hdfsDataUri + "test.parquet")
 pf.registerTempTable("test")

Is there a way to do this using Mobius (C# API for Spark)? I could only find a way to read in CSV files. Ref: https://github.com/Microsoft/Mobius

Upvotes: 2

Views: 2530

Answers (2)

Ivan G.
Ivan G.

Reputation: 5225

You can read and write parquet files directly in .NET via https://github.com/elastacloud/parquet-dotnet

Upvotes: 2

skaarthik
skaarthik

Reputation: 377

C# API for using Parquet in Apache Spark is available in Mobius. Following is the C# implementation of the Apache Spark Scala code in your question:

        var sparkConf = new SparkConf().SetAppName(appName).SetMaster(sparkMaster);
        var sc = new SparkContext(sparkConf);
        var sqlContext = new SqlContext(sc);
        var pf = sqlContext.Read().Parquet(hdfsDataUri + "test.parquet");
        pf.RegisterTempTable("test");

Upvotes: 2

Related Questions