Package org.apache.pig

Examples of org.apache.pig.PigException


        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


            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

            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

                HCatOutputFormat.setOutput(job, outputJobInfo);
            } 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);
View Full Code Here

            "d = foreach c generate i,j,l,a::i,a::j,b::i,b::l;";
            boolean exceptionThrown = false;
            try{
                Util.registerMultiLineQuery(pigServer, script);
            }catch (Exception e) {
                PigException pe = LogUtils.getPigException(e);
                assertEquals(1025, pe.getErrorCode());
                exceptionThrown = true;
            }
            assertEquals(true, exceptionThrown);
           
            // schema with duplicates with resolution
View Full Code Here

                        script +=  "c = join a by $0 left, b by $0;" ;
                    }
                    try {
                        Util.registerMultiLineQuery(pigServer, script);
                    } catch (Exception e) {
                        PigException pe = LogUtils.getPigException(e);
                        assertEquals(1105, pe.getErrorCode());
                    }
                }
            }
            deleteInputFile(execType, firstInput);
            deleteInputFile(execType, secondInput);
View Full Code Here

                        script +=  "c = join a by $0 right, b by $0;" ;
                    }
                    try {
                        Util.registerMultiLineQuery(pigServer, script);
                    } catch (Exception e) {
                        PigException pe = LogUtils.getPigException(e);
                        assertEquals(1105, pe.getErrorCode());
                    }
                }
            }
            deleteInputFile(execType, firstInput);
            deleteInputFile(execType, secondInput);
View Full Code Here

                        script +=  "c = join a by $0 full, b by $0;" ;
                    }
                    try {
                        Util.registerMultiLineQuery(pigServer, script);
                    } catch (Exception e) {
                        PigException pe = LogUtils.getPigException(e);
                        assertEquals(1105, pe.getErrorCode());
                    }
                }
            }
            deleteInputFile(execType, firstInput);
            deleteInputFile(execType, secondInput);
View Full Code Here

        pigServer.registerQuery("B = LOAD '" + INPUT_FILE + "' as (id, name);");
        pigServer.registerQuery("C = LOAD '" + INPUT_FILE + "' as (id, name);");
        try {
            pigServer.registerQuery("D = join A by id, B by id, C by id using \"merge\";");
        }catch(Exception e) {
            PigException pe = LogUtils.getPigException(e);
            Assert.assertEquals(1000,pe.getErrorCode());
            return;
        }
        Assert.fail("Should throw exception, do not support 3 way join");
    }      
View Full Code Here

        pigServer.registerQuery("C = ORDER A by $0 parallel 5;");
        pigServer.registerQuery("D = join A by id, C by id using \"merge\";");
        try {
            pigServer.openIterator("D");
        }catch(Exception e) {
            PigException pe = LogUtils.getPigException(e);
            Assert.assertEquals(1103,pe.getErrorCode());
            return;
        }
        Assert.fail("Should fail to compile");
    }      
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.