in sql-gremlin/src/main/java/org/twilmes/sql/gremlin/adapter/converter/ast/nodes/operator/aggregate/GremlinSqlAggFunction.java [75:98]
protected void appendTraversal(final GraphTraversal<?, ?> graphTraversal) throws SQLException {
if (sqlOperands.get(0) instanceof GremlinSqlBasicCall) {
((GremlinSqlBasicCall) sqlOperands.get(0)).generateTraversal(graphTraversal);
} else if (!(sqlOperands.get(0) instanceof GremlinSqlIdentifier) &&
!(sqlOperands.get(0) instanceof GremlinSqlLiteral)) {
throw SqlGremlinError.create(SqlGremlinError.UNEXPECTED_OPERAND);
}
if (sqlOperands.size() == 1) {
if (sqlOperands.get(0) instanceof GremlinSqlIdentifier) {
SqlTraversalEngine.applySqlIdentifier((GremlinSqlIdentifier) sqlOperands.get(0), sqlMetadata,
graphTraversal);
} else if (sqlOperands.get(0) instanceof GremlinSqlLiteral) {
GremlinSqlLiteral gremlinSqlLiteral = (GremlinSqlLiteral) sqlOperands.get(0);
gremlinSqlLiteral.appendTraversal(graphTraversal);
}
}
if (AGGREGATE_APPENDERS.containsKey(sqlAggFunction.kind)) {
AGGREGATE_APPENDERS.get(sqlAggFunction.kind).appendTraversal(graphTraversal, sqlOperands);
} else {
throw SqlGremlinError.create(SqlGremlinError.AGGREGATE_NOT_SUPPORTED, sqlAggFunction.kind.sql);
}
updateOutputTypeMap();
}