Package org.apache.pig.parser

Examples of org.apache.pig.parser.QueryParserDriver


        DataStorage dfs = pc.getDfs();
        dfs.setActiveContainer(dfs.asContainer("/tmp"));
        Map<String, String> fileNameMap = new HashMap<String, String>();
       
        QueryParserDriver builder = new QueryParserDriver(pc, "Test-Store", fileNameMap);
       
        String query = "a = load 'foo';" + "store a into '"+orig+"';";
        LogicalPlan lp = builder.parse(query);

        Assert.assertTrue(lp.size()>1);
        Operator op = lp.getSinks().get(0);
       
        Assert.assertTrue(op instanceof LOStore);
View Full Code Here


            }
        }
       
        void validateQuery() throws FrontendException {
            String query = buildQuery();
            QueryParserDriver parserDriver = new QueryParserDriver( pigContext, scope, fileNameMap );
            try {
                LogicalPlan plan = parserDriver.parse( query );
                compile( plan );
            } catch(FrontendException ex) {
                scriptCache.remove( scriptCache.size() -1 );
                throw ex;
            }
View Full Code Here

                lp = new LogicalPlan();
                return;
            }

            try {
                QueryParserDriver parserDriver = new QueryParserDriver( pigContext, scope, fileNameMap );
                lp = parserDriver.parse( query );
                operators = parserDriver.getOperators();
            } catch(Exception ex) {
                scriptCache.remove( scriptCache.size() -1 ); // remove the bad script from the cache.
                PigException pe = LogUtils.getPigException(ex);
                int errCode = 1000;
                String msg = "Error during parsing. "
View Full Code Here

            throw new IllegalStateException("ExecType: " + context.getExecType());
        }
    }

    public static Object getPigConstant(String pigConstantAsString) throws ParserException {
        QueryParserDriver queryParser = new QueryParserDriver( new PigContext(),
            "util", new HashMap<String, String>() ) ;
        return queryParser.parseConstant(pigConstantAsString);
    }
View Full Code Here

     
    }

    public static LogicalPlan parse(String query, PigContext pc) throws FrontendException {
        Map<String, String> fileNameMap = new HashMap<String, String>();
        QueryParserDriver parserDriver = new QueryParserDriver( pc, "test", fileNameMap );
        org.apache.pig.newplan.logical.relational.LogicalPlan lp = parserDriver.parse( query );
       
        new ColumnAliasConversionVisitor( lp ).visit();
        new SchemaAliasVisitor( lp ).visit();
        new ScalarVisitor( lp, pc ).visit();
       
View Full Code Here

        return lp;
    }
   
    public static LogicalPlan parseAndPreprocess(String query, PigContext pc) throws FrontendException {
        Map<String, String> fileNameMap = new HashMap<String, String>();
        QueryParserDriver parserDriver = new QueryParserDriver( pc, "test", fileNameMap );
        org.apache.pig.newplan.logical.relational.LogicalPlan lp = parserDriver.parse( query );
       
        new ColumnAliasConversionVisitor( lp ).visit();
        new SchemaAliasVisitor( lp ).visit();
        new ScalarVisitor( lp, pc ).visit();
       
View Full Code Here

                   
            DataStorage dfs = pc.getDfs();
            dfs.setActiveContainer(dfs.asContainer("/tmp"));
            Map<String, String> fileNameMap = new HashMap<String, String>();
           
            QueryParserDriver builder = new QueryParserDriver(pc, "Test-Load", fileNameMap);
           
            String query = "a = load '"+orig+"';";
            LogicalPlan lp = builder.parse(query);
            Assert.assertTrue(lp.size()>0);
            Operator op = lp.getSources().get(0);
           
            Assert.assertTrue(op instanceof LOLoad);
            LOLoad load = (LOLoad)op;
View Full Code Here

        Schema.setSchemaDefaultType(result, DataType.BYTEARRAY);
        return result;
    }

  public static LogicalSchema parseSchema(String schemaString) throws ParserException {
    QueryParserDriver queryParser = new QueryParserDriver( new PigContext(),
            "util", new HashMap<String, String>() ) ;
        LogicalSchema schema = queryParser.parseSchema(schemaString);
    return schema;
  }
View Full Code Here

            }
        }
       
        void validateQuery() throws FrontendException {
            String query = buildQuery();
            QueryParserDriver parserDriver = new QueryParserDriver( pigContext, scope, fileNameMap );
            try {
                LogicalPlan plan = parserDriver.parse( query );
                compile( plan );
            } catch(FrontendException ex) {
                scriptCache.remove( scriptCache.size() -1 );
                throw ex;
            }
View Full Code Here

                lp = new LogicalPlan();
                return;
            }

            try {
                QueryParserDriver parserDriver = new QueryParserDriver( pigContext, scope, fileNameMap );
                lp = parserDriver.parse( query );
                operators = parserDriver.getOperators();
            } catch(Exception ex) {
                scriptCache.remove( scriptCache.size() -1 ); // remove the bad script from the cache.
                PigException pe = LogUtils.getPigException(ex);
                int errCode = 1000;
                String msg = "Error during parsing. "
View Full Code Here

TOP

Related Classes of org.apache.pig.parser.QueryParserDriver

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.