Package org.apache.pig.newplan.logical.expression

Examples of org.apache.pig.newplan.logical.expression.RegexExpression


   
    public void visit(LORegexp binOp) throws VisitorException {
        ExpressionOperator left = binOp.getLhsOperand();
        ExpressionOperator right = binOp.getRhsOperand();
       
        RegexExpression ae = new RegexExpression(exprPlan
                , exprOpsMap.get(left), exprOpsMap.get(right));
        exprOpsMap.put(binOp, ae);
    }
View Full Code Here


        public void testRegexTypeChecking1() throws Throwable {
            LogicalExpressionPlan plan = new LogicalExpressionPlan();
            ConstantExpression constant1 = new ConstantExpression(plan, "10");
            ConstantExpression constant2 = new ConstantExpression(plan, "Regex");

            RegexExpression regex = new RegexExpression(plan, constant1, constant2);

            CompilationMessageCollector collector = new CompilationMessageCollector();
            TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(plan, collector, null);
            expTypeChecker.visit();
            printMessageCollector(collector);

            //printTypeGraph(plan);

            // After type checking
            System.out.println(DataType.findTypeName(regex.getType()));
            assertEquals(DataType.BOOLEAN, regex.getType());
        }
View Full Code Here

        public void testRegexTypeChecking2() throws Throwable {
            LogicalExpressionPlan plan = new LogicalExpressionPlan();
            ConstantExpression constant1 = new ConstantExpression(plan, new DataByteArray());
            ConstantExpression constant2 = new ConstantExpression(plan, "Regex");

            RegexExpression regex = new RegexExpression(plan, constant1, constant2);

            CompilationMessageCollector collector = new CompilationMessageCollector();
            TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(plan, collector, null);
            expTypeChecker.visit();
            printMessageCollector(collector);

            //printTypeGraph(plan);

            // After type checking

            if (collector.hasError()) {
                throw new Exception("Error not expected during type checking");
            }

            // check type
            System.out.println(DataType.findTypeName(regex.getType()));
            assertEquals(DataType.BOOLEAN, regex.getType());

            // check wiring
            CastExpression cast = (CastExpression) regex.getLhs();
            assertEquals(cast.getType(), DataType.CHARARRAY);
            assertEquals(cast.getExpression(), constant1);
        }
View Full Code Here

        public void testRegexTypeChecking3() throws Throwable {
            LogicalExpressionPlan plan = new LogicalExpressionPlan();
            ConstantExpression constant1 = new ConstantExpression(plan, 10);
            ConstantExpression constant2 = new ConstantExpression(plan, "Regex");

            RegexExpression regex = new RegexExpression(plan, constant1, constant2);

            CompilationMessageCollector collector = new CompilationMessageCollector();
            TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(plan, collector, null);
            expTypeChecker.visit();
            printMessageCollector(collector);
View Full Code Here

        public void testRegexTypeChecking1() throws Throwable {
            LogicalExpressionPlan plan = new LogicalExpressionPlan() ;
            ConstantExpression constant1 = new ConstantExpression(plan, "10") ;
            ConstantExpression constant2 = new ConstantExpression(plan, "Regex");
   
            RegexExpression regex = new RegexExpression(plan, constant1, constant2) ;
   
            CompilationMessageCollector collector = new CompilationMessageCollector() ;
            TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(plan, collector, null);
            expTypeChecker.visit()
            printMessageCollector(collector) ;
   
            //printTypeGraph(plan) ;
   
            // After type checking
            System.out.println(DataType.findTypeName(regex.getType())) ;
            assertEquals(DataType.BOOLEAN, regex.getType()) ;
        }
View Full Code Here

            ConstantExpression constant1 = new ConstantExpression(plan,
                    new DataByteArray()
            ) ;
            ConstantExpression constant2 = new ConstantExpression(plan, "Regex");
   
            RegexExpression regex = new RegexExpression(plan, constant1, constant2);

            CompilationMessageCollector collector = new CompilationMessageCollector() ;
            TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(plan, collector, null);
            expTypeChecker.visit()
            printMessageCollector(collector) ;
   
            //printTypeGraph(plan) ;
   
            // After type checking
   
            if (collector.hasError()) {
                throw new Exception("Error not expected during type checking") ;
            }      
           
            // check type
            System.out.println(DataType.findTypeName(regex.getType())) ;
            assertEquals(DataType.BOOLEAN, regex.getType()) ;
                                            
            // check wiring     
            CastExpression cast = (CastExpression) regex.getLhs() ;     
            assertEquals(cast.getType(), DataType.CHARARRAY);   
            assertEquals(cast.getExpression(), constant1) ;
        }
View Full Code Here

        public void testRegexTypeChecking3() throws Throwable {
            LogicalExpressionPlan plan = new LogicalExpressionPlan() ;
            ConstantExpression constant1 = new ConstantExpression(plan, 10) ;
            ConstantExpression constant2 = new ConstantExpression(plan, "Regex");
           
            RegexExpression regex = new RegexExpression(plan, constant1, constant2);
   
            try {
                CompilationMessageCollector collector = new CompilationMessageCollector() ;
                TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(plan, collector, null);
                expTypeChecker.visit()
View Full Code Here

        public void testRegexTypeChecking1() throws Throwable {
            LogicalExpressionPlan plan = new LogicalExpressionPlan();
            ConstantExpression constant1 = new ConstantExpression(plan, "10");
            ConstantExpression constant2 = new ConstantExpression(plan, "Regex");

            RegexExpression regex = new RegexExpression(plan, constant1, constant2);

            CompilationMessageCollector collector = new CompilationMessageCollector();
            TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(plan, collector, null);
            expTypeChecker.visit();
            printMessageCollector(collector);

            //printTypeGraph(plan);

            // After type checking
            System.out.println(DataType.findTypeName(regex.getType()));
            assertEquals(DataType.BOOLEAN, regex.getType());
        }
View Full Code Here

        public void testRegexTypeChecking2() throws Throwable {
            LogicalExpressionPlan plan = new LogicalExpressionPlan();
            ConstantExpression constant1 = new ConstantExpression(plan, new DataByteArray());
            ConstantExpression constant2 = new ConstantExpression(plan, "Regex");

            RegexExpression regex = new RegexExpression(plan, constant1, constant2);

            CompilationMessageCollector collector = new CompilationMessageCollector();
            TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(plan, collector, null);
            expTypeChecker.visit();
            printMessageCollector(collector);

            //printTypeGraph(plan);

            // After type checking

            if (collector.hasError()) {
                throw new Exception("Error not expected during type checking");
            }

            // check type
            System.out.println(DataType.findTypeName(regex.getType()));
            assertEquals(DataType.BOOLEAN, regex.getType());

            // check wiring
            CastExpression cast = (CastExpression) regex.getLhs();
            assertEquals(cast.getType(), DataType.CHARARRAY);
            assertEquals(cast.getExpression(), constant1);
        }
View Full Code Here

        public void testRegexTypeChecking3() throws Throwable {
            LogicalExpressionPlan plan = new LogicalExpressionPlan();
            ConstantExpression constant1 = new ConstantExpression(plan, 10);
            ConstantExpression constant2 = new ConstantExpression(plan, "Regex");

            RegexExpression regex = new RegexExpression(plan, constant1, constant2);

            CompilationMessageCollector collector = new CompilationMessageCollector();
            TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(plan, collector, null);
            expTypeChecker.visit();
            printMessageCollector(collector);
View Full Code Here

TOP

Related Classes of org.apache.pig.newplan.logical.expression.RegexExpression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.