org.apache.pig.newplan.logical.visitor
Class TypeCheckingExpVisitor

java.lang.Object
  extended by org.apache.pig.newplan.PlanVisitor
      extended by org.apache.pig.newplan.logical.expression.LogicalExpressionVisitor
          extended by org.apache.pig.newplan.logical.visitor.TypeCheckingExpVisitor

public class TypeCheckingExpVisitor
extends LogicalExpressionVisitor


Field Summary
 
Fields inherited from class org.apache.pig.newplan.PlanVisitor
currentWalker, DEFAULT_SCOPE, plan
 
Constructor Summary
TypeCheckingExpVisitor(OperatorPlan expPlan, CompilationMessageCollector msgCollector, LogicalRelationalOperator relOp)
           
 
Method Summary
static boolean schemaEqualsForMatching(Schema inputSchema, Schema udfSchema, boolean ignoreByteArrays)
          Compare two schemas for equality for argument matching purposes.
 void visit(AddExpression binOp)
           
 void visit(AndExpression andExp)
           
 void visit(BinCondExpression binCond)
           
 void visit(CastExpression cast)
          For Basic Types: 0) Casting to itself is always ok 1) Casting from number to number is always ok 2) ByteArray to anything is ok 3) number to chararray is ok For Composite Types: Recursively traverse the schemas till you get a basic type
 void visit(DereferenceExpression deref)
           
 void visit(DivideExpression binOp)
           
 void visit(EqualExpression binOp)
           
 void visit(GreaterThanEqualExpression binOp)
           
 void visit(GreaterThanExpression binOp)
           
 void visit(LessThanEqualExpression binOp)
           
 void visit(LessThanExpression binOp)
           
 void visit(MapLookupExpression map)
           
 void visit(ModExpression binOp)
           
 void visit(MultiplyExpression binOp)
           
 void visit(NegativeExpression negExp)
           
 void visit(NotEqualExpression binOp)
           
 void visit(NotExpression notExp)
           
 void visit(OrExpression orExp)
           
 void visit(RegexExpression rg)
          RegexExpression expects CharArray as input Itself always returns Boolean
 void visit(SubtractExpression binOp)
           
 void visit(UserFuncExpression func)
           
 
Methods inherited from class org.apache.pig.newplan.logical.expression.LogicalExpressionVisitor
visit, visit, visit, visit
 
Methods inherited from class org.apache.pig.newplan.PlanVisitor
getPlan, popWalker, pushWalker, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeCheckingExpVisitor

public TypeCheckingExpVisitor(OperatorPlan expPlan,
                              CompilationMessageCollector msgCollector,
                              LogicalRelationalOperator relOp)
                       throws FrontendException
Throws:
FrontendException
Method Detail

visit

public void visit(AddExpression binOp)
           throws FrontendException
Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

visit

public void visit(SubtractExpression binOp)
           throws FrontendException
Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

visit

public void visit(MultiplyExpression binOp)
           throws FrontendException
Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

visit

public void visit(DivideExpression binOp)
           throws FrontendException
Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

visit

public void visit(ModExpression binOp)
           throws FrontendException
Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

visit

public void visit(NegativeExpression negExp)
           throws FrontendException
Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

visit

public void visit(NotExpression notExp)
           throws FrontendException
Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

visit

public void visit(OrExpression orExp)
           throws FrontendException
Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

visit

public void visit(AndExpression andExp)
           throws FrontendException
Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

visit

public void visit(LessThanExpression binOp)
           throws FrontendException
Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

visit

public void visit(LessThanEqualExpression binOp)
           throws FrontendException
Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

visit

public void visit(GreaterThanExpression binOp)
           throws FrontendException
Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

visit

public void visit(GreaterThanEqualExpression binOp)
           throws FrontendException
Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

visit

public void visit(EqualExpression binOp)
           throws FrontendException
Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

visit

public void visit(NotEqualExpression binOp)
           throws FrontendException
Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

visit

public void visit(CastExpression cast)
           throws FrontendException
For Basic Types: 0) Casting to itself is always ok 1) Casting from number to number is always ok 2) ByteArray to anything is ok 3) number to chararray is ok For Composite Types: Recursively traverse the schemas till you get a basic type

Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

visit

public void visit(RegexExpression rg)
           throws FrontendException
RegexExpression expects CharArray as input Itself always returns Boolean

Overrides:
visit in class LogicalExpressionVisitor
Parameters:
rg -
Throws:
FrontendException

visit

public void visit(BinCondExpression binCond)
           throws FrontendException
Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

visit

public void visit(MapLookupExpression map)
           throws FrontendException
Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

visit

public void visit(DereferenceExpression deref)
           throws FrontendException
Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

visit

public void visit(UserFuncExpression func)
           throws FrontendException
Overrides:
visit in class LogicalExpressionVisitor
Throws:
FrontendException

schemaEqualsForMatching

public static boolean schemaEqualsForMatching(Schema inputSchema,
                                              Schema udfSchema,
                                              boolean ignoreByteArrays)
                                       throws FrontendException
Compare two schemas for equality for argument matching purposes. This is a more relaxed form of Schema.equals wherein first the Datatypes of the field schema are checked for equality. Then if a field schema in the udf schema is for a complex type AND if the inner schema is NOT null, check for schema equality of the inner schemas of the UDF field schema and input field schema

Parameters:
inputSchema -
udfSchema -
ignoreByteArrays -
Returns:
true if FieldSchemas are equal for argument matching, false otherwise
Throws:
FrontendException


Copyright © 2007-2012 The Apache Software Foundation