Skip to content

All DataFrame Elementwise methods uncorrectly work with NULL values #6820

Closed

Description

@asmirnov82

Describe the bug
PrimitiveColumn ElementwiseEquals, ElementwizeNotEquals and other Elementwise method ignore validity information

For example. this unit test fails as it ElementWizeEquals return true for the first item ( as 0 == null):

[Fact]
public void TestElementWiseEquals()
{
    PrimitiveDataFrameColumn<int> intColumn1 = new PrimitiveDataFrameColumn<int>("Int1", new int?[] { 0, 2, 3 });
    PrimitiveDataFrameColumn<int> intColumn2 = new PrimitiveDataFrameColumn<int>("Int2", new int?[] { null, 2, 3 });

    var results = intColumn1.ElementwiseEquals(intColumn2);

    Assert.False(results[0]);
}

Activity

  1. ghost added
    untriagedNew issue has not been triaged
    on Sep 13, 2023
  2. added
    bugSomething isn't working
    help wanted[up-for-grabs] Good issue for external contributors
    and removed
    untriagedNew issue has not been triaged
    on Sep 29, 2026
  3. rosebyte commented on Sep 29, 2026

    @rosebyte
    Member

    Triage: seems a bug, we should fix it, any help would be appreciated.

  4. adestr commented on Sep 30, 2026

    @adestr
    Contributor

    I'm happy to take a look.

    The underlying reason for this behaviour appears to be that the comparison operation acts on ReadOnlyBuffer<T>, without first checking whether the buffer contains a valid data point.

    Simple fix seems to be something like:

    b = CompareIsValid(leftBitmap, rightBitmap)
    v = arithmetic.CompareValues(left, right)
    result = Combine(b, v)
    

    Would need a careful eye on performance, of course. I'll investigate a bit further.

  5. added a commit that references this issue on Oct 18, 2026
    655f469
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

    area-DataFrameMicrosoft.Data.Analysis DataFrame APIsbugSomething isn't workinghelp wanted[up-for-grabs] Good issue for external contributorsin-prA pull request is open to resolve this issueyellowmaintenance only

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions