Skip to content

[Bug] sys.copy records the wrong external path for copied data files #11447

Backlog

Description

@LuciferYang

Search before asking

  • I searched in the issues and found nothing similar.

Paimon version

master (4dc01ac)

Compute Engine

Spark, sys.copy

Minimal reproduce step

  1. Create a source table without external paths and a target table with 'data-file.external-paths' = '<dir>' and 'data-file.external-paths.strategy' = 'round-robin'.
  2. Insert rows into the source and run CALL sys.copy(source_table => 'src', target_table => 'dst').
  3. Read the target.

What doesn't meet your expectations?

The procedure returns true, but the copied data files are committed with an empty externalPath, while the bytes were written to the target's external directory. The target table then fails to read them. The mirror case also breaks: when the source uses external paths and the target does not, the copied metas point into the source's external directory.

ListDataFilesOperator writes each copy to the path returned by the target's DataFilePathFactory, but CopyFilesUtil.toNewDataFileMeta builds the new externalPath from the source meta's external directory.

Expected: the copied meta records where the copy was written, as #11248 already does for index files.

Anything else?

The Flink copy action writes copies to the warehouse path and clears externalPath, so it is not affected.

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions