use of com.alibaba.druid.sql.dialect.oracle.ast.clause.ModelClause.MainModelClause in project druid by alibaba.
the class OracleSelectParser method parseMainModelClause.
private void parseMainModelClause(ModelClause modelClause) {
MainModelClause mainModel = new MainModelClause();
if (identifierEquals("MAIN")) {
lexer.nextToken();
mainModel.setMainModelName(expr());
}
ModelColumnClause modelColumnClause = new ModelColumnClause();
parseQueryPartitionClause(modelColumnClause);
mainModel.setModelColumnClause(modelColumnClause);
acceptIdentifier("DIMENSION");
accept(Token.BY);
accept(Token.LPAREN);
for (; ; ) {
if (lexer.token() == Token.RPAREN) {
lexer.nextToken();
break;
}
ModelColumn column = new ModelColumn();
column.setExpr(expr());
column.setAlias(as());
modelColumnClause.getDimensionByColumns().add(column);
if (lexer.token() == Token.COMMA) {
lexer.nextToken();
continue;
}
}
acceptIdentifier("MEASURES");
accept(Token.LPAREN);
for (; ; ) {
if (lexer.token() == Token.RPAREN) {
lexer.nextToken();
break;
}
ModelColumn column = new ModelColumn();
column.setExpr(expr());
column.setAlias(as());
modelColumnClause.getMeasuresColumns().add(column);
if (lexer.token() == Token.COMMA) {
lexer.nextToken();
continue;
}
}
mainModel.setModelColumnClause(modelColumnClause);
parseCellReferenceOptions(mainModel.getCellReferenceOptions());
parseModelRulesClause(mainModel);
modelClause.setMainModel(mainModel);
}
Aggregations