2 * Copyright (c) 2007 Yahoo! Inc. All rights reserved.
3 * See accompanying LICENSE file.
5 package com
.yahoo
.pig
.impl
.logicalLayer
;
7 import java
.io
.ByteArrayInputStream
;
8 import java
.io
.IOException
;
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
;
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();