Example #1
0
 public MarkDistinctNode(PlanNodeId id, PlanNode source, Symbol markerSymbol, IEnumerable <Symbol> distinctSymbols, Symbol hashSymbol) : base(id)
 {
     this.Source          = source;
     this.MarkerSymbol    = markerSymbol;
     this.HashSymbol      = hashSymbol;
     this.DistinctSymbols = distinctSymbols ?? throw new ArgumentNullException("distinctSymbols");
 }
Example #2
0
        public AggregationNode(
            PlanNodeId id,
            PlanNode source,
            IDictionary <string, Aggregation> aggregations,
            IEnumerable <List <Symbol> > groupingSets,
            Step step,
            Symbol hashSymbol,
            Symbol groupIdSymbol) : base(id)
        {
            this.Source       = source;
            this.Aggregations = aggregations;

            if (groupingSets == null)
            {
                throw new ArgumentNullException("groupingSets");
            }

            if (!groupingSets.Any())
            {
                throw new ArgumentException("Grouping sets cannot be empty.", "groupingSets");
            }

            this.GroupingSets  = groupingSets;
            this.Step          = step;
            this.HashSymbol    = hashSymbol;
            this.GroupIdSymbol = groupIdSymbol;

            this.Outputs = this.GetGroupingKeys().Concat(this.Aggregations.Keys.Select(x => new Symbol(x)));

            if (this.HashSymbol != null)
            {
                this.Outputs = this.Outputs.Concat(new Symbol[] { this.HashSymbol });
            }
        }
Example #3
0
        public WindowNode(
            PlanNodeId id,
            PlanNode source,
            Specification specification,
            IDictionary <string, Function> windowFunctions,
            Symbol hashSymbol,
            HashSet <Symbol> prePartitionedInputs,
            int preSortedOrderPrefix
            ) : base(id)
        {
            this.Source = source ?? throw new ArgumentNullException("source");
            this.PrePartitionedInputs = prePartitionedInputs;
            this.Specification        = specification ?? throw new ArgumentNullException("specification");
            this.PreSortedOrderPrefix = preSortedOrderPrefix;

            ParameterCheck.Check(this.PrePartitionedInputs.All(x => this.Specification.PartitionBy.Contains(x)), "Prepartitioned inputs must be contained in partitionBy.");


            ParameterCheck.Check(preSortedOrderPrefix == 0 ||
                                 (this.Specification.OrderingScheme != null && this.PreSortedOrderPrefix <= this.Specification.OrderingScheme.OrderBy.Count()), "Cannot have sorted more symbols than those requested.");
            ParameterCheck.Check(preSortedOrderPrefix == 0 || this.PrePartitionedInputs.Equals(this.Specification.PartitionBy),
                                 "Presorted order prefix can only be greater than zero if all partition symbols are pre-partitioned");

            this.WindowFunctions = windowFunctions ?? throw new ArgumentNullException("windowFunctions");
            this.HashSymbol      = hashSymbol;
        }
Example #4
0
 public DeleteNode(PlanNodeId id, PlanNode source, DeleteHandle target, Symbol rowId, IEnumerable <Symbol> outputs) : base(id)
 {
     this.Source  = source ?? throw new ArgumentNullException("source");
     this.Target  = target ?? throw new ArgumentNullException("target");
     this.RowId   = rowId ?? throw new ArgumentNullException("rowId");
     this.Outputs = outputs ?? throw new ArgumentNullException("outputs");
 }
Example #5
0
        public JoinNode(
            PlanNodeId id,
            JoinType type,
            PlanNode left,
            PlanNode right,
            IEnumerable <EquiJoinClause> criteria,
            IEnumerable <Symbol> outputSymbols,
            dynamic filter,
            Symbol leftHashSymbol,
            Symbol rightHashSymbol,
            DistributionType distributionType
            ) : base(id)
        {
            this.Type             = type;
            this.Left             = left ?? throw new ArgumentNullException("left");
            this.Right            = right ?? throw new ArgumentNullException("right");
            this.Criteria         = criteria ?? throw new ArgumentNullException("criteria");
            this.OutputSymbols    = outputSymbols ?? throw new ArgumentNullException("outputSymbols");
            this.Filter           = filter;
            this.LeftHashSymbol   = leftHashSymbol;
            this.RightHashSymbol  = rightHashSymbol;
            this.DistributionType = distributionType;

            HashSet <Symbol> InputSymbols = new HashSet <Symbol>(this.Left.GetOutputSymbols().Concat(this.Right.GetOutputSymbols()));

            ParameterCheck.Check(this.OutputSymbols.All(x => InputSymbols.Contains(x)), "Left and right join inputs do not contain all output symbols.");

            ParameterCheck.Check(!this.IsCrossJoin() || InputSymbols.Equals(this.OutputSymbols), "Cross join does not support output symbols pruning or reordering.");

            ParameterCheck.Check(!(!this.Criteria.Any() && this.LeftHashSymbol != null), "Left hash symbol is only valid in equijoin.");
            ParameterCheck.Check(!(!this.Criteria.Any() && this.RightHashSymbol != null), "Right hash symbol is only valid in equijoin.");
        }
Example #6
0
        public LimitNode(PlanNodeId id, PlanNode source, long count, bool partial) : base(id)
        {
            ParameterCheck.OutOfRange(count >= 0, "count", "Count cannot be less than 0.");

            this.Source = source ?? throw new ArgumentNullException("source");
            this.Count  = count;
        }
Example #7
0
 public UnnestNode(PlanNodeId id, PlanNode source, IEnumerable <Symbol> replicateSymbols, IDictionary <string, List <Symbol> > unnestSymbols, Symbol ordinalitySymbol) : base(id)
 {
     this.Source           = source ?? throw new ArgumentNullException("source");
     this.ReplicateSymbols = replicateSymbols ?? throw new ArgumentNullException("replicateSymbols");
     this.UnnestSymbols    = unnestSymbols ?? throw new ArgumentNullException("unnestSymbols");
     this.OrdinalitySymbol = ordinalitySymbol;
 }
Example #8
0
 public RowNumberNode(PlanNodeId id, PlanNode source, IEnumerable <Symbol> partitionBy, Symbol rowNumberSymbol, int maxRowCountPerPartition, Symbol hashSymbol) : base(id)
 {
     this.Source                  = source ?? throw new ArgumentNullException("source");
     this.PartitionBy             = partitionBy ?? throw new ArgumentNullException("partitionBy");
     this.RowNumberSymbol         = rowNumberSymbol ?? throw new ArgumentNullException("rowNumberSymbol");
     this.MaxRowCountPerPartition = maxRowCountPerPartition;
     this.HashSymbol              = hashSymbol; // ?? throw new ArgumentNullException("hashSymbol");
 }
Example #9
0
 public ApplyNode(PlanNodeId id, PlanNode input, PlanNode subquery, Assignments subqueryAssignments, IEnumerable <Symbol> correlation, Node originSubquery) : base(id)
 {
     this.Input               = input ?? throw new ArgumentNullException("input");
     this.SubQuery            = subquery ?? throw new ArgumentNullException("subquery");
     this.SubqueryAssignments = subqueryAssignments ?? throw new ArgumentNullException("subqueryAssignments");
     this.Correlation         = correlation ?? throw new ArgumentNullException("correlation");
     this.OriginSubquery      = originSubquery ?? throw new ArgumentNullException("originSubquery");
 }
Example #10
0
        public LateralJoinNode(PlanNodeId id, PlanNode input, PlanNode subquery, IEnumerable <Symbol> correlation, Node originSubquery) : base(id)
        {
            this.Input          = input ?? throw new ArgumentNullException("input");
            this.Subquery       = subquery ?? throw new ArgumentNullException("subquery");
            this.Correlation    = correlation ?? throw new ArgumentNullException("correlation");
            this.OriginSubquery = originSubquery ?? throw new ArgumentNullException("originSubquery");

            ParameterCheck.Check(this.Correlation.All(x => this.Input.GetOutputSymbols().Contains(x)), "Input does not contain symbol from correlation.");
        }
Example #11
0
        public SampleNode(PlanNodeId id, PlanNode source, double sampleRatio, SampleNodeType sampleType) : base(id)
        {
            ParameterCheck.OutOfRange(sampleRatio >= 0.0, "sampleRatio", "Sample ratio cannot be less than zero.");
            ParameterCheck.OutOfRange(sampleRatio <= 1.0, "sampleRatio", "Sample ratio cannot be greater than 1.");

            this.SampleType  = sampleType;
            this.Source      = source ?? throw new ArgumentNullException("source");
            this.SampleRatio = sampleRatio;
        }
Example #12
0
        public TopNNode(PlanNodeId id, PlanNode source, long count, OrderingScheme orderingScheme, Step step) : base(id)
        {
            ParameterCheck.OutOfRange(count >= 0, "count", "Count must be positive.");
            ParameterCheck.OutOfRange(count <= Int32.MaxValue, "count", $"ORDER BY LIMIT > {Int32.MaxValue} is not supported.");

            this.Source         = source ?? throw new ArgumentNullException("source");
            this.Count          = count;
            this.OrderingScheme = orderingScheme ?? throw new ArgumentNullException("orderingScheme");
            this.Step           = step;
        }
Example #13
0
        public OutputNode(PlanNodeId id, PlanNode source, IEnumerable <string> columns, IEnumerable <Symbol> outputs) : base(id)
        {
            this.Source  = source ?? throw new ArgumentNullException("source");
            this.Columns = columns ?? throw new ArgumentNullException("columns");
            this.Outputs = outputs ?? throw new ArgumentNullException("outputs");

            if (this.Columns.Count() != this.Outputs.Count())
            {
                throw new ArgumentException("Column names and assignments sizes don't match.");
            }
        }
Example #14
0
        public TopNRowNumberNode(PlanNodeId id, PlanNode source, Specification specification, Symbol rowNumberSymbol, int maxRowCountPerPartition, bool partial, Symbol hashSymbol) : base(id)
        {
            ParameterCheck.OutOfRange(maxRowCountPerPartition > 0, "maxrowCountPerPartition", "Max row count per partition must be greater than 0.");

            this.Source        = source ?? throw new ArgumentNullException("source");
            this.Specification = specification ?? throw new ArgumentNullException("specification");

            ParameterCheck.NonNull <OrderingScheme>(Specification.OrderingScheme, "specification", "The specification ordering scheme is absent.");

            this.RowNumberSymbol         = rowNumberSymbol;
            this.MaxRowCountPerPartition = maxRowCountPerPartition;
            this.Partial    = partial;
            this.HashSymbol = hashSymbol;
        }
Example #15
0
        public DistinctLimitNode(PlanNodeId id, PlanNode source, long limit, bool partial, IEnumerable <Symbol> distinctSymbols, Symbol hashSymbol) : base(id)
        {
            ParameterCheck.OutOfRange(limit >= 0, "The limit cannot be less than zero.");

            this.Source          = source ?? throw new ArgumentNullException("source");
            this.Limit           = limit;
            this.Partial         = partial;
            this.DistinctSymbols = distinctSymbols;
            this.HashSymbol      = hashSymbol;

            if (this.HashSymbol != null && this.DistinctSymbols.Contains(this.HashSymbol))
            {
                throw new ArgumentException("Distinct symbols should not contain hash symbol.");
            }
        }
Example #16
0
        public TableWriterNode(PlanNodeId id, PlanNode source, WriterTarget target, IEnumerable <Symbol> outputs, IEnumerable <Symbol> columns, IEnumerable <string> columnNames, PartitioningScheme partitioningScheme) : base(id)
        {
            this.Source      = source ?? throw new ArgumentNullException("source");
            this.Target      = target ?? throw new ArgumentNullException("target");
            this.Columns     = columns ?? throw new ArgumentNullException("columns");
            this.ColumnNames = columnNames ?? throw new ArgumentNullException("columnNames");

            if (this.Columns.Count() != this.ColumnNames.Count())
            {
                throw new ArgumentException("Columns and column names sizes don't match.");
            }

            this.Outputs            = outputs ?? throw new ArgumentNullException("outputs");
            this.PartitioningScheme = partitioningScheme;
        }
Example #17
0
 public IndexJoinNode(
     PlanNodeId id,
     IndexJoinNodeType type,
     PlanNode probeSource,
     PlanNode indexSource,
     IEnumerable <EquiJoinClause> criteria,
     Symbol probeHashSymbol,
     Symbol indexHashSymbol
     ) : base(id)
 {
     this.Type            = type;
     this.ProbeSource     = probeSource ?? throw new ArgumentNullException("probeSource");
     this.IndexSource     = indexSource ?? throw new ArgumentNullException("indexSource");
     this.Criteria        = criteria ?? throw new ArgumentNullException("criteria");
     this.ProbeHashSymbol = probeHashSymbol;
     this.IndexHashSymbol = indexHashSymbol;
 }
Example #18
0
        public GroupIdNode(
            PlanNodeId id,
            PlanNode source,
            IEnumerable <List <Symbol> > groupingSets,
            IDictionary <string, Symbol> groupingSetMappings,
            IDictionary <string, Symbol> argumentMappings,
            Symbol groupIdSymbol
            ) : base(id)
        {
            this.Source              = source ?? throw new ArgumentNullException("source");
            this.GroupingSets        = groupingSets ?? throw new ArgumentNullException("groupingSets");
            this.GroupingSetMappings = groupingSetMappings ?? throw new ArgumentNullException("groupingSetMappings");
            this.ArgumentMappings    = argumentMappings ?? throw new ArgumentNullException("argumentMappings");
            this.GroupIdSymbol       = groupIdSymbol ?? throw new ArgumentNullException("groupIdSymbol");

            if (this.GroupingSetMappings.Keys.Intersect(this.ArgumentMappings.Keys).Any())
            {
                throw new ArgumentException("The argument outputs and grouping outputs must be a disjoint set.");
            }
        }
Example #19
0
        public SemiJoinNode(
            PlanNodeId id,
            PlanNode source,
            PlanNode filteringSource,
            Symbol sourceJoinSymbol,
            Symbol filteringSourceJoinSymbol,
            Symbol semiJoinOutput,
            Symbol sourceHashSymbol,
            Symbol filteringSourceHashSymbol,
            DistributionType distributionType
            ) : base(id)
        {
            this.Source                    = source ?? throw new ArgumentNullException("source");
            this.FilteringSource           = filteringSource ?? throw new ArgumentNullException("filteringSource");
            this.SourceJoinSymbol          = sourceJoinSymbol ?? throw new ArgumentNullException("sourceJoinSymbol");
            this.FilteringSourceJoinSymbol = filteringSourceJoinSymbol ?? throw new ArgumentNullException("filteringSourceJoinSymbol");
            this.SemiJoinOutput            = semiJoinOutput ?? throw new ArgumentNullException("semiJoinOutput");
            this.SourceHashSymbol          = sourceHashSymbol;
            this.FilteringSourceHashSymbol = filteringSourceHashSymbol;
            this.DistributionType          = distributionType;

            ParameterCheck.Check(this.Source.GetOutputSymbols().Contains(this.SourceJoinSymbol), "Source does not contain join symbol.");
            ParameterCheck.Check(this.FilteringSource.GetOutputSymbols().Contains(this.FilteringSourceJoinSymbol), "Filtering source does not contain filtering join symbol.");
        }
Example #20
0
 public AssignUniqueId(PlanNodeId id, PlanNode source, Symbol idColumn) : base(id)
 {
     this.Source   = source ?? throw new ArgumentNullException("source");
     this.IdColumn = idColumn ?? throw new ArgumentNullException("idColumn");
 }
Example #21
0
 public EnforceSingleRowNode(PlanNodeId id, PlanNode source) : base(id)
 {
     this.Source = source ?? throw new ArgumentNullException("source");
 }
Example #22
0
 public ExplainAnalyzeNode(PlanNodeId id, PlanNode source, Symbol outputSymbol, bool verbose) : base(id)
 {
     this.Source       = source ?? throw new ArgumentNullException("source");
     this.OutputSymbol = outputSymbol ?? throw new ArgumentNullException("outputSymbol");
     this.Verbose      = verbose;
 }
Example #23
0
 public ProjectNode(PlanNodeId id, PlanNode source, Assignments assignments) : base(id)
 {
     this.Source      = source ?? throw new ArgumentNullException("source");
     this.Assignments = assignments ?? throw new ArgumentNullException("assignments");
 }
Example #24
0
 public FilterNode(PlanNodeId id, PlanNode source, dynamic predicate) : base(id)
 {
     this.Source    = source;
     this.Predicate = predicate;
 }
Example #25
0
 public SortNode(PlanNodeId id, PlanNode source, OrderingScheme orderingScheme) : base(id)
 {
     this.Source         = source ?? throw new ArgumentNullException("source");
     this.OrderingScheme = orderingScheme ?? throw new ArgumentNullException("orderingScheme");
 }
Example #26
0
 public TableFinishNode(PlanNodeId id, PlanNode source, WriterTarget target, IEnumerable <Symbol> outputs) : base(id)
 {
     this.Source  = source ?? throw new ArgumentNullException("source");
     this.Target  = target;
     this.Outputs = outputs ?? throw new ArgumentNullException("outputs");
 }