Skip to content

Commit d18fe60

Browse files
committed
Merge branch 'mine-main' into test_merge
2 parents 3a8f08f + 2195e37 commit d18fe60

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,7 +1955,7 @@ internal PrimitiveDataFrameColumn<bool> ElementwiseEqualsImplementation<U>(U val
19551955
{
19561956
throw new NotSupportedException();
19571957
}
1958-
return new BooleanDataFrameColumn(Name, (this as PrimitiveDataFrameColumn<bool>)._columnContainer.ElementwiseEquals(Unsafe.As<U, bool>(ref value)));
1958+
return new BooleanDataFrameColumn(Name, (this as PrimitiveDataFrameColumn<DateTime>)._columnContainer.ElementwiseEquals(Unsafe.As<U, DateTime>(ref value)));
19591959
case Type byteType when byteType == typeof(byte):
19601960
case Type charType when charType == typeof(char):
19611961
case Type doubleType when doubleType == typeof(double):
@@ -2102,7 +2102,7 @@ internal PrimitiveDataFrameColumn<bool> ElementwiseNotEqualsImplementation<U>(U
21022102
{
21032103
throw new NotSupportedException();
21042104
}
2105-
return new BooleanDataFrameColumn(Name, (this as PrimitiveDataFrameColumn<bool>)._columnContainer.ElementwiseNotEquals(Unsafe.As<U, bool>(ref value)));
2105+
return new BooleanDataFrameColumn(Name, (this as PrimitiveDataFrameColumn<DateTime>)._columnContainer.ElementwiseNotEquals(Unsafe.As<U, DateTime>(ref value)));
21062106
case Type byteType when byteType == typeof(byte):
21072107
case Type charType when charType == typeof(char):
21082108
case Type doubleType when doubleType == typeof(double):

src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ namespace Microsoft.Data.Analysis
190190
throw new NotSupportedException();
191191
}
192192
<# if (method.MethodType == MethodType.ComparisonScalar) { #>
193-
return new BooleanDataFrameColumn(Name, (this as PrimitiveDataFrameColumn<bool>)._columnContainer.<#=method.MethodName#>(Unsafe.As<U, bool>(ref value)));
193+
return new BooleanDataFrameColumn(Name, (this as PrimitiveDataFrameColumn<<#=type.TypeName#>>)._columnContainer.<#=method.MethodName#>(Unsafe.As<U, <#=type.TypeName#>>(ref value)));
194194
<# } else if (method.MethodType == MethodType.Comparison) { #>
195195
return new BooleanDataFrameColumn(Name, (this as PrimitiveDataFrameColumn<U>)._columnContainer.<#=method.MethodName#>(column._columnContainer));
196196
<# } else if (method.MethodType == MethodType.BinaryScalar) {#>

test/Microsoft.Data.Analysis.Tests/DataFrameTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,9 +625,17 @@ public void TestBinaryOperationsOnDateTimeColumn()
625625
Assert.True(equalsResult[0]);
626626
Assert.False(equalsResult[4]);
627627

628+
var equalsToScalarResult = df["DateTime1"].ElementwiseEquals(SampleDateTime);
629+
Assert.True(equalsToScalarResult[0]);
630+
Assert.False(equalsToScalarResult[1]);
631+
628632
var notEqualsResult = dataFrameColumn1.ElementwiseNotEquals(dataFrameColumn2);
629633
Assert.False(notEqualsResult[0]);
630634
Assert.True(notEqualsResult[4]);
635+
636+
var notEqualsToScalarResult = df["DateTime1"].ElementwiseNotEquals(SampleDateTime);
637+
Assert.False(notEqualsToScalarResult[0]);
638+
Assert.True(notEqualsToScalarResult[1]);
631639
}
632640

633641
[Fact]

0 commit comments

Comments
 (0)