Description
System Information (please complete the following information):
- OS & Version: [e.g. Windows 10] Windows 10
- ML.NET Version: [e.g. ML.NET v1.5.5] N/A
- Microsoft.Data.Analysis Version: 0.20.1
- .NET Version: [e.g. .NET 5.0]: 7.0.110
Describe the bug
Invoking ElementwiseEquals on a PrimitiveDataFrameColumn obtained by accessing DataFrame["ColumnName"] throws NullReferenceException
To Reproduce
- Create a PrimitiveDataFrameColumn with some values
- Create a dataframe with the column using its constructor
- Access the dataframe's column by using the
this[string column]
getter, es:df["ColumnName"]
- Call the ElementwiseEquals method on the column obtained through the DataFrame
- Observe that a NullReferenceException is thrown.
- Call the same method on the column passed to the DataFrame constructor.
- Observe that no exceptions are thrown
Expected behavior
df["Test"]
should behave like column
and should not throw exceptions.
Screenshots, Code, Sample Projects
Reproduction example:
#r "nuget: Microsoft.Data.Analysis, 0.20.1"
using Microsoft.Data.Analysis;
var column = new DateTimeDataFrameColumn("Test");
column.Append(DateTime.Today);
var df = new DataFrame(column);
Console.WriteLine(column == df["Test"]); // true
Console.WriteLine(column.ElementwiseEquals(DateTime.Today).Any()); // True
df["Test"].ElementwiseEquals(DateTime.Today) // Throws NullReferenceException
Stack trace
Error: System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Data.Analysis.PrimitiveDataFrameColumn1.ElementwiseEqualsImplementation[U](U value) at Microsoft.Data.Analysis.PrimitiveDataFrameColumn
1.ElementwiseEquals[U](U value)
at Submission#6.<>d__0.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray1 precedingExecutors, Func
2 currentExecutor, StrongBox1 exceptionHolderOpt, Func
2 catchExceptionOpt, CancellationToken cancellationToken)