src/LogicalPlanner/LogicalPlan.cs
/// <summary>
/// Create logical operator tree for sub-tree node type InfixQueryNode
/// </summary>
/// <param name="treeNode"></param>
/// <returns></returns>
Create logical operator tree for sub-tree node type InfixQueryNode
Create logical operator tree for sub - tree node type InfixQueryNode
private BinaryLogicalOperator CreateLogicalTree(InfixQueryNode treeNode, ISet<LogicalOperator> allLogicalOps)
        {
            var left = CreateLogicalTree(treeNode.LeftQueryTreeNode, allLogicalOps);
            var right = CreateLogicalTree(treeNode.RightQueryTreeNode, allLogicalOps);
            Debug.Assert(left.OutputSchema.Count == left.OutputSchema.Count);
            SetOperator.SetOperationType op;
            switch (treeNode.Operator)
            {
                case InfixQueryNode.QueryOperator.Union:
                    op = SetOperator.SetOperationType.Union;
                    break;
                case InfixQueryNode.QueryOperator.UnionAll:
                    op = SetOperator.SetOperationType.UnionAll;
                    break;
                default:
                    throw new TranspilerInternalErrorException($"Unimplemented operator type: {treeNode.Operator}");
            }
            var setOp = new SetOperator(left, right, op);
            setOp.InputSchema = new Schema(left.InputSchema);
            setOp.OutputSchema = new Schema(left.InputSchema); 
            allLogicalOps.Add(setOp);
            return setOp;
        }
private BinaryLogicalOperator CreateLogicalTree ( InfixQueryNode treeNode , ISet < LogicalOperator > allLogicalOps ) { var left = CreateLogicalTree ( treeNode . LeftQueryTreeNode , allLogicalOps ) ; var right = CreateLogicalTree ( treeNode . RightQueryTreeNode , allLogicalOps ) ; Debug . Assert ( left . OutputSchema . Count == left . OutputSchema . Count ) ; SetOperator . SetOperationType op ; switch ( treeNode . Operator ) { case InfixQueryNode . QueryOperator . Union : op = SetOperator . SetOperationType . Union ; break ; case InfixQueryNode . QueryOperator . UnionAll : op = SetOperator . SetOperationType . UnionAll ; break ; default : throw new TranspilerInternalErrorException ( $" Unimplemented operator type:  { treeNode . Operator } " ) ; } var setOp = new SetOperator ( left , right , op ) ; setOp . InputSchema = new Schema ( left . InputSchema ) ; setOp . OutputSchema = new Schema ( left . InputSchema ) ; allLogicalOps . Add ( setOp ) ; return setOp ; }
Create logical operator tree for sub-tree node type InfixQueryNode
Create logical operator tree for sub - tree node type InfixQueryNode
// TODO: better way of ensure schema is the same // the schema remains the same for setoperator
None
treeNode
InfixQueryNode
None
allLogicalOps
ISet<LogicalOperator>