diff --git a/src/csharp/Microsoft.Spark.E2ETest/IpcTests/Sql/ColumnTests.cs b/src/csharp/Microsoft.Spark.E2ETest/IpcTests/Sql/ColumnTests.cs
index 53a52c95..59fa6df9 100644
--- a/src/csharp/Microsoft.Spark.E2ETest/IpcTests/Sql/ColumnTests.cs
+++ b/src/csharp/Microsoft.Spark.E2ETest/IpcTests/Sql/ColumnTests.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using Microsoft.Spark.E2ETest.Utils;
using Microsoft.Spark.Sql;
using Xunit;
using static Microsoft.Spark.Sql.Expressions.Window;
@@ -143,5 +144,18 @@ namespace Microsoft.Spark.E2ETest.IpcTests
Assert.Equal("col2", col2.ToString());
}
+ ///
+ /// Test signatures for APIs introduced in Spark 3.1.*.
+ ///
+ [SkipIfSparkVersionIsLessThan(Versions.V3_1_0)]
+ public void TestSignaturesV3_1_X()
+ {
+ Column col = Column("col");
+
+ Assert.IsType(col.WithField("col2", Lit(3)));
+
+ Assert.IsType(col.DropFields("col"));
+ Assert.IsType(col.DropFields("col", "col2"));
+ }
}
}
diff --git a/src/csharp/Microsoft.Spark/Sql/Column.cs b/src/csharp/Microsoft.Spark/Sql/Column.cs
index f1f0f24b..d75fc01a 100644
--- a/src/csharp/Microsoft.Spark/Sql/Column.cs
+++ b/src/csharp/Microsoft.Spark/Sql/Column.cs
@@ -450,6 +450,31 @@ namespace Microsoft.Spark.Sql
return ApplyMethod("getItem", key);
}
+ ///
+ /// An expression that adds/replaces field in by name.
+ ///
+ /// The name of the field
+ /// Column to assign to the field
+ ///
+ /// New column after adding/replacing field in by name.
+ ///
+ [Since(Versions.V3_1_0)]
+ public Column WithField(string fieldName, Column column)
+ {
+ return ApplyMethod("withField", fieldName, column);
+ }
+
+ ///
+ /// An expression that drops fields in by name.
+ ///
+ /// Name of fields to drop.
+ /// New column after after dropping fields.
+ [Since(Versions.V3_1_0)]
+ public Column DropFields(params string[] fieldNames)
+ {
+ return ApplyMethod("dropFields", fieldNames);
+ }
+
///
/// An expression that gets a field by name in a `StructType`.
///