public Func <int, bool> GetDependencies(Func <int, bool> activeOutput) { if (Enumerable.Range(0, _parent.AddedSchema.Columns.Length).Any(activeOutput)) { // If any output column is requested, then we activate all input columns that we need. return(_typedSrc.GetDependencies(col => false)); } // Otherwise, we need no input. return(col => false); }
public DataViewRowCursor GetRowCursor(IEnumerable <DataViewSchema.Column> columnsNeeded, Random rand = null) { Host.AssertValueOrNull(rand); var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, Schema); Func <int, bool> inputPred = TypedSrc.GetDependencies(predicate); var inputCols = Input.Schema.Where(x => inputPred(x.Index)); var input = Input.GetRowCursor(inputCols, rand); return(GetRowCursorCore(input, Utils.BuildArray(Input.Schema.Count, inputCols))); }