Create external input temp dir before fetch in MSQ EXTERN#19574
Open
mormigil wants to merge 1 commit into
Open
Create external input temp dir before fetch in MSQ EXTERN#19574mormigil wants to merge 1 commit into
mormigil wants to merge 1 commit into
Conversation
InputEntity#fetch creates a temp file via File.createTempFile(prefix, suffix, dir) in a caller-supplied directory. For MSQ external inputs the directory is derived lazily as <indexing-tmp>/stage_NNNNNN/external (IndexerFrameContext#tempDir -> RunWorkOrder -> ExternalInputSliceReader) and is never created, so random-access formats (Parquet, ORC, Avro-OCF, etc.) that fetch remote objects to a local temp file fail with "java.io.IOException: No such file or directory". Streaming formats (JSON/CSV) read via open() and were unaffected. This regressed in the background fetch / virtual-storage external-input rewrite (apache#19539); 32.x did not build this uncreated nested subdir. Create the directory with FileUtils.mkdirp before createTempFile, mirroring FileOutputChannelFactory#openChannel. Adds Parquet coverage to S3ExternQueryTest that exercises the real indexer fetch path (both background-fetch modes). Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
All SQL/MSQ ingestion of the form
INSERT/REPLACE … SELECT … FROM TABLE(EXTERN(...))that reads a random-access input format (Parquet, ORC, Avro-OCF, SQL, Druid-segment) from remote storage (e.g. S3) fails on the worker/peon with:Streaming formats (JSON/CSV) and
index_kafkaingestion are unaffected. This is a regression: it works in 32.x and breaks in 37.0.0.Root cause
Random-access formats download each remote object to a local temp file via
InputEntity#fetch(temporaryDirectory, …), which callsFile.createTempFile(prefix, suffix, temporaryDirectory).createTempFiledoes not create parent directories. In the MSQ indexer worker the directory is derived lazily and never created:<taskWorkDir>/indexing-tmpTaskToolbox#getIndexingTmpDir(mkdirp)…/indexing-tmp/stage_NNNNNNIndexerFrameContext#tempDir…/stage_NNNNNN/externalRunWorkOrder→frameContext.tempDir("external")→ExternalInputSliceReaderOutput channels work because
FileOutputChannelFactory#openChannelalready callsFileUtils.mkdirp(...)before writing; the input fetch path simply lacked the symmetric call. Streaming formats read viaInputEntity#open()and never create a temp file, which is why only fetch-based formats regressed. This nesting was introduced by the background-fetch / virtual-storage external-input rewrite (#19539).Fix
mkdirpthe directory inInputEntity#fetchright beforecreateTempFile, mirroringFileOutputChannelFactory#openChannel. The call is idempotent and covers every fetch-based input format.Verification
Added Parquet coverage to
S3ExternQueryTest(real embedded cluster + MinIO), exercising the actual indexer fetch path for bothbackgroundFetchExternalFileson and off.test_externParquet_backgroundFetchDisabledfails withjava.io.IOException: No such file or directory(the direct-read path; the background-fetch path stages via a localFileEntitythat skipscreateTempFile).This PR has:
Made with Cursor