Package org.apache.pig.impl.logicalLayer

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


                    hasNext = true;
                }
                sb.append(matchFs.alias);
            }
            int errCode = 1116;
            throw new FrontendException(sb.toString(), errCode, PigException.INPUT);
        }else if(matchedFieldSchemas.size() == 1){
            fs = matchedFieldSchemas.get(0);
        }

        return fs;
View Full Code Here


    public FieldSchema getField(int fieldNum) throws FrontendException {
        if (fieldNum >= mFields.size()) {
            int errCode = 1026;
          String detailedMsg = "Attempt to access field: " + fieldNum + " from schema: " + this;
          String msg = "Attempt to fetch field " + fieldNum + " from schema of size " + mFields.size();
            throw new FrontendException(msg, errCode, PigException.INPUT, false, detailedMsg);
        }

        return mFields.get(fieldNum);
    }
View Full Code Here

                int errCode = 1027;
              String msg = "Cannot reconcile schemas with different "
                    + "sizes.  This schema has size " + size() + " other has size "
                    + "of " + other.size();
              String detailedMsg = "Schema size mismatch. This schema: " + this + " other schema: " + other;
                throw new FrontendException(msg, errCode, PigException.INPUT, false, detailedMsg);
            }

            Iterator<FieldSchema> i = other.mFields.iterator();
            for (int j = 0; i.hasNext(); j++) {
                FieldSchema otherFs = i.next();
View Full Code Here

        if(isSubNameMatch && twoLevelAccessRequired){
            // should not happen
            int errCode = 2248;
            String msg = "twoLevelAccessRequired==true is not supported with" +
            "and isSubNameMatch==true ";
            throw new FrontendException(msg, errCode, PigException.BUG);
        }
        if(twoLevelAccessRequired) {
            // this is the case where "this" schema is that of
            // a bag which has just one tuple fieldschema which
            // in turn has a list of fieldschemas. The alias supplied
            // should be treated as an alias in the tuple's schema
           
            // check that indeed we only have one field schema
            // which is that of a tuple
            if(mFields.size() != 1) {
                int errCode = 1008;
                String msg = "Expected a bag schema with a single " +
                "element of type "+ DataType.findTypeName(DataType.TUPLE) +
                " but got a bag schema with multiple elements.";
                throw new FrontendException(msg, errCode, PigException.INPUT);
            }
            Schema.FieldSchema tupleFS = mFields.get(0);
            if(tupleFS.type != DataType.TUPLE) {
                int errCode = 1009;
                String msg = "Expected a bag schema with a single " +
                        "element of type "+ DataType.findTypeName(DataType.TUPLE) +
                        " but got an element of type " +
                        DataType.findTypeName(tupleFS.type);
                throw new FrontendException(msg, errCode, PigException.INPUT);
            }
           
            // check if the alias supplied is that of the tuple
            // itself - then disallow it since we do not allow access
            // to the tuple itself - we only allow access to the fields
            // in the tuple
            if(alias.equals(tupleFS.alias)) {
                int errCode = 1028;
                String msg = "Access to the tuple ("+ alias + ") of " +
                        "the bag is disallowed. Only access to the elements of " +
                        "the tuple in the bag is allowed.";
                throw new FrontendException(msg, errCode, PigException.INPUT);
            }
           
            // all is good - get the position from the tuple's schema
            return tupleFS.schema.getPosition(alias);
        } else {
View Full Code Here

      // so the following cases should throw error until that changes.
      List<Class<?>> opsToCheckFor = new ArrayList<Class<?>>();
      opsToCheckFor.add(RegexExpression.class);
      int errCode = 1110;
      if(checkSuccessors(project, opsToCheckFor)) {
        throw new FrontendException("Unsupported query: " +
            "You have an partition column ("
            + fieldName + ") inside a regexp operator in the " +
            "filter condition.", errCode, PigException.INPUT);
      }
      opsToCheckFor.set(0, UserFuncExpression.class);
      if(checkSuccessors(project, opsToCheckFor)) {
        throw new FrontendException("Unsupported query: " +
            "You have an partition column ("
            + fieldName + ") inside a function in the " +
            "filter condition.", errCode, PigException.INPUT);
      }
      opsToCheckFor.set(0, CastExpression.class);
      if(checkSuccessors(project, opsToCheckFor)) {
        throw new FrontendException("Unsupported query: " +
            "You have an partition column ("
            + fieldName + ") inside a cast in the " +
            "filter condition.", errCode, PigException.INPUT);
      }

      opsToCheckFor.set(0, IsNullExpression.class);
      if(checkSuccessors(project, opsToCheckFor)) {
        throw new FrontendException("Unsupported query: " +
            "You have an partition column ("
            + fieldName + ") inside a null check operator in the " +
            "filter condition.", errCode, PigException.INPUT);
      }
      opsToCheckFor.set(0, BinCondExpression.class);
      if(checkSuccessors(project, opsToCheckFor)) {
        throw new FrontendException("Unsupported query: " +
            "You have an partition column ("
            + fieldName + ") inside a bincond operator in the " +
            "filter condition.", errCode, PigException.INPUT);
      }
      opsToCheckFor.set(0, AndExpression.class);
      opsToCheckFor.add(OrExpression.class);
      if(checkSuccessors(project, opsToCheckFor)) {
        errCode = 1112;
        throw new FrontendException("Unsupported query: " +
            "You have an partition column (" + fieldName +
            " ) in a construction like: " +
            "(pcond  and ...) or (pcond and ...) " +
            "where pcond is a condition on a partition column.",
            errCode, PigException.INPUT);
View Full Code Here

    } else if(lhsSawKey && rhsSawNonKeyCol || rhsSawKey && lhsSawNonKeyCol){
      int errCode = 1111;
      String errMsg = "Use of partition column/condition with" +
      " non partition column/condition in filter expression is not " +
      "supported." ;
      throw new FrontendException(errMsg, errCode, PigException.INPUT);
    }

    sawKey = lhsSawKey || rhsSawKey;
    sawNonKeyCol = lhsSawNonKeyCol || rhsSawNonKeyCol;
  }
View Full Code Here

        return new Expression.BinaryExpression(getExpression(binOp.getLhs())
                ,getExpression(binOp.getRhs()), opType);
    }
  private static void throwException() throws FrontendException {
    int errCode = 2209;
    throw new FrontendException(
        "Internal error while processing any partition filter " +
        "conditions in the filter after the load" ,
        errCode,
        PigException.BUG
    );
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

        } else if ("float[]".equalsIgnoreCase(klass)) {
          return FLOAT_ARRAY_CLASS;
        } else if ("string[]".equalsIgnoreCase(klass)) {
          return STRING_ARRAY_CLASS;
        } else {
            throw new FrontendException("unable to find matching class for " + klass);
        }

    }
View Full Code Here

    protected LogicalExpressionVisitor(OperatorPlan p,
                                       PlanWalker walker) throws FrontendException {
        super(p, walker);
       
        if (!(plan instanceof LogicalExpressionPlan)) {
            throw new FrontendException(
                "LogicalExpressionVisitor expects to visit " +
                "expression plans.", 2227);
        }
    }
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.