Skip to content

OrientDB importer silently drops composite indexes/unique constraints (and can NPE on a missing nullValuesIgnored) #6750

Closed

Description

@ruispereira

Summary

The OrientDB importer silently drops composite (multi-field) indexes, so a multi-column UNIQUE constraint enforced by the source database is lost after migration and duplicates can then be inserted. A missing optional field on the same path can also abort index creation entirely with an unboxing NPE.

Where (HEAD af4f67fd2)

integration/src/main/java/com/arcadedb/integration/importer/OrientDBImporter.java:1045-1058 (createIndexes):

final String fieldName = (String) indexDefinition.get("field");     // null for a composite index
final String[] properties = new String[]{fieldName};
boolean nullValuesIgnored = (boolean) indexDefinition.get("nullValuesIgnored");   // NPE if absent
...
if (!type.existsPolymorphicProperty(fieldName)) {
  if (keyType == null) { /* verbose warning */ ++warnings; continue; }            // index dropped

The code only understands the single-property OPropertyIndexDefinition shape. An OCompositeIndexDefinition (JSON key indexDefinitions: [...], no top-level "field"/"keyType") yields fieldName == null and keyType == null, so the index is skipped with only a verbose-level warning.

Repro

Export an OrientDB database with CREATE INDEX Person.name_surname ON Person(firstName, lastName) UNIQUE, then IMPORT DATABASE it. Expected: a composite unique index on [firstName, lastName]. Actual: no index; duplicate (firstName, lastName) pairs that OrientDB rejected are now insertable.

Secondary: if a composite indexDefinition omits nullValuesIgnored, line 1047 unboxes (boolean) null → NullPointerException, aborting createIndexes() for the whole import.

Suggested fix

Detect an indexDefinitionClass ending in OCompositeIndexDefinition and read its indexDefinitions array to build the full property list (and per-field key types); guard the nullValuesIgnored unboxing against a missing/null value.

Scope / confidence

Medium — the single-field-only code path is certain at HEAD; the exact composite JSON shape is inferred from OrientDB's exporter (the bundled orientdb-export-small.gz test resource contains only single-field OPropertyIndexDefinition entries, so this path has no coverage).

Activity

  1. added this to the 26.9.1 milestone on Aug 26, 2026
  2. added
    in progressThe team is actively working on this issue
    on Aug 26, 2026
  3. self-assigned this
    on Aug 26, 2026
  4. added 3 commits that reference this issue on Aug 26, 2026
  5. lvca commented on Aug 26, 2026

    @lvca
    Member

    Fixed in #6780, will ship in 26.9.1.

    Multi-column indexes were dropped during the import. An OrientDB CREATE INDEX Person.name_surname ON Person(firstName, lastName) UNIQUE left the migrated database with no index at all, so duplicate pairs the source database rejected became insertable. They are now imported with all their columns, and any property they need that the export did not declare is created for them.

    Two related problems on the same path are gone as well: an index definition that omits the optional nullValuesIgnored field no longer aborts the creation of every index in the import, and an index on a type that has no ArcadeDB equivalent is now skipped on its own instead of stopping the ones after it.


    ❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.

  6. removed
    in progressThe team is actively working on this issue
    on Aug 26, 2026
  7. added a commit that references this issue on Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugimporterData import module (CSV/JSON/XML/ZIP)

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions