Examples of NotExpression


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

        ConstantExpression constant4 =  new ConstantExpression(plan,  true) ;

        SubtractExpression sub1 = new SubtractExpression(plan, constant1, constant2) ;
        GreaterThanExpression gt1 = new GreaterThanExpression(plan, sub1, constant3) ;
        AndExpression and1 = new AndExpression(plan, gt1, constant4) ;
        NotExpression not1 = new NotExpression(plan, and1) ;

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


        printMessageCollector(collector) ;
        //printTypeGraph(plan) ;

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


        // Induction check  
        assertEquals(DataType.INTEGER, sub1.getType()) ;   
        assertEquals(DataType.BOOLEAN, gt1.getType()) ;    
        assertEquals(DataType.BOOLEAN, and1.getType()) ;   
        assertEquals(DataType.BOOLEAN, not1.getType()) ;   

        // Cast insertion check    
        assertEquals(DataType.INTEGER, sub1.getRhs().getType()) ;   
        assertEquals(DataType.LONG, gt1.getLhs().getType()) ;
View Full Code Here

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

        ConstantExpression constant4 =  new ConstantExpression(plan,  true);

        SubtractExpression sub1 = new SubtractExpression(plan, constant1, constant2);
        GreaterThanExpression gt1 = new GreaterThanExpression(plan, sub1, constant3);
        AndExpression and1 = new AndExpression(plan, gt1, constant4);
        NotExpression not1 = new NotExpression(plan, and1);

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


        printMessageCollector(collector);
        //printTypeGraph(plan);

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


        // Induction check
        assertEquals(DataType.INTEGER, sub1.getType());
        assertEquals(DataType.BOOLEAN, gt1.getType());
        assertEquals(DataType.BOOLEAN, and1.getType());
        assertEquals(DataType.BOOLEAN, not1.getType());

        // Cast insertion check
        assertEquals(DataType.INTEGER, sub1.getRhs().getType());
        assertEquals(DataType.LONG, gt1.getLhs().getType());
View Full Code Here

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

        ConstantExpression constant4 =  new ConstantExpression(plan,  true);

        SubtractExpression sub1 = new SubtractExpression(plan, constant1, constant2);
        GreaterThanExpression gt1 = new GreaterThanExpression(plan, sub1, constant3);
        AndExpression and1 = new AndExpression(plan, gt1, constant4);
        NotExpression not1 = new NotExpression(plan, and1);

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


        printMessageCollector(collector);
        //printTypeGraph(plan);

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


        // Induction check
        assertEquals(DataType.INTEGER, sub1.getType());
        assertEquals(DataType.BOOLEAN, gt1.getType());
        assertEquals(DataType.BOOLEAN, and1.getType());
        assertEquals(DataType.BOOLEAN, not1.getType());

        // Cast insertion check
        assertEquals(DataType.INTEGER, sub1.getRhs().getType());
        assertEquals(DataType.LONG, gt1.getLhs().getType());
View Full Code Here

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

                currentExpr = root;
            else
                currentExpr = new OrExpression(splitPlan, currentExpr, root);
        }
        // using De Morgan's law (!A && !B) == !(A || B)
        currentExpr = new NotExpression(splitPlan, currentExpr);

        try {
            // Going through all the ProjectExpressions that were cloned
            // and updating the attached operators from its original
            // LOSplitOutput to to the "otherwise" LOSplitOutput
View Full Code Here

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

                currentExpr = root;
            else
                currentExpr = new OrExpression(splitPlan, currentExpr, root);
        }
        // using De Morgan's law (!A && !B) == !(A || B)
        currentExpr = new NotExpression(splitPlan, currentExpr);
        op.setFilterPlan(splitPlan);
        return buildOp(loc, op, alias, inputAlias, null);
    }
View Full Code Here

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

        ConstantExpression constant4 =  new ConstantExpression(plan,  true) ;

        SubtractExpression sub1 = new SubtractExpression(plan, constant1, constant2) ;
        GreaterThanExpression gt1 = new GreaterThanExpression(plan, sub1, constant3) ;
        AndExpression and1 = new AndExpression(plan, gt1, constant4) ;
        NotExpression not1 = new NotExpression(plan, and1) ;

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


        printMessageCollector(collector) ;
        //printTypeGraph(plan) ;

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


        // Induction check  
        assertEquals(DataType.INTEGER, sub1.getType()) ;   
        assertEquals(DataType.BOOLEAN, gt1.getType()) ;    
        assertEquals(DataType.BOOLEAN, and1.getType()) ;   
        assertEquals(DataType.BOOLEAN, not1.getType()) ;   

        // Cast insertion check    
        assertEquals(DataType.INTEGER, sub1.getRhs().getType()) ;   
        assertEquals(DataType.LONG, gt1.getLhs().getType()) ;
View Full Code Here

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

       
        assertEquals( 1, filPlan.getSources().size() );
        assertEquals( 3, filPlan.size() );
        assertEquals( 1, filPlan.getSinks().size() );
        assertEquals( NotExpression.class, filPlan.getSources().get(0).getClass() );
        NotExpression notExp = (NotExpression)filPlan.getSources().get(0);
        assertTrue( ls.getField(0).uid != notExp.getFieldSchema().uid );
        assertTrue( ls.getField(1).uid != notExp.getFieldSchema().uid );
        assertEquals( IsNullExpression.class, notExp.getExpression().getClass() );
        IsNullExpression isNull = (IsNullExpression)notExp.getExpression();
        assertTrue( ls.getField(0).uid != isNull.getFieldSchema().uid );
        assertTrue( ls.getField(1).uid != isNull.getFieldSchema().uid );
       
        assertEquals( ProjectExpression.class, isNull.getExpression().getClass() );
        ProjectExpression prj = (ProjectExpression) isNull.getExpression();
View Full Code Here

Examples of org.apache.webdav.lib.search.expressions.NotExpression

    /**
     * Factory method for <code>not</code> expressions.
     * @param ex expression to be negated
     */
    public NotExpression not(SearchExpression ex) {
        return new NotExpression(ex);
    }
View Full Code Here

Examples of org.araneaframework.backend.list.memorybased.expression.logical.NotExpression

  private ListFilter filter;
  public NotFilter(ListFilter filter) {
    this.filter = filter;
  }
  public Expression buildExpression(Map data) {
    return new NotExpression(this.filter.buildExpression(data));
  }
View Full Code Here

Examples of org.araneaframework.backend.list.memorybased.expression.logical.NotExpression

  }

  public void testNotExpression() throws ExpressionEvaluationException {
    log.debug("Testing NotExpression");
    try {
      new NotExpression(null).evaluate(this.resolver);
      fail("NotExpression must throw an exception");
    } catch (Exception e) {
      // normal
    }
    try {
      new NotExpression(this.notBoolExpr).evaluate(this.resolver);
      fail("NotExpression must throw an exception");
    } catch (Exception e) {
      // normal
    }

    assertEquals("NotExpression must return false", Boolean.FALSE,
        new NotExpression(this.trueExpr).evaluate(this.resolver));
    assertEquals("NotExpression must return true", Boolean.TRUE,
        new NotExpression(this.falseExpr).evaluate(this.resolver));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.