Skip to content

[spark] Record the target external path for data files copied by sys.copy - #11448

Merged
JingsongLi merged 1 commit into
apache:masterfrom
LuciferYang:fix/copy-files-external-path
Nov 27, 2026
Merged

JingsongLi merged 1 commit into
apache:masterfrom
LuciferYang:fix/copy-files-external-path

Conversation

@LuciferYang

Copy link
Copy Markdown
Contributor

Purpose

close #11447

sys.copy writes each data file to the path chosen by the target table, which is the target's external directory when the target sets data-file.external-paths. CopyFilesUtil.toNewDataFileMeta still derived the new externalPath from the source file's external directory. Whenever the source or the target used external paths, the committed meta pointed to a file that did not exist.

The copied meta now records the target path when the target factory writes to an external path, and no external path otherwise. #11248 made the same change for index files. The unused externalPathDir helper is removed.

Tests

  • CopyFilesProcedureTest "data files and external paths": copies between tables with external paths on the target only, the source only, and both, then checks each copied meta and reads the target. It fails on master.
  • CopyFilesUtilTest#testCopiedDataFileTakesTheExternalPathOfTheTarget: a source file with an external path keeps the target path when copied to an external target, and none when copied to a bucket directory.

@JingsongLi
JingsongLi merged commit 5efb856 into apache:master Nov 27, 2026
11 of 13 checks passed
@LuciferYang

Copy link
Copy Markdown
Contributor Author

Thank you @JingsongLi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants