Skip to content

arrow.enable_null_check_for_get causes change in the behavior of VarBinaryVector#getObject #469

Closed

Description

@aqni

Describe the bug, including details regarding any error messages, version, and platform.

  • version: 18.1.0
  • platform: windows, jdk17
  @Test
  void testVarbinary(){
    try(RootAllocator allocator = new RootAllocator(Long.MAX_VALUE);
        BigIntVector bigIntVector = new BigIntVector("test", allocator);
        VarBinaryVector varBinVector = new VarBinaryVector("test", allocator)){
      bigIntVector.setNull(0);
      bigIntVector.setValueCount(1);
      varBinVector.setNull(0);
      varBinVector.setValueCount(1);
      Assertions.assertNull(bigIntVector.getObject(0));
      Assertions.assertNull(varBinVector.getObject(0));
    }
  }

When I set arrow.enable_null_check_for_get to true, this test passes. However, when I set arrow.enable_null_check_for_get to false, it failed.

org.opentest4j.AssertionFailedError: 
Expected :null
Actual   :[B@73e9cf30
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertNull.failNotNull(AssertNull.java:50)
	at org.junit.jupiter.api.AssertNull.assertNull(AssertNull.java:35)
	at org.junit.jupiter.api.AssertNull.assertNull(AssertNull.java:30)
	at org.junit.jupiter.api.Assertions.assertNull(Assertions.java:279)
	at demo.MainTest.testVarbinary(MainTest.java:27)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

Why does BigIntVector's getObject always return null, while VarBinary Vector's getObject has a different behavior?

Activity

  1. added
    Type: bug
    on Dec 27, 2024
  2. lidavidm commented on Jan 3, 2025

    @lidavidm
    Member

    Because you've disabled null checking entirely, so VarBinaryVector takes it as an opportunity to skip the null check and return whatever string data happens to be in that slot (even though the slot is meant to be null, it can still have data allocated, though it is probably an empty string). BigIntVector doesn't have that optimization.

  3. lidavidm commented on Jan 3, 2025

    @lidavidm
    Member

    Arguably, in this case, BigIntVector should also be returning non-null.

  4. aqni commented on Jan 6, 2025

    @aqni
    ContributorAuthor

    Is there any plan in the future to unify the behavior of getObject when arrow.enable_null_check_for_get is set to false?

  5. lidavidm commented on Jan 6, 2025

    @lidavidm
    Member

    Contributions would be welcome. I don't think anyone is actively working on it.

  6. added a commit that references this issue on Jan 14, 2025
  7. added this to the 18.2.0 milestone on Jan 30, 2025
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

    Type: bugType: usage

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions