diff --git a/src/csharp/Microsoft.Spark.E2ETest/IpcTests/Sql/DataFrameTests.cs b/src/csharp/Microsoft.Spark.E2ETest/IpcTests/Sql/DataFrameTests.cs index a8128798e..378f3b86c 100644 --- a/src/csharp/Microsoft.Spark.E2ETest/IpcTests/Sql/DataFrameTests.cs +++ b/src/csharp/Microsoft.Spark.E2ETest/IpcTests/Sql/DataFrameTests.cs @@ -489,6 +489,8 @@ public void TestSignaturesV2_3_X() _df.Show(10, 10); _df.Show(10, 10, true); + Assert.IsType(_df.ToJSON()); + Assert.IsType(_df.Join(_df)); Assert.IsType(_df.Join(_df, "name")); Assert.IsType(_df.Join(_df, new[] { "name" })); diff --git a/src/csharp/Microsoft.Spark/Sql/DataFrame.cs b/src/csharp/Microsoft.Spark/Sql/DataFrame.cs index c8caab697..80559b8a9 100644 --- a/src/csharp/Microsoft.Spark/Sql/DataFrame.cs +++ b/src/csharp/Microsoft.Spark/Sql/DataFrame.cs @@ -218,6 +218,13 @@ public DataFrameNaFunctions Na() => public DataFrameStatFunctions Stat() => new DataFrameStatFunctions((JvmObjectReference)_jvmObject.Invoke("stat")); + /// + /// Returns the content of the DataFrame as a DataFrame of JSON strings. + /// + /// DataFrame object with JSON strings. + public DataFrame ToJSON() => + WrapAsDataFrame(_jvmObject.Invoke("toJSON")); + /// /// Join with another `DataFrame`. ///