Skip to content

Table Creation Fails with 500 when OPTIMIZED_SIBLING_CHECK=true with JDBC Persistence #3378

@HonahX

Description

@HonahX

Describe the bug

OPTIMIZED_SIBLING_CHECK was added in #1686 aims to accelerate the sibling check for potential table location overlap. However, it seems the feature is currently broken in JDBC Persistence, that any table creation will encounter:

java.lang.ClassCastException: class org.apache.polaris.core.entity.PolarisBaseEntity cannot be cast to class org.apache.polaris.core.entity.LocationBasedEntity
    at org.apache.polaris.persistence.relational.jdbc.JdbcBasePersistenceImpl.hasOverlappingSiblings(JdbcBasePersistenceImpl.java:802)
    at org.apache.polaris.core.persistence.AtomicOperationMetaStoreManager.hasOverlappingSiblings(AtomicOperationMetaStoreManager.java:1881)
    at org.apache.polaris.service.catalog.iceberg.IcebergCatalog.validateNoLocationOverlap(IcebergCatalog.java:1095)
    at org.apache.polaris.service.catalog.iceberg.IcebergCatalog.validateNoLocationOverlap(IcebergCatalog.java:1003)
    at org.apache.polaris.service.catalog.iceberg.IcebergCatalog$BasePolarisTableOperations.lambda$doCommit$1(IcebergCatalog.java:1469)

To Reproduce

To reproduce, set ALLOW_OPTIMIZED_SIBLING_CHECK=true and OPTIMIZED_SIBLING_CHECK=true and run any create table statement, for example, add an integration test that have jdbc enabled

@TestProfile(JdbcSparkOptimizedSiblingCheckIT.Profile.class)
@QuarkusIntegrationTest
public class JdbcSparkOptimizedSiblingCheckIT extends PolarisSparkIntegrationTest {

  public static class Profile extends RelationalJdbcProfile {
    @Override
    public Map<String, String> getConfigOverrides() {
      Map<String, String> overrides = new HashMap<>(super.getConfigOverrides());
      overrides.put("polaris.features.\"ALLOW_OPTIMIZED_SIBLING_CHECK\"", "true");
      overrides.put("polaris.features.\"OPTIMIZED_SIBLING_CHECK\"", "true");
      return overrides;
    }
  }
}

Actual Behavior

No response

Expected Behavior

No response

Additional context

No response

System information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions