Diveyam-Mishra opened a new pull request, #4782:
URL: https://github.com/apache/calcite/pull/4782
# Title: [FILE] Support custom separator in CSV adapter
## Description
This PR adds support for custom field delimiters (separators) in the CSV
adapter. previously, the adapter hardcoded the comma (`,`) as the separator,
preventing the use of other common delimiters like pipes (`|`) or tabs (`\t`).
## Changes
- Modified [CsvTableFactory] to parse an optional `separator` property from
the operand map.
- Updated [CsvTable], [CsvTranslatableTable], and [CsvEnumerator] to
propagate the separator character down to the reader.
- Updated `CsvStreamReader` to accept a custom separator in its constructor.
- Defaults to comma (`,`) if no separator is specified, preserving backward
compatibility.
## Example Configuration
Users can now specify a `separator` in their model JSON:
```json
{
"version": "1.0",
"defaultSchema": "TEST",
"schemas": [
{
"name": "TEST",
"type": "custom",
"factory": "org.apache.calcite.adapter.file.CsvTableFactory",
"operand": {
"file": "data.csv",
"separator": "|"
}
}
]
}
--
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]