@Test public void testRemoveSampleClauseFromQuery() { String q1Expected = "SELECT * FROM x WHERE 1=1"; String q2Expected = "SELECT * FROM x WHERE 1=1 AND x.a < 10"; String q3Expected = "SELECT * FROM x WHERE x.a < 10 AND 1=1"; String q4Expected = "SELECT * FROM x WHERE x.a < 10 AND 1=1 AND x.b = 20"; String q1Parsed = oracleExtractor.removeSampleClauseFromQuery(QUERY_1); String q2Parsed = oracleExtractor.removeSampleClauseFromQuery(QUERY_2); String q3Parsed = oracleExtractor.removeSampleClauseFromQuery(QUERY_3); String q4Parsed = oracleExtractor.removeSampleClauseFromQuery(QUERY_4); assertEquals(q1Parsed, q1Expected); assertEquals(q2Parsed, q2Expected); assertEquals(q3Parsed, q3Expected); assertEquals(q4Parsed, q4Expected); }
@Override public String removeSampleClauseFromQuery(String query) { if (StringUtils.isBlank(query)) { return null; } Matcher matcher = SAMPLE_CLAUSE_PATTERN.matcher(query); if (matcher.matches()) { query = query.replace(matcher.group(1), EMPTY_CONDITION); } return query; }
OracleExtractor extends JdbcExtractor { @Override public String removeSampleClauseFromQuery(String query) { if (StringUtils.isBlank(query)) { return null; } Matcher matcher = SAMPLE_CLAUSE_PATTERN.matcher(query); if (matcher.matches()) { query = query.replace(matcher.group(1), EMPTY_CONDITION); } return query; } }
OracleExtractor extends JdbcExtractor { @Override public String removeSampleClauseFromQuery(String query) { if (StringUtils.isBlank(query)) { return null; } Matcher matcher = SAMPLE_CLAUSE_PATTERN.matcher(query); if (matcher.matches()) { query = query.replace(matcher.group(1), EMPTY_CONDITION); } return query; } OracleExtractor(WorkUnitState workUnitState); }
OracleExtractor extends JdbcExtractor { @Override public String removeSampleClauseFromQuery(String query) { if (StringUtils.isBlank(query)) { return null; } Matcher matcher = SAMPLE_CLAUSE_PATTERN.matcher(query); if (matcher.matches()) { query = query.replace(matcher.group(1), EMPTY_CONDITION); } return query; } OracleExtractor(WorkUnitState workUnitState); @Override List<Command> getSchemaMetadata(String schema, String entity); @Override List<Command> getHighWatermarkMetadata(String schema, String entity, String watermarkColumn,
      List<Predicate> predicateList); @Override List<Command> getCountMetadata(String schema, String entity, WorkUnit workUnit, List<Predicate> predicateList); @Override List<Command> getDataMetadata(String schema, String entity, WorkUnit workUnit, List<Predicate> predicateList); @Override Map<String, String> getDataTypeMap(); @Override long exractSampleRecordCountFromQuery(String query); @Override String removeSampleClauseFromQuery(String query); @Override String constructSampleClause(); @Override Iterator<JsonElement> getRecordSetFromSourceApi(String schema, String entity, WorkUnit workUnit,
      List<Predicate> predicateList); @Override String getConnectionUrl(); @Override String getWatermarkSourceFormat(WatermarkType watermarkType); @Override String getHourPredicateCondition(String column, long value, String valueFormat, String operator); @Override String getDatePredicateCondition(String column, long value, String valueFormat, String operator); @Override String getTimestampPredicateCondition(String column, long value, String valueFormat, String operator); }
OracleExtractor extends JdbcExtractor { @Override public String removeSampleClauseFromQuery(String query) { if (StringUtils.isBlank(query)) { return null; } Matcher matcher = SAMPLE_CLAUSE_PATTERN.matcher(query); if (matcher.matches()) { query = query.replace(matcher.group(1), EMPTY_CONDITION); } return query; } OracleExtractor(WorkUnitState workUnitState); @Override List<Command> getSchemaMetadata(String schema, String entity); @Override List<Command> getHighWatermarkMetadata(String schema, String entity, String watermarkColumn,
      List<Predicate> predicateList); @Override List<Command> getCountMetadata(String schema, String entity, WorkUnit workUnit, List<Predicate> predicateList); @Override List<Command> getDataMetadata(String schema, String entity, WorkUnit workUnit, List<Predicate> predicateList); @Override Map<String, String> getDataTypeMap(); @Override long exractSampleRecordCountFromQuery(String query); @Override String removeSampleClauseFromQuery(String query); @Override String constructSampleClause(); @Override Iterator<JsonElement> getRecordSetFromSourceApi(String schema, String entity, WorkUnit workUnit,
      List<Predicate> predicateList); @Override String getConnectionUrl(); @Override String getWatermarkSourceFormat(WatermarkType watermarkType); @Override String getHourPredicateCondition(String column, long value, String valueFormat, String operator); @Override String getDatePredicateCondition(String column, long value, String valueFormat, String operator); @Override String getTimestampPredicateCondition(String column, long value, String valueFormat, String operator);  }