Skip to content

[DataFrame] Null Reference on ElementwiseEquals on DateTime columns from DataFrame  #6829

Closed
@novelhawk

Description

@novelhawk

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

  1. Create a PrimitiveDataFrameColumn with some values
  2. Create a dataframe with the column using its constructor
  3. Access the dataframe's column by using the this[string column] getter, es: df["ColumnName"]
  4. Call the ElementwiseEquals method on the column obtained through the DataFrame
  5. Observe that a NullReferenceException is thrown.
  6. Call the same method on the column passed to the DataFrame constructor.
  7. 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.PrimitiveDataFrameColumn1.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, Func2 currentExecutor, StrongBox1 exceptionHolderOpt, Func2 catchExceptionOpt, CancellationToken cancellationToken)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions