private void OptimizeFilters(IJournalCore journal, IReadTransactionContext tx) { if (_andFilters != null) { _andFilters.Sort(new DescendingCardinalityComparer(journal, tx)); } }
public long GetCardinality(IJournalCore journal, IReadTransactionContext tx) { if (_keys == null) { return(_journal.QueryStatistics.GetColumnDistinctCardinality(tx, _column)); } return(_keys.Count); }
public long Cardinality(IJournalCore journal, IReadTransactionContext tx) { if (!_cardinality.HasValue) { _cardinality = journal.QueryStatistics.GetColumnDistinctCardinality(tx, _column); } return(_cardinality.Value); }
public IEnumerable <long> Execute(IJournalCore journal, IReadTransactionContext tx, ERowIDSortDirection sortDirection) { var intervalFilter = new PartitionIntervalIterator(); var symbolFilter = new LatestByFilter <T>(journal, _column, _keys); return(Timestamps.AllIntervals.Reverse().SelectMany(interval => symbolFilter.Filter(intervalFilter.IteratePartitions( tx.ReverseReadPartitions, interval, tx), tx, sortDirection) )); }
public long Cardinality(IJournalCore journal, IReadTransactionContext tx) { if (!_caridnality.HasValue) { var intervalFilter = new PartitionIntervalIterator(); _caridnality = Timestamps .AllIntervals .Sum(p => intervalFilter.IteratePartitions(tx.ReadPartitions, p, tx).Sum(p2 => p2.High - p2.Low)); } return(_caridnality.Value); }
public long Cardinality(IJournalCore journal, IReadTransactionContext tx) { if (!_cardin.HasValue) { if (_andFilters != null) { _cardin = _andFilters.Min(f => f.GetCardinality(journal, tx)); } else { _cardin = long.MaxValue; } } return(_cardin.Value); }
public IEnumerable <long> Execute(IJournalCore journal, IReadTransactionContext tx, ERowIDSortDirection sort) { var intervalFilter = new PartitionIntervalIterator(); if (sort == ERowIDSortDirection.Desc) { return(Timestamps.AllIntervals.Reverse().SelectMany( interval => GetIdsDesc( intervalFilter.IteratePartitions( tx.ReadPartitions.Reverse(), interval, tx)) )); } return(Timestamps.AllIntervals.SelectMany( interval => GetIdsAsc( intervalFilter.IteratePartitions(tx.ReadPartitions, interval, tx)) )); }
public IEnumerable <long> Execute(IJournalCore journal, IReadTransactionContext tx, ERowIDSortDirection sort) { // Timestamp restricted if (_left is TimestampRangePlanItem) { return(_right.Execute(journal, tx, sort)); } if (_right is TimestampRangePlanItem) { return(_left.Execute(journal, tx, sort)); } if (_left.Cardinality(journal, tx) < _right.Cardinality(journal, tx)) { return(Intersect(_left.Execute(journal, tx, sort), _right.Execute(journal, tx, sort), sort)); } return(Intersect(_right.Execute(journal, tx, sort), _left.Execute(journal, tx, sort), sort)); }
public IEnumerable <long> Execute(IJournalCore journal, IReadTransactionContext tx, ERowIDSortDirection sort) { var intervalFilter = new PartitionIntervalIterator(); var intervals = Timestamps.AllIntervals.SelectMany( i => intervalFilter.IteratePartitions(tx.ReadPartitions, i, tx)).ToList(); if (sort == ERowIDSortDirection.Desc) { intervals.Reverse(); } if (_partitionFilter != null) { if (_andFilters == null) { return(_partitionFilter.Filter(intervals, tx, sort)); } OptimizeFilters(journal, tx); return(ApplyFilters(_partitionFilter.Filter(intervals, tx, sort), tx)); } OptimizeFilters(journal, tx); return(FilterRowsRange(tx, intervals, sort)); }
public ResultSetBuilder(IJournalCore journal, IReadTransactionContext tx) { _journal = journal; _tx = tx; _planHead = new TimestampRangePlanItem(DateInterval.Any); }
internal ExpressionEvaluatorVisitor(IJournalCore journal, IReadTransactionContext tx, Type itemType) { _journal = journal; _tx = tx; _itemType = itemType; }
public RecordQuery(IJournalCore journal, IReadTransactionContext tx) { _journal = journal; _tx = tx; }
public LatestByFilter(IJournalCore journal, IColumnMetadata column, IList <T> keys) { _journal = journal; _column = column; _keys = keys; }
public JournalQueryProvider(IJournalCore journal, IReadTransactionContext tx) { _journal = journal; _tx = tx; }
public RowScanPlanItem(IJournalCore journal, IReadTransactionContext tx) { _journal = journal; _tx = tx; Timestamps = new DateRange(); }
public DescendingCardinalityComparer(IJournalCore journal, IReadTransactionContext rtx) { _journal = journal; _rtx = rtx; }
internal ExpressionEvaluatorVisitor(IJournalCore journal, IReadTransactionContext tx, QlParameter[] parameters) { _journal = journal; _tx = tx; _parameters = parameters; }
public override long GetCardinality(IJournalCore journal, IReadTransactionContext tx) { return(long.MaxValue); }
public QueryPlanBinder(IJournalCore journal, IReadTransactionContext tx) { _journal = journal; _tx = tx; }
public override long GetCardinality(IJournalCore journal, IReadTransactionContext tx) { return(journal.QueryStatistics.GetCardinalityByColumnValue(tx, _column, _values ?? new[] { _value })); }
public abstract long GetCardinality(IJournalCore journal, IReadTransactionContext tx);
public long Cardinality(IJournalCore journal, IReadTransactionContext tx) { return(Math.Min(_left.Cardinality(journal, tx), _right.Cardinality(journal, tx))); }
public IEnumerable <long> Execute(IJournalCore journal, IReadTransactionContext tx, ERowIDSortDirection sort) { return(MergeDistinct(_left.Execute(journal, tx, sort), _right.Execute(journal, tx, sort), sort)); }