Package org.apache.pig

Examples of org.apache.pig.PigException


    if (type == Type.BOOLEAN && pigHasBooleanSupport) {
      return DataType.BOOLEAN;
    }

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


    try {
      Type hType = hcatField.getType();
      switch (hType) {
      case BOOLEAN:
        if (!pigHasBooleanSupport) {
          throw new PigException("Incompatible type found in HCat table schema: "
              + hcatField, PigHCatUtil.PIG_EXCEPTION_CODE);
        }
        break;
      case ARRAY:
        validateHCatSchemaFollowsPigRules(hcatField.getArrayElementSchema());
        break;
      case STRUCT:
        validateHCatSchemaFollowsPigRules(hcatField.getStructSubSchema());
        break;
      case MAP:
        // key is only string
        if (hcatField.getMapKeyType() != Type.STRING) {
          LOG.info("Converting non-String key of map " + hcatField.getName() + " from "
            + hcatField.getMapKeyType() + " to String.");
        }
        validateHCatSchemaFollowsPigRules(hcatField.getMapValueSchema());
        break;
      }
    } catch (HCatException e) {
      throw new PigException("Incompatible type found in hcat table schema: " + hcatField, PigHCatUtil.PIG_EXCEPTION_CODE, e);
    }
  }
View Full Code Here

            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

            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

        pigServer.registerQuery("B = FOREACH A generate x, " + UDF3.class.getName() + "(x,y);");
        try {
            Iterator<Tuple> iter = pigServer.openIterator("B");
        } catch(Exception e) {
            exceptionCaused = true;
            PigException pe = LogUtils.getPigException(e);
            String msg = (pe == null? e.getMessage(): pe.getMessage());
            assertTrue(msg.contains("Multiple matching functions"));
            assertTrue(msg.contains("{float,double}, {float,long}"));
        }
        assertTrue(exceptionCaused);
    }
View Full Code Here

        pigServer.registerQuery("B = FOREACH A generate x, " + UDF3.class.getName() + "(x,y, y);");
        try {
            Iterator<Tuple> iter = pigServer.openIterator("B");
        }catch(Exception e) {
            exceptionCaused = true;
            PigException pe = LogUtils.getPigException(e);
            String msg = (pe == null? e.getMessage(): pe.getMessage());
            assertTrue(msg.contains("Multiple matching functions"));
            assertTrue(msg.contains("({float,double,long}, {float,long,double})"));
        }
        assertTrue(exceptionCaused);
    }
View Full Code Here

        pigServer.registerQuery("B = FOREACH A generate x, " + UDF3.class.getName() + "(x,y, y);");
        try {
            Iterator<Tuple> iter = pigServer.openIterator("B");
        }catch(Exception e) {
            exceptionCaused = true;
            PigException pe = LogUtils.getPigException(e);
            String msg = (pe == null? e.getMessage(): pe.getMessage());
            assertTrue(msg.contains("Multiple matching functions"));
            assertTrue(msg.contains("({float,double,long}, {float,long,double})"));
        }
        assertTrue(exceptionCaused);
    }
View Full Code Here

        pigServer.registerQuery("B = FOREACH A generate x, " + UDF3.class.getName() + "(x,y, y);");
        try {
            Iterator<Tuple> iter = pigServer.openIterator("B");
        }catch(Exception e) {
            exceptionCaused = true;
            PigException pe = LogUtils.getPigException(e);
            String msg = (pe == null? e.getMessage(): pe.getMessage());
            assertTrue(msg.contains("Could not infer the matching function"));
        }
        assertTrue(exceptionCaused);
    }
View Full Code Here

        pigServer.registerQuery("B = FOREACH A generate x, " + UDF3.class.getName() + "(x,y, y);");
        try {
            Iterator<Tuple> iter = pigServer.openIterator("B");
        }catch(Exception e) {
            exceptionCaused = true;
            PigException pe = LogUtils.getPigException(e);
            String msg = (pe == null? e.getMessage(): pe.getMessage());
            assertTrue(msg.contains("Multiple matching functions"));
            assertTrue(msg.contains("({float,double,long}, {float,long,double}"));
        }
        assertTrue(exceptionCaused);
    }
View Full Code Here

        pigServer.registerQuery("A = LOAD '" + inputFile + "' as (x:long, y:int);");
        pigServer.registerQuery("B = FOREACH A generate x, " + UDF1.class.getName() + "(y,y);");
        try{
            pigServer.openIterator("B");
        }catch (Exception e) {
            PigException pe = LogUtils.getPigException(e);
            String msg = (pe == null? e.getMessage(): pe.getMessage());
            assertEquals(true,msg.contains("as multiple or none of them fit"));
        }
       
    }
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.