shubham-roy opened a new pull request, #2643:
URL: https://github.com/apache/phoenix/pull/2643
JIRA: https://issues.apache.org/jira/browse/PHOENIX-8032
### What changes were proposed in this pull request?
- `CREATE CDC` accepts an optional `SPLIT ON (...)` clause after its
properties, in the same position as `CREATE TABLE` and `CREATE INDEX`.
- The split points are compiled with the `CREATE CDC` statement through
`CreateTableCompiler.compileSplits`, the existing `CREATE TABLE` split
evaluation
extracted into a static method, so constants and bind parameters both work.
- `MetaDataClient.createCDC` passes them to the internal `CREATE UNCOVERED
INDEX` statement as hex literals, so the existing `CREATE INDEX` split handling
pre-splits the CDC index with exactly those bytes.
### Why are the changes needed?
The CDC index is always created with a single region, so every CDC index
write lands on that region until it splits by size. On large, write-heavy tables
that region becomes a hotspot as soon as CDC is enabled.
### Does this PR introduce _any_ user-facing change?
Yes, a new optional clause:
```sql
CREATE CDC my_cdc ON my_table SPLIT ON ('4', '8', 'c')
```
- Before: `SPLIT ON` was a syntax error for `CREATE CDC`.
- Split points apply to the CDC index row key, which starts with
`PARTITION_ID()` (`TENANT_ID` first for multi-tenant tables).
- For a CDC on a view the clause is accepted and has no effect, the same
as `CREATE INDEX ... SPLIT ON` on a view.
### How was this patch tested?
- New `QueryParserTest#testCreateCDCWithSplitPoints`, plus a clause-order
case in `testCreateCDCWithErrors`.
- New `CDCDefinitionIT#testCreateCDCWithSplitPoints`: the CDC index
regions match a mix of literal and raw byte bind split points.
- JDK 8: full `mvn clean install`, then `QueryParserTest`,
`QueryCompilerTest`, `CDCDefinitionIT`, `SkipScanAfterManualSplitIT`,
`SaltedTableIT` and
`AggregateIT` pass.
- JDK 17: the same tests pass.
- `mvn spotless:check` passes.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5.5)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]