@Test public void testTransform() { { String sql = "select count(*) from default.test_kylin_fact"; String s = kwDefaultHack.transform(sql, null, "DEFAULT"); Assert.assertEquals("select count(*) from \"DEFAULT\".test_kylin_fact", s); } { String sql = "select count(*) from DEFAULT.test_kylin_fact"; String s = kwDefaultHack.transform(sql, null, "DEFAULT"); Assert.assertEquals("select count(*) from \"DEFAULT\".test_kylin_fact", s); } { String sql = "select count(*) from defaulT.test_kylin_fact"; String s = kwDefaultHack.transform(sql, null, "DEFAULT"); Assert.assertEquals("select count(*) from \"DEFAULT\".test_kylin_fact", s); } { String sql = "select count(*) from defaultCatalog.default.test_kylin_fact"; String s = kwDefaultHack.transform(sql, null, "DEFAULT"); Assert.assertEquals("select count(*) from \"DEFAULT\".test_kylin_fact", s); } { String sql = "select count(*) from \"defaultCatalog\".default.test_kylin_fact"; String s = kwDefaultHack.transform(sql, null, "DEFAULT"); Assert.assertEquals("select count(*) from \"DEFAULT\".test_kylin_fact", s); } }
@Override public String transform(String sql, String project, String defaultSchema) { if (!KylinConfig.getInstanceFromEnv().isEscapeDefaultKeywordEnabled()) { return sql; } sql = sql.replaceAll("(?i)default\\.", "\"DEFAULT\"."); sql = sql.replace("defaultCatalog.", ""); sql = sql.replace("\"defaultCatalog\".", ""); return sql; }
KeywordDefaultDirtyHack implements QueryUtil.IQueryTransformer { @Override public String transform(String sql, String project, String defaultSchema) { if (!KylinConfig.getInstanceFromEnv().isEscapeDefaultKeywordEnabled()) { return sql; } sql = sql.replaceAll("(?i)default\\.", "\"DEFAULT\"."); sql = sql.replace("defaultCatalog.", ""); sql = sql.replace("\"defaultCatalog\".", ""); return sql; } }
KeywordDefaultDirtyHack implements QueryUtil.IQueryTransformer { @Override public String transform(String sql, String project, String defaultSchema) { if (!KylinConfig.getInstanceFromEnv().isEscapeDefaultKeywordEnabled()) { return sql; } sql = sql.replaceAll("(?i)default\\.", "\"DEFAULT\"."); sql = sql.replace("defaultCatalog.", ""); sql = sql.replace("\"defaultCatalog\".", ""); return sql; }  }
KeywordDefaultDirtyHack implements QueryUtil.IQueryTransformer { @Override public String transform(String sql, String project, String defaultSchema) { if (!KylinConfig.getInstanceFromEnv().isEscapeDefaultKeywordEnabled()) { return sql; } sql = sql.replaceAll("(?i)default\\.", "\"DEFAULT\"."); sql = sql.replace("defaultCatalog.", ""); sql = sql.replace("\"defaultCatalog\".", ""); return sql; }  @Override String transform(String sql, String project, String defaultSchema); }
KeywordDefaultDirtyHack implements QueryUtil.IQueryTransformer { @Override public String transform(String sql, String project, String defaultSchema) { if (!KylinConfig.getInstanceFromEnv().isEscapeDefaultKeywordEnabled()) { return sql; } sql = sql.replaceAll("(?i)default\\.", "\"DEFAULT\"."); sql = sql.replace("defaultCatalog.", ""); sql = sql.replace("\"defaultCatalog\".", ""); return sql; }  @Override String transform(String sql, String project, String defaultSchema);  }