Skip to content

Primitive DataFrame Column Clone method crashes with IEnumerable argument #6821

@asmirnov82

Description

@asmirnov82

public PrimitiveDataFrameColumn Clone(IEnumerable mapIndices) - crashes with System.ArgumentOutOfRangeException: 'rowIndex Parameter name: Index cannot be greater than the Column's Length' exception

Simple unti test:

[Fact]
public void TestNotNullableColumnCloneWithIndicesMapAsEnumerable()
{
    //Arrange
    var column = new Int32DataFrameColumn("Int column", values: new[] { 0, 5, 2, 4, 1, 3 });
    var indicesMap = new long[] { 0, 1, 2, 5, 3, 4 };

    //Act
    var clonedColumn = column.Clone(indicesMap);

    //Assert
    Assert.NotSame(column, clonedColumn);
    Assert.Equal(column.Name, clonedColumn.Name);
    Assert.Equal(column.DataType, clonedColumn.DataType);
    Assert.Equal(column.NullCount, clonedColumn.NullCount);
    Assert.Equal(indicesMap.Length, clonedColumn.Length);

    for (int i = 0; i < indicesMap.Length; i++)
        Assert.Equal(column[indicesMap[i]], clonedColumn[i]);
}

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