public Where(IXTable source, IExpression expression) : base(source) { _expression = expression; // Build a mapper to hold matching rows and remap source arrays _mapper = new RowRemapper(); // Build wrapper columns _columns = new RemappedColumn[source.Columns.Count]; for (int i = 0; i < _columns.Length; ++i) { _columns[i] = new RemappedColumn(source.Columns[i], _mapper); } }
public Join(IXTable source, string joinFromColumn, IXTable joinToSource, string joinToColumn, string joinSidePrefix) { if (source == null) { throw new ArgumentNullException("source"); } _source = source; _joinToSource = joinToSource; // Request the JoinFromColumn Getter IXColumn joinFrom = source.Columns.Find(joinFromColumn); _joinColumnType = joinFrom.ColumnDetails.Type; _joinFromColumnGetter = joinFrom.CurrentGetter(); // Request the JoinToColumn Reader (we'll need it cached) _joinToColumn = _joinToSource.Columns.Find(joinToColumn); Type joinToColumnType = _joinToColumn.ColumnDetails.Type; if (joinToColumnType != _joinColumnType) { throw new ArgumentException($"Join requires columns of matching types; join from {_joinColumnType.Name} to {joinToColumnType.Name} not supported."); } _joinToSeekGetter = _joinToColumn.SeekGetter(); // Build a remapper for left side columns _sourceJoinedRowsFilter = new RowRemapper(); // Build column wrappers _columns = new IXColumn[source.Columns.Count + joinToSource.Columns.Count]; _rightSideColumns = new SeekedColumn[joinToSource.Columns.Count]; // Left Side columns are filtered to rows that joined (inner join) for (int i = 0; i < source.Columns.Count; ++i) { _columns[i] = new RemappedColumn(source.Columns[i], _sourceJoinedRowsFilter); } // Right side columns are seeked to the right side matching rows for (int i = 0; i < joinToSource.Columns.Count; ++i) { SeekedColumn column = new SeekedColumn(RenamedColumn.Build(joinToSource.Columns[i], joinSidePrefix + joinToSource.Columns[i].ColumnDetails.Name)); _rightSideColumns[i] = column; _columns[i + source.Columns.Count] = column; } }
public Choose(IXTable source, ChooseDirection direction, IXColumn rankColumn, IList <IXColumn> keyColumns) { if (source == null) { throw new ArgumentNullException("source"); } _source = source; // Build a typed dictionary to handle the rank and key column types _dictionary = new ChooseDictionary(direction, rankColumn.ColumnDetails, keyColumns.Select((col) => col.ColumnDetails).ToArray()); // Retrieve the getters for all columns _rankColumnGetter = rankColumn.CurrentGetter(); _keyColumnGetters = keyColumns.Select((col) => col.CurrentGetter()).ToArray(); _chosenRowsFilter = new RowRemapper(); _columns = source.Columns.Select((col) => new RemappedColumn(col, _chosenRowsFilter)).ToArray(); }
// TODO: Re-add requesting more than the current desired count and paging through public RemappedColumn(IXColumn column, RowRemapper remapper) { _column = column; _remapper = remapper; }