Package dev.frostlake.executor.copy
Class CopyCommandExecutor
java.lang.Object
dev.frostlake.executor.copy.CopyCommandExecutor
Executes the COPY subsystem — the stage-file load (
COPY INTO <table>) and unload
(COPY INTO <stage>) paths, VALIDATION_MODE, COPY transformations, and the file/format dispatch —
on behalf of QueryExecutor. Extracted from the executor to keep its file I/O and COPY-local state
(load history, pipe-REFRESH filters) in one collaborator. The executor holds one instance and forwards its
COPY entry points here; shared stage helpers (base-dir resolution, stage-ref encoding, file listing) stay
on the executor and are called back through it.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecuteCopyRefresh(String copyStatement, String prefix, String modifiedAfter) ALTER PIPE … REFRESH: run the pipe's stored COPY, but restrict the files it loads to those whose stage-relative path starts withprefixand/or whose last-modified time is strictly aftermodifiedAfter(matching Snowflake's REFRESH PREFIX / MODIFIED_AFTER).voidforgetLoadHistory(String fullyQualifiedTableName) TRUNCATE and CREATE OR REPLACE / DROP of the table discard its history; DELETE never does.parseCsvLine(String line, char delimiter, Character enclosure, List<Boolean> enclosedOut) Split one CSV line ondelimiter, honoring an optional enclosure character (with""escaping).parseCsvLine(String line, char delimiter, Character enclosure, List<Boolean> enclosedOut, List<String> enclosedContentOut) The four-argument split plus, whenenclosedContentOutis given, each field's ENCLOSURE CONTENT — the characters between the first opening and last closing enclosure, escapes resolved, with whatever sat outside the enclosure left out.
-
Constructor Details
-
CopyCommandExecutor
-
-
Method Details
-
forgetLoadHistory
TRUNCATE and CREATE OR REPLACE / DROP of the table discard its history; DELETE never does. -
executeCopyIntoFromContext
-
executeCopyRefresh
ALTER PIPE … REFRESH: run the pipe's stored COPY, but restrict the files it loads to those whose stage-relative path starts withprefixand/or whose last-modified time is strictly aftermodifiedAfter(matching Snowflake's REFRESH PREFIX / MODIFIED_AFTER). Either filter may be null (absent). The filters are scoped to this single COPY and cleared afterwards. -
parseCsvLine
public static List<String> parseCsvLine(String line, char delimiter, Character enclosure, List<Boolean> enclosedOut) Split one CSV line ondelimiter, honoring an optional enclosure character (with""escaping). Public so the stage-query path (SELECT … FROM @stage) reads fields exactly the way COPY INTO does.enclosedOutcollects, alongside each field, whether an enclosure produced it. The flag keeps an enclosed empty ("") apart from a blank field — EMPTY_FIELD_AS_NULL nulls only the blank one — and marks the fields TRIM_SPACE must leave untrimmed (seeapplyCsvFieldOptions(java.util.List<java.lang.String>, boolean, java.util.List<java.lang.String>, boolean, java.util.List<java.lang.Boolean>, java.util.List<java.lang.String>)). It is filled in field order and stays empty when no enclosure is configured, since neither distinction can arise then. -
parseCsvLine
public static List<String> parseCsvLine(String line, char delimiter, Character enclosure, List<Boolean> enclosedOut, List<String> enclosedContentOut) The four-argument split plus, whenenclosedContentOutis given, each field's ENCLOSURE CONTENT — the characters between the first opening and last closing enclosure, escapes resolved, with whatever sat outside the enclosure left out. TRIM_SPACE needs it: the account trims spaces around the enclosure but keeps the enclosed content verbatim, so" x y "loads asx y(padding inside the quotes intact). For a field with no enclosure the content is the field itself.
-