}
for(AggregationDesc agg : gop.getConf().getAggregators()) {
// Concatenate the dependencies of all the parameters to
// create the new dependency
Dependency dep = new Dependency();
DependencyType new_type = LineageInfo.DependencyType.EXPRESSION;
// TODO: Get the actual string here.
dep.setExpr(null);
LinkedHashSet<BaseColumnInfo> bci_set = new LinkedHashSet<BaseColumnInfo>();
for(ExprNodeDesc expr : agg.getParameters()) {
Dependency expr_dep = ExprProcFactory.getExprDependency(lctx, inpOp, expr);
if (expr_dep != null) {
new_type = LineageCtx.getNewDependencyType(expr_dep.getType(), new_type);
bci_set.addAll(expr_dep.getBaseCols());
}
}
// If the bci_set is empty, this means that the inputs to this
// aggregate function were all constants (e.g. count(1)). In this case
// the aggregate function is just dependent on all the tables that are in
// the dependency list of the input operator.
if (bci_set.isEmpty()) {
Set<TableAliasInfo> tai_set = new LinkedHashSet<TableAliasInfo>();
if (inpOp.getSchema() != null && inpOp.getSchema().getSignature() != null ) {
for(ColumnInfo ci : inpOp.getSchema().getSignature()) {
Dependency inp_dep = lctx.getIndex().getDependency(inpOp, ci);
// The dependency can be null as some of the input cis may not have
// been set in case of joins.
if (inp_dep != null) {
for(BaseColumnInfo bci : inp_dep.getBaseCols()) {
new_type = LineageCtx.getNewDependencyType(inp_dep.getType(), new_type);
tai_set.add(bci.getTabAlias());
}
}
}
}