示例#1
0
        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");
            }
        }
示例#2
0
        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");
            }
        }
示例#3
0
        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?
            }
        }
示例#4
0
 public RelNode Aggregate(string nodeheading, RelFuncBase func)
 {
     return(new AggregateNode(this, this.Heading.Adapt(nodeheading), func));
 }
示例#5
0
 public RelNode Extend(string nodeheading, RelFuncBase func)
 {
     return(new ExtendNode(this, this.Heading.Adapt(nodeheading), func));
 }
示例#6
0
 public RelNode Restrict(string nodeheading, RelFuncBase func)
 {
     return(new RestrictNode(this, this.Heading.Adapt(nodeheading), func));
 }