Skip to content

Commit

Permalink
fix oracle regular expresion too long
Browse files Browse the repository at this point in the history
  • Loading branch information
JNSimba committed Oct 30, 2024
1 parent 63cbd72 commit 5685378
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,16 @@ public DataStreamSource<String> buildCdcSource(StreamExecutionEnvironment env) {
Preconditions.checkNotNull(databaseName, "database-name in oracle is required");
Preconditions.checkNotNull(schemaName, "schema-name in oracle is required");
String tableName = config.get(OracleSourceOptions.TABLE_NAME);
// When debezium incrementally reads, it will be judged based on regexp_like.
// When the regular length exceeds 512, an error will be reported,
// like ORA-12733: regular expression too long
if (tableName.length() > 512) {
tableName = StringUtils.isNullOrWhitespaceOnly(includingTables) ? ".*" : tableName;
// When debezium incrementally reads (refer LogMinerQueryBuilder.listOfPatternsToSql),
// it will be judged based on regexp_like. When the regular length exceeds 512, an error
// will be reported, like ORA-12733: regular expression too long
if (tableName.length() > 450) {
// REGEXP_LIKE('^SCHEMA.(TBL1|TBL2)$')
if (StringUtils.isNullOrWhitespaceOnly(excludingTables)
&& (StringUtils.isNullOrWhitespaceOnly(includingTables)
|| ".*".equals(includingTables))) {
tableName = ".*";
}
}

String url = config.get(OracleSourceOptions.URL);
Expand Down

0 comments on commit 5685378

Please sign in to comment.