Package org.apache.pig

Examples of org.apache.pig.PigException


        pigServer.registerQuery("A = LOAD '" + inputFile + "';");
        pigServer.registerQuery("B = FOREACH A generate $0, " + UDF1.class.getName() + "($1,$1);");
        try{
            pigServer.openIterator("B");
        }catch (Exception e) {
            PigException pe = LogUtils.getPigException(e);
            String msg = (pe == null? e.getMessage(): pe.getMessage());
            assertEquals(true,msg.contains("Multiple matching functions"));
        }
       
    }
View Full Code Here


            if (pe != null) {
                log.error("You don't have permission to perform the operation. Error from the server: " + pe.getMessage());
            }
        }

        PigException pigException = LogUtils.getPigException(t);

        if(pigException != null) {
            message = "ERROR " + pigException.getErrorCode() + ": " + pigException.getMessage();
        } else {
            if((t instanceof ParseException
                    || t instanceof org.apache.pig.tools.pigscript.parser.TokenMgrError
                    || t instanceof org.apache.pig.impl.logicalLayer.parser.TokenMgrError)) {
                message = "ERROR 1000: Error during parsing. " + t.getMessage();
View Full Code Here

        pigServer.registerQuery("c = foreach b generate flatten(group) as c0;");
       
        try {
            pigServer.openIterator("c");
        } catch (Exception e) {
            PigException pe = LogUtils.getPigException(e);
            assertTrue(pe.getErrorCode()==1117);
            assertTrue(pe.getMessage().contains("Cannot merge"));
            return;
        }
        fail();
    }
View Full Code Here

      return new Pair<String, String>(dbTableNametokens[0], dbTableNametokens[1]);
    }else{
      String locationErrMsg = "The input location in load statement " +
      "should be of the form " +
      "<databasename>.<table name> or <table name>. Got " + location;
      throw new PigException(locationErrMsg, PIG_EXCEPTION_CODE);
    }
  }
View Full Code Here

    Table table = null;
    try {
      client = createHiveMetaClient(hcatServerUri, hcatServerPrincipal, PigHCatUtil.class);
      table = client.getTable(dbName, tableName);
    } catch (NoSuchObjectException nsoe){
      throw new PigException("Table not found : " + nsoe.getMessage(), PIG_EXCEPTION_CODE); // prettier error messages to frontend
    } catch (Exception e) {
      throw new IOException(e);
    }
    hcatTableCache.put(loc_server, table);
    return table;
View Full Code Here

    }

    if (type == Type.BOOLEAN){
      errMsg = "HCatalog column type 'BOOLEAN' is not supported in " +
      "Pig as a column type";
      throw new PigException(errMsg, PIG_EXCEPTION_CODE);
    }

    errMsg = "HCatalog column type '"+ type.toString() +"' is not supported in Pig as a column type";
    throw new PigException(errMsg, PIG_EXCEPTION_CODE);
  }
View Full Code Here

      }
  }

  private static void validateIsPigCompatibleMapWithPrimitives(HCatFieldSchema hfs) throws IOException{
      if (hfs.getMapKeyType() != Type.STRING){
          throw new PigException("Incompatible type in schema, found map with " +
                  "non-string key type in :"+hfs.getTypeString(), PIG_EXCEPTION_CODE);
      }
      validateIsPigCompatiblePrimitive(hfs.getMapValueSchema().getFields().get(0));
  }
View Full Code Here

      if (
              (hfs.isComplex()) ||
              (htype == Type.TINYINT) ||
              (htype == Type.SMALLINT)
              ){
            throw new PigException("Incompatible type in schema, expected pig " +
                      "compatible primitive for:" + hfs.getTypeString());
          }

  }
View Full Code Here

      try{
        HCatOutputFormat.setOutput(job, tblInfo);
      } catch(HCatException he) {
          // pass the message to the user - essentially something about the table
          // information passed to HCatOutputFormat was not right
          throw new PigException(he.getMessage(), PigHCatUtil.PIG_EXCEPTION_CODE, he);
      }
      HCatSchema hcatTblSchema = HCatOutputFormat.getTableSchema(job);
      try{
        doSchemaValidations(pigSchema, hcatTblSchema);
      } catch(HCatException he){
View Full Code Here

            PigHCatUtil.getHCatServerPrincipal(job));
    HCatSchema hcatTableSchema = HCatUtil.getTableSchemaWithPtnCols(table);
    try {
      PigHCatUtil.validateHCatTableSchemaFollowsPigRules(hcatTableSchema);
    } catch (IOException e){
      throw new PigException(
          "Table schema incompatible for reading through HCatLoader :" + e.getMessage()
          + ";[Table schema was "+ hcatTableSchema.toString() +"]"
          ,PigHCatUtil.PIG_EXCEPTION_CODE, e);
    }
    storeInUDFContext(signature, HCatConstants.HCAT_TABLE_SCHEMA, hcatTableSchema);
View Full Code Here

TOP

Related Classes of org.apache.pig.PigException

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.