Beispiel #1
0
 public void TestColumnNegateOperator()
 {
     mockColumnProxy.Setup(m => m.FuncOp(It.IsAny<string>())).Returns(generatedMockColumnProxy.Object);
     Column column1 = new Column(mockColumnProxy.Object);
     Column column2 = -column1;
     Assert.AreNotEqual(column1.ColumnProxy, column2.ColumnProxy);
     mockColumnProxy.Verify(m => m.FuncOp("negate"), Times.Once);
 }
Beispiel #2
0
 public void TestColumnDivideOperator()
 {
     mockColumnProxy.Setup(m => m.BinOp(It.IsAny<string>(), It.IsAny<IColumnProxy>())).Returns(generatedMockColumnProxy.Object);
     Column column1 = new Column(mockColumnProxy.Object);
     Column column2 = new Column(mockColumnProxy.Object);
     Column column3 = column1 / column2;
     Assert.AreNotEqual(column1.ColumnProxy, column3.ColumnProxy);
     mockColumnProxy.Verify(m => m.BinOp("divide", column2.ColumnProxy), Times.Once);
 }
Beispiel #3
0
 public void TestColumnCast()
 {
     Column column1 = new Column(mockColumnProxy.Object);
     mockColumnProxy.Setup(m => m.InvokeMethod(It.IsAny<string>(), It.IsAny<object[]>()));
     column1.Cast("int");
     mockColumnProxy.Verify(m => m.InvokeMethod("cast", new object[] { "int" }), Times.Once);
 }
Beispiel #4
0
 public void TestColumnDesc()
 {
     mockColumnProxy.Setup(m => m.UnaryOp(It.IsAny<string>()));
     Column column1 = new Column(mockColumnProxy.Object);
     column1.Desc();
     mockColumnProxy.Verify(m => m.UnaryOp("desc"), Times.Once);
 }
Beispiel #5
0
        public void TestColumnAlias()
        {
            mockColumnProxy.Setup(m => m.InvokeMethod(It.IsAny<string>(), It.IsAny<string>()));
            Column column1 = new Column(mockColumnProxy.Object);
            column1.Alias("AnyAlias");
            mockColumnProxy.Verify(m => m.InvokeMethod("as", "AnyAlias"), Times.Once);

            mockColumnProxy.Setup(m => m.InvokeMethod(It.IsAny<string>(), It.IsAny<object[]>()));
            string[] array = new string[] { "AnyAlias1", "AnyAlias2" };
            column1.Alias(array);
            mockColumnProxy.Verify(m => m.InvokeMethod("as", new object[]{array}), Times.Once);
        }
Beispiel #6
0
 public void TestColumnRLike()
 {
     mockColumnProxy.Setup(m => m.BinOp(It.IsAny<string>(), It.IsAny<string>()));
     Column column1 = new Column(mockColumnProxy.Object);
     column1.RLike("AnyString");
     mockColumnProxy.Verify(m => m.BinOp("rlike", "AnyString"), Times.Once);
 }
Beispiel #7
0
 public void TestColumnEndsWith()
 {
     mockColumnProxy.Setup(m => m.BinOp(It.IsAny<string>(), It.IsAny<IColumnProxy>()));
     Column column1 = new Column(mockColumnProxy.Object);
     Column column2 = new Column(mockColumnProxy.Object);
     column1.EndsWith(column2);
     mockColumnProxy.Verify(m => m.BinOp("endsWith", column2.ColumnProxy), Times.Once);
 }
Beispiel #8
0
 public void TestColumnEquals()
 {
     var column1 = new Column(mockColumnProxy.Object);
     var column2 = new Column(mockColumnProxy.Object);
     Assert.IsTrue(column1.Equals(column2));
 }
Beispiel #9
0
        public void TestColumnGetHashCode()
        {
            var column1 = new Column(null);
            Assert.AreEqual(0, column1.GetHashCode());

            var column2 = new Column(mockColumnProxy.Object);
            Assert.AreNotEqual(0, column2.GetHashCode());
        }
Beispiel #10
0
 /// <summary>
 /// String starts with another string literal.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public Column StartsWith(Column other)
 {
     return new Column(columnProxy.BinOp("startsWith", other.columnProxy));
 }
Beispiel #11
0
 /// <summary>
 /// String ends with another string literal.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public Column EndsWith(Column other)
 {
     return new Column(columnProxy.BinOp("endsWith", other.columnProxy));
 }
Beispiel #12
0
        /// <summary>
        /// Join with another DataFrame, using the specified JoinType
        /// </summary>
        /// <param name="otherDataFrame">DataFrame to join with</param>
        /// <param name="joinExpression">Column to join with.</param>
        /// <param name="joinType">Type of join to perform (default null value means <c>JoinType.Inner</c>)</param>
        /// <returns>Joined DataFrame</returns>
        public DataFrame Join(DataFrame otherDataFrame, Column joinExpression, JoinType joinType = null)
        {
            if (joinType == null)
            {
                joinType = JoinType.Inner;
            }

            return
                new DataFrame(dataFrameProxy.Join(otherDataFrame.dataFrameProxy, joinExpression.ColumnProxy, joinType.Value), sparkContext);
        }