Diveyam-Mishra opened a new pull request, #4893: URL: https://github.com/apache/calcite/pull/4893
## Jira Link [CALCITE-4460](https://issues.apache.org/jira/browse/CALCITE-4460) ## Changes Proposed This PR adds support for custom field delimiters (separators) in the Calcite **file adapter**. Previously, the adapter hardcoded comma (`,`) as the only separator, preventing use of other common delimiters like pipes (`|`) or tabs. ### What changed - **`CsvTableFactory`**: Parses an optional `"separator"` operand from the model JSON. Validates it is exactly one character; rejects multi-character values with `IllegalArgumentException`. - **`CsvTable`**: Added `separator` field and a new constructor that accepts it. Passes separator to `CsvEnumerator.deduceRowType()`. - **`CsvTranslatableTable`**: Added separator constructor; passes separator to `CsvEnumerator` in `project()`. - **`CsvEnumerator`**: Added separator parameter to constructors, `openCsv()`, and `deduceRowType()`. Uses `CSVReader(reader, separator)`. - **`CsvStreamReader`**: Added package-private constructor `CsvStreamReader(Source, char)`. All existing constructors default separator to `CSVParser.DEFAULT_SEPARATOR` (comma), preserving full backward compatibility. ### Scope Per guidance from @julianhyde, changes are limited to the **file adapter only**. The CSV adapter (example code) is kept simple and unchanged. ### Example configuration ```json { "version": "1.0", "defaultSchema": "TEST", "schemas": [ { "name": "TEST", "tables": [ { "name": "MY_TABLE", "type": "custom", "factory": "org.apache.calcite.adapter.file.CsvTableFactory", "operand": { "file": "data.psv", "separator": "|" } } ] } ] } ``` Tests added testCsvCustomSeparatorPipe — reads pipe-delimited data, verifies correct parsing testCsvCustomSeparatorInvalidMultiChar — verifies multi-character separator is rejected testCsvDefaultSeparatorBackwardCompat — verifies omitting separator defaults to comma -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
