public Schema.Operator GetOriginatingOperator() { InstructionNodeBase instructionNodeBase = Originator as InstructionNodeBase; if (instructionNodeBase != null) { return(instructionNodeBase.Operator); } return(((AggregateCallNode)Originator).Operator); }
protected void TranslateExpression(CatalogDevicePlan devicePlan, CatalogDevicePlanNode devicePlanNode, PlanNode planNode) { InstructionNodeBase instructionNode = planNode as InstructionNodeBase; if (instructionNode != null) { if ((instructionNode.DataType != null) && (instructionNode.Operator != null)) { switch (Schema.Object.Unqualify(instructionNode.Operator.OperatorName)) { case Instructions.And: case Instructions.Equal: case Instructions.NotEqual: case Instructions.Greater: case Instructions.InclusiveGreater: case Instructions.Less: case Instructions.InclusiveLess: case Instructions.Like: TranslateExpression(devicePlan, devicePlanNode, instructionNode.Nodes[0]); devicePlanNode.WhereCondition.AppendFormat(" {0} ", GetInstructionKeyword(Schema.Object.Unqualify(instructionNode.Operator.OperatorName))); TranslateExpression(devicePlan, devicePlanNode, instructionNode.Nodes[1]); return; case "ReadValue": TranslateExpression(devicePlan, devicePlanNode, instructionNode.Nodes[0]); return; default: devicePlan.IsSupported = false; return; } } } ValueNode valueNode = planNode as ValueNode; if (valueNode != null) { TranslateScalarParameter(devicePlan, devicePlanNode, planNode); return; } StackReferenceNode stackReferenceNode = planNode as StackReferenceNode; if (stackReferenceNode != null) { TranslateScalarParameter(devicePlan, devicePlanNode, new StackReferenceNode(stackReferenceNode.DataType, stackReferenceNode.Location - 1)); return; } StackColumnReferenceNode stackColumnReferenceNode = planNode as StackColumnReferenceNode; if (stackColumnReferenceNode != null) { if (stackColumnReferenceNode.Location == 0) { if (devicePlan.TableContext != null) { devicePlanNode.WhereCondition.Append(Schema.Object.EnsureUnrooted(MetaData.GetTag(devicePlan.TableContext.Columns[stackColumnReferenceNode.Identifier].MetaData, "Storage.Name", stackColumnReferenceNode.Identifier))); } else { devicePlanNode.WhereCondition.Append(Schema.Object.EnsureUnrooted(stackColumnReferenceNode.Identifier)); } } else { TranslateScalarParameter(devicePlan, devicePlanNode, new StackColumnReferenceNode(stackColumnReferenceNode.Identifier, stackColumnReferenceNode.DataType, stackColumnReferenceNode.Location - 1)); } return; } devicePlan.IsSupported = false; }