POC - CSV Sink#71
Open
rajuGT wants to merge 8 commits into
Open
Conversation
Introduce configuration keys and defaults for the upcoming CSV sink: base path, write mode (APPEND/OVERWRITE, default OVERWRITE), date format, delimiter, header toggle, and filename prefix. Co-authored-by: Cursor <cursoragent@cursor.com>
Add FileStorageClient abstraction (read/exists/write with whole-object semantics) and a single FlinkFileSystemStorageClient implementation backed by Flink's FileSystem, so the path scheme (file/gs/oss/cosn/s3) selects the backend without any cloud-provider SDKs. Includes unit tests. Co-authored-by: Cursor <cursoragent@cursor.com>
Add FileWriteStrategy with AppendWriteStrategy (read-modify-write, time-series) and OverwriteWriteStrategy (full-replace snapshot, no-op on empty buffer), plus a factory keyed on SINK_CSV_WRITE_MODE. Both no-op when the buffer is empty. Includes tests and an in-memory storage test helper. Co-authored-by: Cursor <cursoragent@cursor.com>
Add the Flink Sink V1 CsvSink and its CsvSinkWriter, which buffers Row outputs and flushes them on every checkpoint (snapshotState) and on close. Output rolls over daily to basePath/<jobId>/<prefix>-<date>.csv. Values are RFC-4180 escaped, nulls become empty cells, and Map/Collection/array values are JSON-encoded into a single cell. A Clock is injectable for deterministic date tests. Includes CsvSinkWriterTest. Co-authored-by: Cursor <cursoragent@cursor.com>
Register SINK_TYPE=csv in SinkOrchestrator via a new CsvSinkBuilder that reads Dagger Configuration (SINK_CSV_BASE_PATH required) and assembles the sink with its write strategy and Flink filesystem storage client. Pin the CSV sink to parallelism 1 in DaggerSqlJobBuilder so a single subtask owns the daily file, leaving other sinks untouched. Add SINK_TYPE_* constants and tests for the builder and orchestrator wiring. Co-authored-by: Cursor <cursoragent@cursor.com>
Add the CSV sink to configuration.md (TOC, SINK_TYPE list, and a full CSV Sink section covering SINK_CSV_* keys with examples and defaults) and to create_dagger.md (supported-sinks list, prerequisites bullet, and a CSV Sink section with a sample properties block and OVERWRITE/APPEND guidance). Co-authored-by: Cursor <cursoragent@cursor.com>
Flush from prepareCommit instead of snapshotState: for a stateless sink (no writer-state serializer) Flink's SinkOperator never calls the writer's snapshotState, so checkpoint flushes never fired and no file was written despite healthy throughput. prepareCommit is invoked on every checkpoint (prepareSnapshotPreBarrier) and once with endOfInput=true at end of input, and close() remains a safety net. snapshotState is now a no-op. Also add INFO logging across init/flush/write (including the resolved filesystem and an error-with-rethrow on flush failure, which the job's tolerable-checkpoint-failure setting would otherwise hide) and strip all trailing slashes from SINK_CSV_BASE_PATH. Update and extend tests. Co-authored-by: Cursor <cursoragent@cursor.com>
…ON_DATE_FORMAT Format a LocalDateTime so the date pattern can carry time fields, letting the pattern's finest field decide the file rolling/partitioning granularity (yearly, daily, hourly, minutely, ...). Rename SINK_CSV_DATE_FORMAT to SINK_CSV_PARTITION_DATE_FORMAT, default to yyyy-MMM-dd-HH-mm, and validate that the pattern uses only DateTimeFormatter letters plus '-' and '_'. 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.
No description provided.