public RestrictNode(RelNode source, CommonHeading nodeheading, RelFuncBase func) { _source = source; _restheading = nodeheading; _restfunc = func; Heading = _source.Heading; _restmap = _restheading.CreateMap(Heading); if (_restmap.Any(x => x < 0)) { throw Error.Fatal("Restrict", "heading has unknown attribute"); } }
public AggregateNode(RelNode source, CommonHeading nodeheading, RelFuncBase func, object initial = null) { _source = source; _heading = nodeheading; _func = func; _initial = initial; Heading = _source.Heading.Rename(_heading[0], _heading[1]); _vmap = _heading.CreateMap(_source.Heading); _jhead = _source.Heading.Minus(_heading); _jmap1 = _jhead.CreateMap(_source.Heading); _jmap2 = Heading.CreateMap(_jhead); if (!(_heading.Degree == 2 && _jmap2.Length == Heading.Degree)) { throw Error.Fatal("Aggregate", "heading is not valid"); } }
public ExtendNode(RelNode source, CommonHeading nodeheading, RelFuncBase func) { _source = source; _nodeheading = nodeheading; _func = func; Heading = CommonHeading.Create(_source.Heading.Fields.Union(_nodeheading.Fields)); // get the argument fields _argheading = CommonHeading.Create(_nodeheading.Fields.Take(_nodeheading.Fields.Length - 1)); _argmap = _argheading.CreateMap(_source.Heading); // last field can extend or replace, remove name but retain place var outh = Heading.Rename(_nodeheading.Fields.Last(), CommonField.Empty); _outmap = Heading.CreateMap(outh); if (_argmap.Any(x => x < 0)) { throw Error.Fatal("Extend", "heading has unknown attribute"); } if (_outmap.Count(x => x < 0) != 1) { throw Error.Fatal("Extend", "invalid heading, invalid new attribute"); // any use? } }
public RelNode Aggregate(string nodeheading, RelFuncBase func) { return(new AggregateNode(this, this.Heading.Adapt(nodeheading), func)); }
public RelNode Extend(string nodeheading, RelFuncBase func) { return(new ExtendNode(this, this.Heading.Adapt(nodeheading), func)); }
public RelNode Restrict(string nodeheading, RelFuncBase func) { return(new RestrictNode(this, this.Heading.Adapt(nodeheading), func)); }