mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-30 04:54:25 +08:00
Compare commits
1 Commits
48985f5a61
...
f4be6f65ec
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4be6f65ec |
@@ -80,9 +80,6 @@ public class Configuration {
|
|||||||
.setQuoting(Quoting.SINGLE_QUOTE).setQuotedCasing(Casing.TO_UPPER)
|
.setQuoting(Quoting.SINGLE_QUOTE).setQuotedCasing(Casing.TO_UPPER)
|
||||||
.setUnquotedCasing(Casing.TO_UPPER).setConformance(sqlDialect.getConformance())
|
.setUnquotedCasing(Casing.TO_UPPER).setConformance(sqlDialect.getConformance())
|
||||||
.setLex(Lex.BIG_QUERY);
|
.setLex(Lex.BIG_QUERY);
|
||||||
if (EngineType.HANADB.equals(engineType)) {
|
|
||||||
parserConfig = parserConfig.setQuoting(Quoting.DOUBLE_QUOTE);
|
|
||||||
}
|
|
||||||
parserConfig = parserConfig.setQuotedCasing(Casing.UNCHANGED);
|
parserConfig = parserConfig.setQuotedCasing(Casing.UNCHANGED);
|
||||||
parserConfig = parserConfig.setUnquotedCasing(Casing.UNCHANGED);
|
parserConfig = parserConfig.setUnquotedCasing(Casing.UNCHANGED);
|
||||||
return parserConfig.build();
|
return parserConfig.build();
|
||||||
|
|||||||
@@ -21,10 +21,6 @@ public class SqlDialectFactory {
|
|||||||
.withDatabaseProduct(DatabaseProduct.BIG_QUERY).withLiteralQuoteString("'")
|
.withDatabaseProduct(DatabaseProduct.BIG_QUERY).withLiteralQuoteString("'")
|
||||||
.withLiteralEscapedQuoteString("''").withUnquotedCasing(Casing.UNCHANGED)
|
.withLiteralEscapedQuoteString("''").withUnquotedCasing(Casing.UNCHANGED)
|
||||||
.withQuotedCasing(Casing.UNCHANGED).withCaseSensitive(false);
|
.withQuotedCasing(Casing.UNCHANGED).withCaseSensitive(false);
|
||||||
public static final Context HANADB_CONTEXT = SqlDialect.EMPTY_CONTEXT
|
|
||||||
.withDatabaseProduct(DatabaseProduct.BIG_QUERY).withLiteralQuoteString("'")
|
|
||||||
.withIdentifierQuoteString("\"").withLiteralEscapedQuoteString("''").withUnquotedCasing(Casing.UNCHANGED)
|
|
||||||
.withQuotedCasing(Casing.UNCHANGED).withCaseSensitive(true);
|
|
||||||
private static Map<EngineType, SemanticSqlDialect> sqlDialectMap;
|
private static Map<EngineType, SemanticSqlDialect> sqlDialectMap;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@@ -33,7 +29,6 @@ public class SqlDialectFactory {
|
|||||||
sqlDialectMap.put(EngineType.MYSQL, new SemanticSqlDialect(DEFAULT_CONTEXT));
|
sqlDialectMap.put(EngineType.MYSQL, new SemanticSqlDialect(DEFAULT_CONTEXT));
|
||||||
sqlDialectMap.put(EngineType.H2, new SemanticSqlDialect(DEFAULT_CONTEXT));
|
sqlDialectMap.put(EngineType.H2, new SemanticSqlDialect(DEFAULT_CONTEXT));
|
||||||
sqlDialectMap.put(EngineType.POSTGRESQL, new SemanticSqlDialect(POSTGRESQL_CONTEXT));
|
sqlDialectMap.put(EngineType.POSTGRESQL, new SemanticSqlDialect(POSTGRESQL_CONTEXT));
|
||||||
sqlDialectMap.put(EngineType.HANADB, new SemanticSqlDialect(HANADB_CONTEXT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SemanticSqlDialect getSqlDialect(EngineType engineType) {
|
public static SemanticSqlDialect getSqlDialect(EngineType engineType) {
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ public enum EngineType {
|
|||||||
H2(5, "h2"),
|
H2(5, "h2"),
|
||||||
POSTGRESQL(6, "postgresql"),
|
POSTGRESQL(6, "postgresql"),
|
||||||
OTHER(7, "other"),
|
OTHER(7, "other"),
|
||||||
DUCKDB(8, "duckdb"),
|
DUCKDB(8, "duckdb");
|
||||||
HANADB(9, "hanadb");
|
|
||||||
|
|
||||||
private Integer code;
|
private Integer code;
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ public class DbAdaptorFactory {
|
|||||||
dbAdaptorMap.put(EngineType.POSTGRESQL.getName(), new PostgresqlAdaptor());
|
dbAdaptorMap.put(EngineType.POSTGRESQL.getName(), new PostgresqlAdaptor());
|
||||||
dbAdaptorMap.put(EngineType.OTHER.getName(), new DefaultDbAdaptor());
|
dbAdaptorMap.put(EngineType.OTHER.getName(), new DefaultDbAdaptor());
|
||||||
dbAdaptorMap.put(EngineType.DUCKDB.getName(), new DuckdbAdaptor());
|
dbAdaptorMap.put(EngineType.DUCKDB.getName(), new DuckdbAdaptor());
|
||||||
dbAdaptorMap.put(EngineType.HANADB.getName(), new HanadbAdaptor());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DbAdaptor getEngineAdaptor(String engineType) {
|
public static DbAdaptor getEngineAdaptor(String engineType) {
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.core.adaptor.db;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class HanadbAdaptor extends DefaultDbAdaptor {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String rewriteSql(String sql) {
|
|
||||||
return sql.replaceAll("`", "\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -15,7 +15,6 @@ public class DbParameterFactory {
|
|||||||
parametersBuilder.put(EngineType.CLICKHOUSE.getName(), new ClickHouseParametersBuilder());
|
parametersBuilder.put(EngineType.CLICKHOUSE.getName(), new ClickHouseParametersBuilder());
|
||||||
parametersBuilder.put(EngineType.MYSQL.getName(), new MysqlParametersBuilder());
|
parametersBuilder.put(EngineType.MYSQL.getName(), new MysqlParametersBuilder());
|
||||||
parametersBuilder.put(EngineType.POSTGRESQL.getName(), new PostgresqlParametersBuilder());
|
parametersBuilder.put(EngineType.POSTGRESQL.getName(), new PostgresqlParametersBuilder());
|
||||||
parametersBuilder.put(EngineType.HANADB.getName(), new HanadbParametersBuilder());
|
|
||||||
parametersBuilder.put(EngineType.OTHER.getName(), new OtherParametersBuilder());
|
parametersBuilder.put(EngineType.OTHER.getName(), new OtherParametersBuilder());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.server.pojo;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
public class HanadbParametersBuilder extends DefaultParametersBuilder {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DatabaseParameter> build() {
|
|
||||||
return super.build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user