mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 19:51:00 +00:00
[fix][chat&headless]Adapt to new master.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.tencent.supersonic.headless.core.pojo;
|
||||
|
||||
import com.tencent.supersonic.common.pojo.enums.EngineType;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.DatabaseResp;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.DimSchemaResp;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.MetricSchemaResp;
|
||||
@@ -31,4 +32,11 @@ public class Ontology {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public EngineType getDatabaseType() {
|
||||
if (Objects.nonNull(database)) {
|
||||
return EngineType.fromString(database.getType().toUpperCase());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -75,8 +75,7 @@ public class DefaultSemanticTranslator implements SemanticTranslator {
|
||||
tables.add(Pair.of(ontologyInnerTable, ontologyInnerSql));
|
||||
String finalSql = null;
|
||||
if (sqlQuery.isSupportWith()) {
|
||||
EngineType engineType =
|
||||
EngineType.fromString(queryStatement.getOntology().getDatabase().getType());
|
||||
EngineType engineType = queryStatement.getOntology().getDatabaseType();
|
||||
if (!SqlMergeWithUtils.hasWith(engineType, ontologyQuerySql)) {
|
||||
finalSql = "with " + tables.stream()
|
||||
.map(t -> String.format("%s as (%s)", t.getLeft(), t.getRight()))
|
||||
|
||||
Reference in New Issue
Block a user