in fastmodel-parser/src/main/java/com/aliyun/fastmodel/parser/visitor/IndicatorVisitor.java [60:108]
public Node visitCreateIndicatorStatement(CreateIndicatorStatementContext ctx) {
BaseDataType baseDataType = visitIfPresent(ctx.typeDbCol(), BaseDataType.class).orElse(null);
BaseExpression baseExpression = ctx.expression() != null ? (BaseExpression)visit(ctx.expression()) : null;
List<Property> properties = getProperties(ctx.setProperties());
Optional<Comment> comment = visitIfPresent(ctx.comment(), Comment.class);
QualifiedName references = ctx.tableName() != null ? getQualifiedName(ctx.tableName()) : null;
IndicatorType indicatorType = getIndicatorType(ctx.indicatorType());
AliasedName aliasedName = visitIfPresent(ctx.alias(), AliasedName.class).orElse(null);
CreateElement createElement = CreateElement.builder()
.qualifiedName(getQualifiedName(ctx.qualifiedName()))
.properties(properties)
.comment(comment.orElse(null))
.notExists(ctx.ifNotExists() != null)
.aliasedName(aliasedName)
.createOrReplace(ctx.replace() != null)
.build();
switch (indicatorType) {
case ATOMIC:
return new CreateAtomicIndicator(
createElement,
baseDataType,
baseExpression,
references
);
case ATOMIC_COMPOSITE:
return new CreateAtomicCompositeIndicator(
createElement,
baseDataType,
baseExpression
);
case DERIVATIVE:
return new CreateDerivativeIndicator(
createElement,
baseDataType,
baseExpression,
references
);
case DERIVATIVE_COMPOSITE:
return new CreateDerivativeCompositeIndicator(
createElement,
baseDataType,
baseExpression,
references
);
default:
break;
}
return super.visitCreateIndicatorStatement(ctx);
}