@Test public void testQuoteWithIdentifier() { Assert.assertEquals("`abc`", FlatTableSqlQuoteUtils.quoteIdentifier("abc", null)); Assert.assertEquals("abc", FlatTableSqlQuoteUtils.quoteIdentifier("abc", FlatTableSqlQuoteUtils.NON_QUOTE_DIALECT)); Assert.assertEquals("\"abc\"", FlatTableSqlQuoteUtils.quoteIdentifier("abc", SqlDialect.DatabaseProduct.POSTGRESQL.getDialect())); Assert.assertEquals("`abc`", FlatTableSqlQuoteUtils.quoteIdentifier("abc", FlatTableSqlQuoteUtils.HIVE_DIALECT)); Assert.assertEquals("[abc]", FlatTableSqlQuoteUtils.quoteIdentifier("abc", SqlDialect.DatabaseProduct.MSSQL.getDialect())); Assert.assertEquals("`abc`", FlatTableSqlQuoteUtils.quoteIdentifier("abc", SqlDialect.DatabaseProduct.MYSQL.getDialect())); Assert.assertEquals("`abc`", FlatTableSqlQuoteUtils.quoteIdentifier(SourceDialect.MYSQL, "abc")); Assert.assertEquals("`abc`", FlatTableSqlQuoteUtils.quoteIdentifier(SourceDialect.HIVE, "abc")); Assert.assertEquals("[abc]", FlatTableSqlQuoteUtils.quoteIdentifier(SourceDialect.MSSQL, "abc")); Assert.assertEquals("\"abc\"", FlatTableSqlQuoteUtils.quoteIdentifier(SourceDialect.POSTGRESQL, "abc")); }
public static String quoteIdentifier(SourceDialect sourceDialect, String identifier) { if (!kylinConfig.enableHiveDdlQuote()) { return identifier; } SqlDialect specificSqlDialect = sqlDialectMap.get(sourceDialect.name()); if (specificSqlDialect != null) { return specificSqlDialect.quoteIdentifier(identifier); } setQuote(); return defaultDialect.quoteIdentifier(identifier); }
FlatTableSqlQuoteUtils { public static String quoteIdentifier(SourceDialect sourceDialect, String identifier) { if (!kylinConfig.enableHiveDdlQuote()) { return identifier; } SqlDialect specificSqlDialect = sqlDialectMap.get(sourceDialect.name()); if (specificSqlDialect != null) { return specificSqlDialect.quoteIdentifier(identifier); } setQuote(); return defaultDialect.quoteIdentifier(identifier); } }
FlatTableSqlQuoteUtils { public static String quoteIdentifier(SourceDialect sourceDialect, String identifier) { if (!kylinConfig.enableHiveDdlQuote()) { return identifier; } SqlDialect specificSqlDialect = sqlDialectMap.get(sourceDialect.name()); if (specificSqlDialect != null) { return specificSqlDialect.quoteIdentifier(identifier); } setQuote(); return defaultDialect.quoteIdentifier(identifier); } private  FlatTableSqlQuoteUtils(); }
FlatTableSqlQuoteUtils { public static String quoteIdentifier(SourceDialect sourceDialect, String identifier) { if (!kylinConfig.enableHiveDdlQuote()) { return identifier; } SqlDialect specificSqlDialect = sqlDialectMap.get(sourceDialect.name()); if (specificSqlDialect != null) { return specificSqlDialect.quoteIdentifier(identifier); } setQuote(); return defaultDialect.quoteIdentifier(identifier); } private  FlatTableSqlQuoteUtils(); static String quoteIdentifier(SourceDialect sourceDialect, String identifier); static String quoteIdentifier(String identifier, SqlDialect specificSqlDialect); static String quoteTableIdentity(TableRef tableRef, SqlDialect specificSqlDialect); static String quoteTableIdentity(String database, String table, SqlDialect specificSqlDialect); static String quoteIdentifierInSqlExpr(IJoinedFlatTableDesc flatDesc, String sqlExpr, SqlDialect sqlDialect); static String quoteIdentifierInSqlExpr(TableDesc tableDesc, String sqlExpr, SqlDialect sqlDialect); }
FlatTableSqlQuoteUtils { public static String quoteIdentifier(SourceDialect sourceDialect, String identifier) { if (!kylinConfig.enableHiveDdlQuote()) { return identifier; } SqlDialect specificSqlDialect = sqlDialectMap.get(sourceDialect.name()); if (specificSqlDialect != null) { return specificSqlDialect.quoteIdentifier(identifier); } setQuote(); return defaultDialect.quoteIdentifier(identifier); } private  FlatTableSqlQuoteUtils(); static String quoteIdentifier(SourceDialect sourceDialect, String identifier); static String quoteIdentifier(String identifier, SqlDialect specificSqlDialect); static String quoteTableIdentity(TableRef tableRef, SqlDialect specificSqlDialect); static String quoteTableIdentity(String database, String table, SqlDialect specificSqlDialect); static String quoteIdentifierInSqlExpr(IJoinedFlatTableDesc flatDesc, String sqlExpr, SqlDialect sqlDialect); static String quoteIdentifierInSqlExpr(TableDesc tableDesc, String sqlExpr, SqlDialect sqlDialect); static final SqlDialect NON_QUOTE_DIALECT; }