Package org.apache.pig.impl.logicalLayer

Examples of org.apache.pig.impl.logicalLayer.FrontendException


     * @link org.apache.pig.newplan.Operator#accept(org.apache.pig.newplan.PlanVisitor)
     */
    @Override
    public void accept(PlanVisitor v) throws FrontendException {
        if (!(v instanceof LogicalExpressionVisitor)) {
            throw new FrontendException("Expected LogicalExpressionVisitor", 2222);
        }
        ((LogicalExpressionVisitor)v).visit(this);
    }
View Full Code Here


    }

    @Override
    public void accept(PlanVisitor v) throws FrontendException {
        if (!(v instanceof LogicalExpressionVisitor)) {
            throw new FrontendException("Expected LogicalExpressionVisitor", 2222);
        }
        ((LogicalExpressionVisitor)v).visit(this);
    }
View Full Code Here

       
        private void checkDNFLeaves(OperatorPlan dnfPlan)
                        throws FrontendException {
            List<Operator> roots = dnfPlan.getSources();
            if (roots == null || roots.size() != 1)
                throw new FrontendException(
                                "DNF root size is expected to be one");
            Operator dnf = roots.get(0);
            if (dnf instanceof AndExpression || (dnf instanceof DNFExpression && ((DNFExpression) dnf).type == DNFExpression.DNFExpressionType.AND)) {
                handleDNFAnd(dnfPlan, dnf);
            }
View Full Code Here

                                        plan,
                                        (Double) lhs.getValue() + (Double) rhs.getValue(),
                                        parent.getFieldSchema());
                        break;
                    default:
                        throw new FrontendException("Invalid type");
                }
            }
            else if (parent instanceof SubtractExpression) {
                byte type = parent.getFieldSchema().type;
                switch (type) {
                    case DataType.INTEGER:
                        newExp = new ConstantExpression(
                                        plan,
                                        (Integer) lhs.getValue() - (Integer) rhs.getValue(),
                                        parent.getFieldSchema());
                        break;
                    case DataType.LONG:
                        newExp = new ConstantExpression(
                                        plan,
                                        (Long) lhs.getValue() - (Long) rhs.getValue(),
                                        parent.getFieldSchema());
                        break;
                    case DataType.FLOAT:
                        newExp = new ConstantExpression(
                                        plan,
                                        (Float) lhs.getValue() - (Float) rhs.getValue(),
                                        parent.getFieldSchema());
                        break;
                    case DataType.DOUBLE:
                        newExp = new ConstantExpression(
                                        plan,
                                        (Double) lhs.getValue() - (Double) rhs.getValue(),
                                        parent.getFieldSchema());
                        break;
                    default:
                        throw new FrontendException("Invalid type");
                }
            }
            else if (parent instanceof MultiplyExpression) {
                byte type = parent.getFieldSchema().type;
                switch (type) {
                    case DataType.INTEGER:
                        newExp = new ConstantExpression(
                                        plan,
                                        (Integer) lhs.getValue() * (Integer) rhs.getValue(),
                                        parent.getFieldSchema());
                        break;
                    case DataType.LONG:
                        newExp = new ConstantExpression(
                                        plan,
                                        (Long) lhs.getValue() * (Long) rhs.getValue(),
                                        parent.getFieldSchema());
                        break;
                    case DataType.FLOAT:
                        newExp = new ConstantExpression(
                                        plan,
                                        (Float) lhs.getValue() * (Float) rhs.getValue(),
                                        parent.getFieldSchema());
                        break;
                    case DataType.DOUBLE:
                        newExp = new ConstantExpression(
                                        plan,
                                        (Double) lhs.getValue() * (Double) rhs.getValue(),
                                        parent.getFieldSchema());
                        break;
                    default:
                        throw new FrontendException("Invalid type");
                }
            }
            else if (parent instanceof ModExpression) {
                byte type = parent.getFieldSchema().type;
                switch (type) {
                    case DataType.INTEGER:
                        newExp = new ConstantExpression(
                                        plan,
                                        (Integer) lhs.getValue() % (Integer) rhs.getValue(),
                                        parent.getFieldSchema());
                        break;
                    case DataType.LONG:
                        newExp = new ConstantExpression(
                                        plan,
                                        (Long) lhs.getValue() % (Long) rhs.getValue(),
                                        parent.getFieldSchema());
                        break;
                    default:
                        throw new FrontendException("Invalid type");
                }
            }
            else if (parent instanceof DivideExpression) {
                byte type = parent.getFieldSchema().type;
                switch (type) {
                    case DataType.INTEGER:
                        if ((Integer) rhs.getValue() != 0)
                            newExp = new ConstantExpression(
                                            plan,
                                            (Integer) lhs.getValue() / (Integer) rhs.getValue(),
                                            parent.getFieldSchema());
                        break;
                    case DataType.LONG:
                        if ((Long) rhs.getValue() != 0)
                            newExp = new ConstantExpression(
                                            plan,
                                            (Long) lhs.getValue() / (Long) rhs.getValue(),
                                            parent.getFieldSchema());
                        break;
                    case DataType.FLOAT:
                        if ((Float) rhs.getValue() != 0)
                            newExp = new ConstantExpression(
                                            plan,
                                            (Float) lhs.getValue() / (Float) rhs.getValue(),
                                            parent.getFieldSchema());
                        break;
                    case DataType.DOUBLE:
                        if ((Double) rhs.getValue() != 0)
                            newExp = new ConstantExpression(
                                            plan,
                                            (Double) lhs.getValue() / (Double) rhs.getValue(),
                                            parent.getFieldSchema());
                        break;
                    default:
                        throw new FrontendException("Invalid type");
                }
            }
            else throw new FrontendException("Invalid instance type.");
            if (newExp != null) {
                plan.disconnect(parent, rhs);
                plan.remove(rhs);
                plan.disconnect(parent, lhs);
                plan.remove(lhs);
View Full Code Here

                                        plan,
                                        -1.0D * ((Integer) operand.getValue()),
                                        op.getFieldSchema());
                        break;
                    default:
                        throw new FrontendException("Invalid type");
                }
            }
            else throw new FrontendException("Invalid instance type.");
            plan.add(newExp);
            result.push(newExp);
        }
    }
View Full Code Here

                        match = i;
                        break;
                    }
                }
                if (match == -1) {
                    throw new FrontendException("Couldn't find matching uid " + match + " for project "+p, 2229);
                }
                p.setColNum(match);
            }
        }       
View Full Code Here

     * @link org.apache.pig.newplan.Operator#accept(org.apache.pig.newplan.PlanVisitor)
     */
    @Override
    public void accept(PlanVisitor v) throws FrontendException {
        if (!(v instanceof LogicalExpressionVisitor)) {
            throw new FrontendException("Expected LogicalExpressionVisitor", 2222);
        }
        ((LogicalExpressionVisitor)v).visit(this);
    }
View Full Code Here

     * @link org.apache.pig.newplan.Operator#accept(org.apache.pig.newplan.PlanVisitor)
     */
    @Override
    public void accept(PlanVisitor v) throws FrontendException {
        if (!(v instanceof LogicalExpressionVisitor)) {
            throw new FrontendException("Expected LogicalExpressionVisitor", 2222);
        }
        ((LogicalExpressionVisitor)v).visit(this);
    }
View Full Code Here

     * @link org.apache.pig.newplan.Operator#accept(org.apache.pig.newplan.PlanVisitor)
     */
    @Override
    public void accept(PlanVisitor v) throws FrontendException {
        if (!(v instanceof LogicalExpressionVisitor)) {
            throw new FrontendException("Expected LogicalExpressionVisitor", 2222);
        }
        ((LogicalExpressionVisitor)v).visit(this);

    }
View Full Code Here

     * @link org.apache.pig.newplan.Operator#accept(org.apache.pig.newplan.PlanVisitor)
     */
    @Override
    public void accept(PlanVisitor v) throws FrontendException {
        if (!(v instanceof LogicalExpressionVisitor)) {
            throw new FrontendException("Expected LogicalExpressionVisitor", 2222);
        }
        ((LogicalExpressionVisitor)v).visit(this);
    }
View Full Code Here

TOP

Related Classes of org.apache.pig.impl.logicalLayer.FrontendException

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.