Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1955,7 +1955,7 @@ internal PrimitiveDataFrameColumn<bool> ElementwiseEqualsImplementation<U>(U val
{
throw new NotSupportedException();
}
return new BooleanDataFrameColumn(Name, (this as PrimitiveDataFrameColumn<bool>)._columnContainer.ElementwiseEquals(Unsafe.As<U, bool>(ref value)));
return new BooleanDataFrameColumn(Name, (this as PrimitiveDataFrameColumn<DateTime>)._columnContainer.ElementwiseEquals(Unsafe.As<U, DateTime>(ref value)));
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
Expand Down Expand Up @@ -2102,7 +2102,7 @@ internal PrimitiveDataFrameColumn<bool> ElementwiseNotEqualsImplementation<U>(U
{
throw new NotSupportedException();
}
return new BooleanDataFrameColumn(Name, (this as PrimitiveDataFrameColumn<bool>)._columnContainer.ElementwiseNotEquals(Unsafe.As<U, bool>(ref value)));
return new BooleanDataFrameColumn(Name, (this as PrimitiveDataFrameColumn<DateTime>)._columnContainer.ElementwiseNotEquals(Unsafe.As<U, DateTime>(ref value)));
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ namespace Microsoft.Data.Analysis
throw new NotSupportedException();
}
<# if (method.MethodType == MethodType.ComparisonScalar) { #>
return new BooleanDataFrameColumn(Name, (this as PrimitiveDataFrameColumn<bool>)._columnContainer.<#=method.MethodName#>(Unsafe.As<U, bool>(ref value)));
return new BooleanDataFrameColumn(Name, (this as PrimitiveDataFrameColumn<<#=type.TypeName#>>)._columnContainer.<#=method.MethodName#>(Unsafe.As<U, <#=type.TypeName#>>(ref value)));
<# } else if (method.MethodType == MethodType.Comparison) { #>
return new BooleanDataFrameColumn(Name, (this as PrimitiveDataFrameColumn<U>)._columnContainer.<#=method.MethodName#>(column._columnContainer));
<# } else if (method.MethodType == MethodType.BinaryScalar) {#>
Expand Down
8 changes: 8 additions & 0 deletions test/Microsoft.Data.Analysis.Tests/DataFrameTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -625,9 +625,17 @@ public void TestBinaryOperationsOnDateTimeColumn()
Assert.True(equalsResult[0]);
Assert.False(equalsResult[4]);

var equalsToScalarResult = df["DateTime1"].ElementwiseEquals(SampleDateTime);
Assert.True(equalsToScalarResult[0]);
Assert.False(equalsToScalarResult[1]);

var notEqualsResult = dataFrameColumn1.ElementwiseNotEquals(dataFrameColumn2);
Assert.False(notEqualsResult[0]);
Assert.True(notEqualsResult[4]);

var notEqualsToScalarResult = df["DateTime1"].ElementwiseNotEquals(SampleDateTime);
Assert.False(notEqualsToScalarResult[0]);
Assert.True(notEqualsToScalarResult[1]);
}

[Fact]
Expand Down