// it explicit. Since the RuleMatcher doesn't handle trees properly,
// we cheat and say that we match any node. Then we'll do the actual
// test in the transformers check method.
rulePlan = new RulePlan();
RuleOperator anyLogicalOperator = new RuleOperator(LogicalOperator.class, RuleOperator.NodeType.ANY_NODE,
new OperatorKey(SCOPE, nodeIdGen.getNextNodeId(SCOPE)));
rulePlan.add(anyLogicalOperator);
mRules.add(new Rule<LogicalOperator, LogicalPlan>(rulePlan,
new ImplicitSplitInserter(plan), "ImplicitSplitInserter"));
// Add type casting to plans where the schema has been declared (by
// user, data, or data catalog).
rulePlan = new RulePlan();
RuleOperator loLoad = new RuleOperator(LOLoad.class,
new OperatorKey(SCOPE, nodeIdGen.getNextNodeId(SCOPE)));
rulePlan.add(loLoad);
mRules.add(new Rule<LogicalOperator, LogicalPlan>(rulePlan,
new TypeCastInserter(plan, LOLoad.class.getName()), "LoadTypeCastInserter"));
// Add type casting to plans where the schema has been declared by
// user in a statement with stream operator.
rulePlan = new RulePlan();
RuleOperator loStream= new RuleOperator(LOStream.class,
new OperatorKey(SCOPE, nodeIdGen.getNextNodeId(SCOPE)));
rulePlan.add(loStream);
mRules.add(new Rule<LogicalOperator, LogicalPlan>(rulePlan, new TypeCastInserter(plan,
LOStream.class.getName()), "StreamTypeCastInserter"));
// Push up filters as far as we can
rulePlan = new RulePlan();
RuleOperator loFilter = new RuleOperator(LOFilter.class,
new OperatorKey(SCOPE, nodeIdGen.getNextNodeId(SCOPE)));
rulePlan.add(loFilter);
mRules.add(new Rule<LogicalOperator, LogicalPlan>(rulePlan,
new TypeCastInserter(plan, LOFilter.class.getName()),
"PushUpFilter"));