mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-14 05:43:51 +00:00
(improvement)(Headless) define the measure without agg funciton by the model (#1864)
This commit is contained in:
@@ -89,4 +89,18 @@ public class SqlMergeWithUtils {
|
||||
SqlPrettyWriter writer = new SqlPrettyWriter(config);
|
||||
return writer.format(resultNode);
|
||||
}
|
||||
|
||||
public static boolean hasWith(EngineType engineType, String sql) throws SqlParseException {
|
||||
SqlParser.Config parserConfig = Configuration.getParserConfig(engineType);
|
||||
SqlParser parser = SqlParser.create(sql, parserConfig);
|
||||
SqlNode sqlNode = parser.parseQuery();
|
||||
SqlNode sqlSelect = sqlNode;
|
||||
if (sqlNode instanceof SqlOrderBy) {
|
||||
SqlOrderBy sqlOrderBy = (SqlOrderBy) sqlNode;
|
||||
sqlSelect = sqlOrderBy.query;
|
||||
} else if (sqlNode instanceof SqlSelect) {
|
||||
sqlSelect = (SqlSelect) sqlNode;
|
||||
}
|
||||
return sqlSelect instanceof SqlWith;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user