[jira] [Commented] (PIG-2021) Parser error while referring a map nested foreach

2011-05-10 Thread Vivek Padmanabhan (JIRA)

[ 
https://issues.apache.org/jira/browse/PIG-2021?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13031114#comment-13031114
 ] 

Vivek Padmanabhan commented on PIG-2021:


Hi Xuefu,
 Extremely sorry about that.I was just trying to remove the dependencies.Please 
check whether the below is a valid case;

{code}
register mymapudf.jar;
A = load 'temp' as ( s, m, l );
B = foreach A generate *, org.vivek.udfs.mToMapUDF((chararray) s) as mapout;
C = foreach B {
  urlpath = (chararray) mapout#'k1';
  lc_urlpath = org.vivek.udfs.LOWER((chararray) urlpath);
  generate urlpath,lc_urlpath;
};
{code}


Source for org.vivek.udfs.mToMapUDF
{code}
package org.vivek.udfs;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.apache.pig.EvalFunc;
import org.apache.pig.data.DataType;
import org.apache.pig.data.Tuple;
import org.apache.pig.impl.logicalLayer.schema.Schema;
public class mToMapUDF  extends EvalFuncMap {
public MapString, Object exec(Tuple arg0) throws IOException {
Map String,Object myMapTResult =  new HashMapString, 
Object();
myMapTResult.put(k1, SomeString);
myMapTResult.put(k3, SomeOtherString);
return myMapTResult;
}
public Schema outputSchema(Schema input) {
return new Schema(new 
Schema.FieldSchema(mapout,DataType.MAP));
}
}
{code}



Source for org.vivek.udfs.LOWER
{code}
package org.vivek.udfs;
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;
import org.apache.pig.EvalFunc;
import org.apache.pig.data.Tuple;
import org.apache.pig.data.DataType;
import org.apache.pig.impl.logicalLayer.schema.Schema;
import org.apache.pig.impl.logicalLayer.FrontendException;
import org.apache.pig.FuncSpec;
public class LOWER extends EvalFuncString {
public String exec(Tuple input) throws IOException {
if (input == null || input.size() == 0)
return null;
try {
String str = (String)input.get(0);
return str.toLowerCase();
} catch(Exception e){
return null;
}
}
public Schema outputSchema(Schema input) {
return new Schema(new 
Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), 
input), DataType.CHARARRAY));
}
 public ListFuncSpec getArgToFuncMapping() throws FrontendException {
ListFuncSpec funcList = new ArrayListFuncSpec();
funcList.add(new FuncSpec(this.getClass().getName(), new Schema(new 
Schema.FieldSchema(null, DataType.CHARARRAY;
return funcList;
 }
}
{code}



 Parser error while referring a map nested foreach
 -

 Key: PIG-2021
 URL: https://issues.apache.org/jira/browse/PIG-2021
 Project: Pig
  Issue Type: Bug
Affects Versions: 0.9.0
Reporter: Vivek Padmanabhan
Assignee: Xuefu Zhang
 Fix For: 0.9.0


 The below script is throwing parser errors
 {code}
 register string.jar;
 A = load 'test1'  using MapLoader() as ( s, m, l );   
 B = foreach A generate *, string.URLPARSE((chararray) s#'url') as parsedurl;
 C = foreach B {
   urlpath = (chararray) parsedurl#'path';
   lc_urlpath = string.TOLOWERCASE((chararray) urlpath);
   generate *;
 };
 {code}
 Error message;
 | Failed to generate logical plan.
 |Nested exception: org.apache.pig.impl.logicalLayer.FrontendException: ERROR 
 2225: Projection with nothing to reference!
 PIG-2002 reports a similar issue, but when i tried with the patch of PIG-2002 
 i was getting the below exception;
  ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: file repro.pig, line 
 11, column 33  mismatched input '(' expecting SEMI_COLON

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (PIG-2021) Parser error while referring a map nested foreach

2011-05-10 Thread Xuefu Zhang (JIRA)

[ 
https://issues.apache.org/jira/browse/PIG-2021?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13031368#comment-13031368
 ] 

Xuefu Zhang commented on PIG-2021:
--

Hi Vivek,

This morning we found that there was a little disparity between 0.9 and trunk 
regarding this fix. Yes, you would still have this problem in 0.9, but with the 
latest checkin, the problem should have been addressed. Let me know if you 
found that this is not the case.

--Xuefu

 Parser error while referring a map nested foreach
 -

 Key: PIG-2021
 URL: https://issues.apache.org/jira/browse/PIG-2021
 Project: Pig
  Issue Type: Bug
Affects Versions: 0.9.0
Reporter: Vivek Padmanabhan
Assignee: Xuefu Zhang
 Fix For: 0.9.0


 The below script is throwing parser errors
 {code}
 register string.jar;
 A = load 'test1'  using MapLoader() as ( s, m, l );   
 B = foreach A generate *, string.URLPARSE((chararray) s#'url') as parsedurl;
 C = foreach B {
   urlpath = (chararray) parsedurl#'path';
   lc_urlpath = string.TOLOWERCASE((chararray) urlpath);
   generate *;
 };
 {code}
 Error message;
 | Failed to generate logical plan.
 |Nested exception: org.apache.pig.impl.logicalLayer.FrontendException: ERROR 
 2225: Projection with nothing to reference!
 PIG-2002 reports a similar issue, but when i tried with the patch of PIG-2002 
 i was getting the below exception;
  ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: file repro.pig, line 
 11, column 33  mismatched input '(' expecting SEMI_COLON

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (PIG-2021) Parser error while referring a map nested foreach

2011-05-09 Thread Vivek Padmanabhan (JIRA)

[ 
https://issues.apache.org/jira/browse/PIG-2021?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13030682#comment-13030682
 ] 

Vivek Padmanabhan commented on PIG-2021:


Attaching a script avoiding all the dependencies;

{code}
A = load 'temp' as ( s, m, l );
B = foreach A generate *, LOWER((chararray) s#'url') as parsedurl;
C = foreach B {
  urlpath = (chararray) parsedurl#'path';
  lc_urlpath = org.apache.pig.piggybank.evaluation.string.Reverse((chararray) 
urlpath);
  generate *;
};
{code}

 Parser error while referring a map nested foreach
 -

 Key: PIG-2021
 URL: https://issues.apache.org/jira/browse/PIG-2021
 Project: Pig
  Issue Type: Bug
Affects Versions: 0.9.0
Reporter: Vivek Padmanabhan
Assignee: Xuefu Zhang
 Fix For: 0.9.0


 The below script is throwing parser errors
 {code}
 register string.jar;
 A = load 'test1'  using MapLoader() as ( s, m, l );   
 B = foreach A generate *, string.URLPARSE((chararray) s#'url') as parsedurl;
 C = foreach B {
   urlpath = (chararray) parsedurl#'path';
   lc_urlpath = string.TOLOWERCASE((chararray) urlpath);
   generate *;
 };
 {code}
 Error message;
 | Failed to generate logical plan.
 |Nested exception: org.apache.pig.impl.logicalLayer.FrontendException: ERROR 
 2225: Projection with nothing to reference!
 PIG-2002 reports a similar issue, but when i tried with the patch of PIG-2002 
 i was getting the below exception;
  ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: file repro.pig, line 
 11, column 33  mismatched input '(' expecting SEMI_COLON

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (PIG-2021) Parser error while referring a map nested foreach

2011-05-09 Thread Xuefu Zhang (JIRA)

[ 
https://issues.apache.org/jira/browse/PIG-2021?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13030889#comment-13030889
 ] 

Xuefu Zhang commented on PIG-2021:
--

The above test case seems having a few problems:

1. LOWER() returns a string, so parsedurl is a string. However, it's later used 
as a map. Such conversion is invalid.

2. generate * will output input, so the nested commands in the second foreach 
is useless.

3. with latest in the trunk, the above query parses without problem.

grunt A = load 'temp' as ( s, m, l );
grunt B = foreach A generate *, LOWER((chararray) s#'url') as parsedurl;
2011-05-09 13:37:04,796 [main] WARN  org.apache.pig.PigServer - Encountered 
Warning IMPLICIT_CAST_TO_MAP 1 time(s).
grunt C = foreach B {
   urlpath = (chararray) parsedurl#'path';
   lc_urlpath = 
 org.apache.pig.piggybank.evaluation.string.Reverse((chararray) urlpath);
   generate *;
 };
2011-05-09 13:37:06,315 [main] WARN  org.apache.pig.PigServer - Encountered 
Warning IMPLICIT_CAST_TO_MAP 1 time(s).
grunt describe C;
2011-05-09 13:37:10,676 [main] WARN  org.apache.pig.PigServer - Encountered 
Warning IMPLICIT_CAST_TO_MAP 1 time(s).
C: {s: bytearray,m: bytearray,l: bytearray,parsedurl: chararray}

Please provide a valid case.

 Parser error while referring a map nested foreach
 -

 Key: PIG-2021
 URL: https://issues.apache.org/jira/browse/PIG-2021
 Project: Pig
  Issue Type: Bug
Affects Versions: 0.9.0
Reporter: Vivek Padmanabhan
Assignee: Xuefu Zhang
 Fix For: 0.9.0


 The below script is throwing parser errors
 {code}
 register string.jar;
 A = load 'test1'  using MapLoader() as ( s, m, l );   
 B = foreach A generate *, string.URLPARSE((chararray) s#'url') as parsedurl;
 C = foreach B {
   urlpath = (chararray) parsedurl#'path';
   lc_urlpath = string.TOLOWERCASE((chararray) urlpath);
   generate *;
 };
 {code}
 Error message;
 | Failed to generate logical plan.
 |Nested exception: org.apache.pig.impl.logicalLayer.FrontendException: ERROR 
 2225: Projection with nothing to reference!
 PIG-2002 reports a similar issue, but when i tried with the patch of PIG-2002 
 i was getting the below exception;
  ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: file repro.pig, line 
 11, column 33  mismatched input '(' expecting SEMI_COLON

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (PIG-2021) Parser error while referring a map nested foreach

2011-05-08 Thread Xuefu Zhang (JIRA)

[ 
https://issues.apache.org/jira/browse/PIG-2021?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13030460#comment-13030460
 ] 

Xuefu Zhang commented on PIG-2021:
--

Could you please attach your string.jar file here so as for me to reproduce the 
problem? Thanks.

 Parser error while referring a map nested foreach
 -

 Key: PIG-2021
 URL: https://issues.apache.org/jira/browse/PIG-2021
 Project: Pig
  Issue Type: Bug
Affects Versions: 0.9.0
Reporter: Vivek Padmanabhan
Assignee: Xuefu Zhang
 Fix For: 0.9.0


 The below script is throwing parser errors
 {code}
 register string.jar;
 A = load 'test1'  using MapLoader() as ( s, m, l );   
 B = foreach A generate *, string.URLPARSE((chararray) s#'url') as parsedurl;
 C = foreach B {
   urlpath = (chararray) parsedurl#'path';
   lc_urlpath = string.TOLOWERCASE((chararray) urlpath);
   generate *;
 };
 {code}
 Error message;
 | Failed to generate logical plan.
 |Nested exception: org.apache.pig.impl.logicalLayer.FrontendException: ERROR 
 2225: Projection with nothing to reference!
 PIG-2002 reports a similar issue, but when i tried with the patch of PIG-2002 
 i was getting the below exception;
  ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: file repro.pig, line 
 11, column 33  mismatched input '(' expecting SEMI_COLON

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira