Initial import into git.
[galago.git] / java / pig-galago / src / com / yahoo / pig / impl / logicalLayer / LogicalPlanBuilder.java
blob3b6652512dec7c5e2c8c4ec3e92fa216a92731a9
1 /*
2 * Copyright (c) 2007 Yahoo! Inc. All rights reserved.
3 * See accompanying LICENSE file.
4 */
5 package com.yahoo.pig.impl.logicalLayer;
7 import java.io.ByteArrayInputStream;
8 import java.io.IOException;
9 import java.util.Map;
11 import com.yahoo.pig.impl.PigContext;
12 import com.yahoo.pig.impl.logicalLayer.parser.ParseException;
13 import com.yahoo.pig.impl.logicalLayer.parser.QueryParser;
14 import com.yahoo.pig.impl.physicalLayer.IntermedResult;
16 /**
17 * PlanBuilder class outputs a logical plan given a query String and set of ValidIDs
20 public class LogicalPlanBuilder {
21 public static ClassLoader classloader = LogicalPlanBuilder.class.getClassLoader();
22 private PigContext pigContext;
23 public LogicalPlanBuilder(PigContext pigContext) {
24 this.pigContext = pigContext;
27 public LogicalPlan parse(String query, Map<String, IntermedResult> aliases)
28 throws IOException, ParseException {
29 ByteArrayInputStream in = new ByteArrayInputStream(query.getBytes());
30 QueryParser parser = new QueryParser(in, pigContext, aliases);
31 return parser.Parse();