svn commit: r679062 - in /incubator/pig/branches/types: src/org/apache/pig/impl/logicalLayer/LOCogroup.java src/org/apache/pig/impl/logicalLayer/LOMapLookup.java test/org/apache/pig/test/TestLogicalPl
Author: pisong Date: Wed Jul 23 03:42:58 2008 New Revision: 679062 URL: http://svn.apache.org/viewvc?rev=679062view=rev Log: PIG-306 Fixed schema of group by multiple fields Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOCogroup.java incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOMapLookup.java incubator/pig/branches/types/test/org/apache/pig/test/TestLogicalPlanBuilder.java Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOCogroup.java URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOCogroup.java?rev=679062r1=679061r2=679062view=diff == --- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOCogroup.java (original) +++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOCogroup.java Wed Jul 23 03:42:58 2008 @@ -30,6 +30,7 @@ import org.apache.pig.impl.plan.VisitorException; import org.apache.pig.impl.logicalLayer.FrontendException; import org.apache.pig.impl.logicalLayer.schema.Schema; +import org.apache.pig.impl.logicalLayer.schema.SchemaMergeException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.pig.impl.util.MultiMap; @@ -107,80 +108,81 @@ // one more to account for the group // the alias of the first field is group and hence the // string group -// TODO The type of the field named group requires -// type promotion and the like /* * Here goes an attempt to describe how the schema for the first - * column - 'group' should look like If the number of group by + * column - 'group' should look like. If the number of group by * columns = 1 then the schema for 'group' is the * schema(fieldschema(col)) If the number of group by columns 1 * then find the set union of the group by columns and form the * schema as schema(listfieldschema of the cols) * The parser will ensure that the number of group by columns are * the same across all inputs. The computation of the schema for group - * is + * is as follows: + * For each input of cogroup, for each operator (projection ,udf, constant), etc. + * compute the multimaps group_column_number, alias and group_column_number, operator + * and alias, expression_operator + * Also set the lookup table for each alias to false */ Schema groupBySchema = null; ListSchema.FieldSchema groupByFss = new ArrayListSchema.FieldSchema(); -SetString groupByAliases = new HashSetString(); -MapString, Boolean lookup = new HashMapString, Boolean(); +MapString, Boolean aliasLookup = new HashMapString, Boolean(); MultiMapString, ExpressionOperator aliasExop = new MultiMapString, ExpressionOperator(); -MultiMapInteger, String positionAlias= new MultiMapInteger, String(); +MultiMapInteger, String positionAlias = new MultiMapInteger, String(); +MultiMapInteger, ExpressionOperator positionOperators = new MultiMapInteger, ExpressionOperator(); for (LogicalOperator op : inputs) { -log.debug(GBY Input: + op.getClass().getName()); +int position = 0; for(LogicalPlan plan: mGroupByPlans.get(op)) { -int position = 0; for(LogicalOperator eOp: plan.getLeaves()) { -log.debug(Leaf: + eOp); Schema.FieldSchema fs = ((ExpressionOperator)eOp).getFieldSchema(); -if(null != fs) { -Schema eOpSchema = fs.schema; -log.debug(Computing the lookup tables); -if (null != fs) { -String alias = fs.alias; -//for (String alias : eOpSchema.getAliases()) { -if(null != alias) { -log.debug(Adding alias to GBY: + alias); -groupByAliases.add(alias); -lookup.put(alias, false); -aliasExop.put(alias, (ExpressionOperator)eOp); -positionAlias.put(position, alias); -} +if (null != fs) { +String alias = fs.alias; +if(null != alias) { +aliasLookup.put(alias, false); +
svn commit: r679166 - in /incubator/pig/branches/types: ./ src/org/apache/pig/ src/org/apache/pig/impl/logicalLayer/ src/org/apache/pig/impl/logicalLayer/parser/ src/org/apache/pig/tools/grunt/ src/or
Author: olga Date: Wed Jul 23 12:35:55 2008 New Revision: 679166 URL: http://svn.apache.org/viewvc?rev=679166view=rev Log: PIG-270: proper line number for parse errors Modified: incubator/pig/branches/types/CHANGES.txt incubator/pig/branches/types/src/org/apache/pig/PigServer.java incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LogicalPlanBuilder.java incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt incubator/pig/branches/types/src/org/apache/pig/tools/grunt/GruntParser.java incubator/pig/branches/types/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj Modified: incubator/pig/branches/types/CHANGES.txt URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/CHANGES.txt?rev=679166r1=679165r2=679166view=diff == --- incubator/pig/branches/types/CHANGES.txt (original) +++ incubator/pig/branches/types/CHANGES.txt Wed Jul 23 12:35:55 2008 @@ -141,3 +141,5 @@ PIG-258: cleaning up directories on failure (daijy via olgan) PIG-139: command line editing + +PIG-270: proper line number for parse errors Modified: incubator/pig/branches/types/src/org/apache/pig/PigServer.java URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/PigServer.java?rev=679166r1=679165r2=679166view=diff == --- incubator/pig/branches/types/src/org/apache/pig/PigServer.java (original) +++ incubator/pig/branches/types/src/org/apache/pig/PigServer.java Wed Jul 23 12:35:55 2008 @@ -227,9 +227,11 @@ * * @param query *a Pig Latin expression to be evaluated. + * @param startLine + *line number of the query within the whold script * @throws IOException - */ -public void registerQuery(String query) throws IOException { + */ +public void registerQuery(String query, int startLine) throws IOException { // Bugzilla Bug 1006706 -- ignore empty queries //= if(query != null) { @@ -242,12 +244,16 @@ LogicalPlan lp = null; try { lp = (new LogicalPlanBuilder(pigContext).parse(scope, query, -aliases, opTable, aliasOp)); +aliases, opTable, aliasOp, startLine)); } catch (ParseException e) { throw (IOException) new IOException(e.getMessage()).initCause(e); } } - + +public void registerQuery(String query) throws IOException { +registerQuery(query, 1); +} + public void dumpSchema(String alias) throws IOException{ try { LogicalPlan lp = getPlanFromAlias(alias, describe); Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LogicalPlanBuilder.java URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LogicalPlanBuilder.java?rev=679166r1=679165r2=679166view=diff == --- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LogicalPlanBuilder.java (original) +++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LogicalPlanBuilder.java Wed Jul 23 12:35:55 2008 @@ -45,9 +45,18 @@ MapOperatorKey, LogicalOperator opTable, MapString, LogicalOperator aliasOp) throws IOException, ParseException { +return parse(scope, query, aliases, opTable, aliasOp, 1); + } + +public LogicalPlan parse(String scope, +String query, +MapLogicalOperator, LogicalPlan aliases, +MapOperatorKey, LogicalOperator opTable, +MapString, LogicalOperator aliasOp, int start) +throws IOException, ParseException { ByteArrayInputStream in = new ByteArrayInputStream(query.getBytes()); //QueryParser parser = new QueryParser(in, pigContext, scope, aliases, opTable); -QueryParser parser = new QueryParser(in, pigContext, scope, aliases, opTable, aliasOp); +QueryParser parser = new QueryParser(in, pigContext, scope, aliases, opTable, aliasOp, start); return parser.Parse(); } Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt?rev=679166r1=679165r2=679166view=diff == --- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt (original) +++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt Wed Jul 23 12:35:55 2008 @@
svn commit: r679175 - /incubator/pig/branches/branch-0.1/README.txt
Author: olga Date: Wed Jul 23 12:55:47 2008 New Revision: 679175 URL: http://svn.apache.org/viewvc?rev=679175view=rev Log: fixed project name an afiliation Modified: incubator/pig/branches/branch-0.1/README.txt Modified: incubator/pig/branches/branch-0.1/README.txt URL: http://svn.apache.org/viewvc/incubator/pig/branches/branch-0.1/README.txt?rev=679175r1=679174r2=679175view=diff == --- incubator/pig/branches/branch-0.1/README.txt (original) +++ incubator/pig/branches/branch-0.1/README.txt Wed Jul 23 12:55:47 2008 @@ -9,12 +9,11 @@ Disclaimer == -Apache Sling is an effort undergoing incubation at The Apache Software -Foundation (ASF), sponsored by the Apache Jackrabbit PMC. Incubation is -required of all newly accepted projects until a further review indicates that -the infrastructure, communications, and decision making process have -stabilized in a manner consistent with other successful ASF projects. While -incubation status is not necessarily a reflection of the completeness or -stability of the code, it does indicate that the project has yet to be fully -endorsed by the ASF. +Apache Pig is an effort undergoing incubation at The Apache Software +Foundation (ASF). Incubation is required of all newly accepted projects +until a further review indicates that the infrastructure, communications, +and decision making process have stabilized in a manner consistent with +other successful ASF projects. While incubation status is not necessarily +a reflection of the completeness or stability of the code, it does indicate +that the project has yet to be fully endorsed by the ASF.