Unable to execute pig scripts using Azure powershell -


this pig script

$querystring = "a =  load 'wasb://$containername@$storageaccount.blob.core.windows.net/table1' using pigstorage(',') (col1 chararray,col2 chararray,col3 chararray,col4 chararray,col5 chararray,col6 chararray,col7 int,col8 int);" + "user_list = foreach generate $0;" + "unique_user = distinct user_list;" + "unique_users_group = group unique_user all;" + "uu_count = foreach unique_users_group generate count(unique_user);" + "dump uu_count;" 

i error when execute above pig script

'2015-04-14 23:17:55,177 [main] error org.apache.pig.pigserver - exception during parsing: error during parsing. <line 1, column 166>  mismatched input 'chararray' expecting right_paren failed parse: <line 1, column 166>  mismatched input 'chararray' expecting right_paren @ org.apache.pig.parser.queryparserdriver.parse(queryparserdriver.java:241) @ org.apache.pig.parser.queryparserdriver.parse(queryparserdriver.java:179) @ org.apache.pig.pigserver$graph.parsequery(pigserver.java:1678) @ org.apache.pig.pigserver$graph.access$000(pigserver.java:1411) @ org.apache.pig.pigserver.parseandbuild(pigserver.java:344) @ org.apache.pig.pigserver.executebatch(pigserver.java:369) @ org.apache.pig.pigserver.executebatch(pigserver.java:355) @ org.apache.pig.tools.grunt.gruntparser.executebatch(gruntparser.java:140) @ org.apache.pig.tools.grunt.gruntparser.processdump(gruntparser.java:769) @ org.apache.pig.tools.pigscript.parser.pigscriptparser.parse(pigscriptparser.java:372) @ org.apache.pig.tools.grunt.gruntparser.parsestoponerror(gruntparser.java:198) @ org.apache.pig.tools.grunt.gruntparser.parsestoponerror(gruntparser.java:173) @ org.apache.pig.tools.grunt.grunt.exec(grunt.java:84) @ org.apache.pig.main.run(main.java:509) @ org.apache.pig.main.main(main.java:156) 2015-04-14 23:17:55,177 [main] error org.apache.pig.tools.grunt.grunt -   error 1200: <line 1, column 166>  mismatched input 'chararray' expecting right_paren 

i edited load statement , rest of script same

$querystring = "a =  load 'wasb://$containername@$storageaccount.blob.core.windows.net/table1';" + 

the error is

2015-04-14 23:23:00,117 [main] error org.apache.pig.pigserver - exception during parsing: error during parsing. <line 1, column 162>  syntax error, unexpected symbol @ or near ';' failed parse: <line 1, column 162>  syntax error, unexpected symbol @ or near ';' @ org.apache.pig.parser.queryparserdriver.parse(queryparserdriver.java:241) @ org.apache.pig.parser.queryparserdriver.parse(queryparserdriver.java:179) @ org.apache.pig.pigserver$graph.parsequery(pigserver.java:1678) @ org.apache.pig.pigserver$graph.access$000(pigserver.java:1411) @ org.apache.pig.pigserver.parseandbuild(pigserver.java:344) @ org.apache.pig.pigserver.executebatch(pigserver.java:369) @ org.apache.pig.pigserver.executebatch(pigserver.java:355) @ org.apache.pig.tools.grunt.gruntparser.executebatch(gruntparser.java:140) @ org.apache.pig.tools.grunt.gruntparser.processdump(gruntparser.java:769) @ org.apache.pig.tools.pigscript.parser.pigscriptparser.parse(pigscriptparser.java:372) @ org.apache.pig.tools.grunt.gruntparser.parsestoponerror(gruntparser.java:198) @ org.apache.pig.tools.grunt.gruntparser.parsestoponerror(gruntparser.java:173) @ org.apache.pig.tools.grunt.grunt.exec(grunt.java:84) @ org.apache.pig.main.run(main.java:509) @ org.apache.pig.main.main(main.java:156) 2015-04-14 23:23:00,132 [main] error org.apache.pig.tools.grunt.grunt - error 1200: <line 1, column 162>  syntax error, unexpected symbol @ or near ';' details @ logfile: c:\apps\dist\hadoop-2.4.0.2.1.9.0-2196\logs\pig_1429053777602.log 

i don't understand error is. can me executing query on windows powershell(i using windows powershell ise, can edit queries)

terminal execution

the issue @ statement user_list = foreach generate $0;. powershell interpreting $0 parameter, , since not defined powershell substituting empty string. can define parameter in script $0 = '$0'; or escape $ like:

user_list = foreach generate `$0; 

powershell uses ` (backtick, next '1' key) escape character double-quoted strings.

so script can like:

$0 = '$0'; $querystring = "a =  load 'wasb://$containername@$storageaccountname.blob.core.windows.net/table1' using pigstorage(',') (col1,col2,col3,col4,col5,col6,col7,col8) ;"+ "user_list = foreach generate $0;" + "unique_user = distinct user_list;" + "unique_users_group = group unique_user all;" + "uu_count = foreach unique_users_group generate count(unique_user);" + "dump uu_count;" 

or

$querystring = "a =  load 'wasb://$containername@$storageaccountname.blob.core.windows.net/table1' using pigstorage(',') (col1,col2,col3,col4,col5,col6,col7,col8) ;"+ "user_list = foreach generate `$0;" + "unique_user = distinct user_list;" + "unique_users_group = group unique_user all;" + "uu_count = foreach unique_users_group generate count(unique_user);" + "dump uu_count;" 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -