Examples of PigException


Examples of org.apache.pig.PigException

            pigServer.registerQuery("C = join A by $0 + 10, B by $0 + 10 using \"merge\";");
            Iterator<Tuple> iter = pigServer.openIterator("C");

        }catch (Exception e) {
            e.printStackTrace();
            PigException pe = LogUtils.getPigException(e);
            Assert.assertEquals(1106, pe.getErrorCode());
            exceptionThrown = true;
        }
        Assert.assertEquals(true, exceptionThrown);
    }
View Full Code Here

Examples of org.apache.pig.PigException

            return lp;
        } catch (IOException e) {
            // log.error(e);
            //System.err.println("IOException Stack trace for query: " + query);
            //e.printStackTrace();
            PigException pe = LogUtils.getPigException(e);
            fail("IOException: " + (pe == null? e.getMessage(): pe.getMessage()));
        } catch (Exception e) {
            log.error(e);
            //System.err.println("Exception Stack trace for query: " + query);
            //e.printStackTrace();
            PigException pe = LogUtils.getPigException(e);
            fail(e.getClass().getName() + ": " + (pe == null? e.getMessage(): pe.getMessage()) + " -- " + query);
        }
        return null;
    }
View Full Code Here

Examples of org.apache.pig.PigException

            pig.registerQuery("store A into 'outfile' using "+DummyStorer.class.getName()+";");
            pig.executeBatch();
            assert false;
        }catch(Exception fe){
          assertTrue(fe instanceof FrontendException);
          PigException pe = LogUtils.getPigException(fe);
          assertTrue(pe instanceof FrontendException);
          assertEquals(1115, pe.getErrorCode());
          assertTrue(pe.getMessage().contains("Exception from DummyStorer."));
        }
    }
View Full Code Here

Examples of org.apache.pig.PigException

            lp = (LogicalPlan) compileLp.invoke(myPig, new Object[] { null });

            Assert.assertNotNull(lp);

        } catch (Exception e) {
            PigException pe = LogUtils.getPigException(e);
            if (pe != null) {
                throw pe;
            } else {
                e.printStackTrace();
                Assert.fail();
View Full Code Here

Examples of org.apache.pig.PigException

            mrp = (MROperPlan) compile.invoke(launcher, new Object[] { pp, myPig.getPigContext() });

            Assert.assertNotNull(mrp);

        } catch (Exception e) {
            PigException pe = LogUtils.getPigException(e);
            if (pe != null) {
                throw pe;
            } else {
                e.printStackTrace();
                Assert.fail();
View Full Code Here

Examples of org.apache.pig.PigException

     }

     public static void checkMessageInException(FrontendException e,
             String expectedErr) {
         PigException pigEx = LogUtils.getPigException(e);
         if(!pigEx.getMessage().contains(expectedErr)){
             String msg = "Expected exception message matching '"
                 + expectedErr + "' but got '" + pigEx.getMessage() + "'" ;
             fail(msg);
         }
     }
View Full Code Here

Examples of org.apache.pig.PigException

      server.registerQuery("B = foreach A generate a+10, b;");
      server.registerQuery("store B into 'junit_parted' using org.apache.howl.pig.HowlStorer('ds=20100101');");
      server.executeBatch();
    }
    catch(PigException fe){
      PigException pe = LogUtils.getPigException(fe);
      assertTrue(pe instanceof FrontendException);
      assertEquals(PigHowlUtil.PIG_EXCEPTION_CODE, pe.getErrorCode());
      assertTrue(pe.getMessage().contains("Column name for a field is not specified. Please provide the full schema as an argument to HowlStorer."));
      errCaught = true;
    }
    assertTrue(errCaught);
    errCaught = false;
    try{
      server.setBatchOn();
      server.registerQuery("A = load '"+ fullFileName +"' as (a:int, B:chararray);");
      server.registerQuery("B = foreach A generate a, B;");
      server.registerQuery("store B into 'junit_parted' using org.apache.howl.pig.HowlStorer('ds=20100101');");
      server.executeBatch();
    }
    catch(PigException fe){
      PigException pe = LogUtils.getPigException(fe);
      assertTrue(pe instanceof FrontendException);
      assertEquals(PigHowlUtil.PIG_EXCEPTION_CODE, pe.getErrorCode());
      assertTrue(pe.getMessage().contains("Column names should all be in lowercase. Invalid name found: B"));
      errCaught = true;
    }
    driver.run("drop table junit_parted");
    assertTrue(errCaught);
  }
View Full Code Here

Examples of org.apache.pig.PigException

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

Examples of org.apache.pig.PigException

      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

Examples of org.apache.pig.PigException

    Table table = null;
    try {
      client = createHiveMetaClient(howlServerUri, howlServerPrincipal, PigHowlUtil.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);
    }
    howlTableCache.put(loc_server, table);
    return table;
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.