Skip to content

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

Closed

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)

Activity

  1. ghost added
    untriagedNew issue has not been triaged
    on Sep 18, 2023
  2. changed the title [-][DataFrame] Null Reference on ElementwiseEquals[/-] [+][DataFrame] Null Reference on ElementwiseEquals on DateTime columns from DataFrame [/+] on Sep 18, 2023
  3. added a commit that references this issue on Sep 20, 2023
  4. ghost added
    in-prA pull request is open to resolve this issue
    on Sep 20, 2023
  5. ghost removed
    in-prA pull request is open to resolve this issue
    on Sep 25, 2023
  6. ghost removed
    untriagedNew issue has not been triaged
    on Sep 25, 2023
  7. added a commit that references this issue on Oct 5, 2023
  8. ghost locked as resolved and limited conversation to collaborators on Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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