i tried like
>pig sample.py dataset.csv number of attributes(column count)

but i cant access it using sys.argv
its end up with error..


On Thu, Jan 12, 2012 at 2:54 PM, rahul raghavendhra <
[email protected]> wrote:

> ok.. how to pass the argument to the pig file ?  i tried.. Its not
> working..
> can v pass arguments to that py file..
> please help
>
>
>
>
> On Thu, Jan 12, 2012 at 2:40 PM, Daniel Dai <[email protected]> wrote:
>
>> Oh, we have an issue of dump (PIG-2291). Please use store.
>>
>> Daniel
>>
>> On Thu, Jan 12, 2012 at 12:54 AM, rahul raghavendhra <
>> [email protected]> wrote:
>>
>> > when i  run the similar one(without store,  just load and dump) it raise
>> > the exception.. so i replaced raise statement by print 'pig job
>> failed'..
>> > then i get the output of the dump command but it is append with pig job
>> > failed..
>> > why this so ?
>> > i tried to pass the name of the dataset using command line to py file..
>> its
>> > showing error..
>> >
>> > please help
>> >
>> >
>> >
>> >
>> > On Thu, Jan 12, 2012 at 12:40 PM, Daniel Dai <[email protected]>
>> > wrote:
>> >
>> > > Yes, you can use "java -cp", or you can use $PIG_HOME/bin/pig. Your
>> > command
>> > > "pig sample.py" is right. However, your sample.py only contains import
>> > > statement, there is nothing to run, so it exit quickly. The minimal
>> > python
>> > > script you can run is:
>> > >
>> > > #!/usr/bin/python
>> > >
>> > > # explicitly import Pig class
>> > > from org.apache.pig.scripting import Pig
>> > >
>> > > # COMPILE: compile method returns a Pig object that represents the
>> > pipeline
>> > > P = Pig.compile("a = load '$in'; store a into '$out';")
>> > >
>> > > input = 'original'
>> > > output = 'output'
>> > >
>> > > # BIND and RUN
>> > > result = P.bind({'in':input, 'out':output}).runSingle()
>> > >
>> > > if result.isSuccessful() :
>> > >    print 'Pig job succeeded'
>> > > else :
>> > >    raise 'Pig job failed'
>> > >
>> > >
>> > > Check http://pig.apache.org/docs/r0.9.1/cont.html for detail.
>> > >
>> > > Daniel
>> > >
>> > > On Wed, Jan 11, 2012 at 10:59 PM, Jonathan Coveney <
>> [email protected]
>> > > >wrote:
>> > >
>> > > > java -cp
>> /usr/local/pig/pig-0.9.1.jar:/usr/local/jython2.5.2/jython.jar
>> > > > org.apache.pig.Main sample.py, I believe
>> > > >
>> > > > 2012/1/11 rahul raghavendhra <[email protected]>
>> > > >
>> > > > > when i run using java  -cp
>> > > > >
>> > > > > $>java -cp
>> > > /usr/local/pig/pig-0.9.1.jar:/usr/local/jython2.5.2/jython.jar
>> > > > > sample.py
>> > > > > Exception in thread "main" java.lang.NoClassDefFoundError:
>> sample/py
>> > > > > Caused by: java.lang.ClassNotFoundException: sample.py
>> > > > >    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
>> > > > >    at java.security.AccessController.doPrivileged(Native Method)
>> > > > >    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
>> > > > >    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
>> > > > >    at
>> sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
>> > > > >    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
>> > > > > Could not find the main class: sample.py. Program will exit.
>> > > > >
>> > > > > please help
>> > > > >
>> > > > >
>> > > > > On Thu, Jan 12, 2012 at 12:11 PM, rahul raghavendhra <
>> > > > > [email protected]> wrote:
>> > > > >
>> > > > > >
>> > > > > > How to run as a script file
>> > > > > >
>> > > > > > pig script.py ??
>> > > > > >
>> > > > > > please help
>> > > > > > ./rahul
>> > > > > >
>> > > > > > On Thu, Jan 12, 2012 at 12:06 PM, rahul raghavendhra <
>> > > > > > [email protected]> wrote:
>> > > > > >
>> > > > > >> I am a newbie.. please make it so clear..
>> > > > > >>
>> > > > > >>
>> > > > > >> when i inside bin as
>> > > > > >> pig sample.py
>> > > > > >>
>> > > > > >>  i got this error..
>> > > > > >>
>> > > > > >> hadoop1@karthi-ericsson:/usr/
>> > > > > >> local/pig/bin$ pig sample.py
>> > > > > >> 2012-01-12 11:53:14,475 [main] INFO  org.apache.pig.Main -
>> > Logging
>> > > > > error
>> > > > > >> messages to: /usr/local/pig/bin/pig_1326349394473.log
>> > > > > >> 2012-01-12 11:53:14,485 [main] INFO  org.apache.pig.Main - Run
>> > > > embedded
>> > > > > >> script: jython
>> > > > > >> 2012-01-12 11:53:14,597 [main] INFO
>> > > > > >> org.apache.pig.backend.hadoop.executionengine.HExecutionEngine
>> -
>> > > > > Connecting
>> > > > > >> to hadoop file system at: hdfs://localhost:54310
>> > > > > >> 2012-01-12 11:53:14,736 [main] INFO
>> > > > > >> org.apache.pig.backend.hadoop.executionengine.HExecutionEngine
>> -
>> > > > > Connecting
>> > > > > >> to map-reduce job tracker at: localhost:54311
>> > > > > >> hadoop1@karthi-ericsson:/usr/local/pig/bin$
>> > > > > >>
>> > > > > >> how to run as a script file
>> > > > > >>
>> > > > > >>
>> > > > > >> On Thu, Jan 12, 2012 at 12:01 PM, Daniel Dai <
>> > [email protected]
>> > > > > >wrote:
>> > > > > >>
>> > > > > >>> Hi, Rahul,
>> > > > > >>> Embedding mode does not work with grunt. Please run as a
>> script
>> > > file.
>> > > > > >>>
>> > > > > >>> Daniel
>> > > > > >>>
>> > > > > >>> On Wed, Jan 11, 2012 at 10:24 PM, rahul raghavendhra <
>> > > > > >>> [email protected]> wrote:
>> > > > > >>>
>> > > > > >>> > i have downloaded jython jar and installed it.. but i
>> couldnt
>> > run
>> > > > pig
>> > > > > >>> > scripts using py script... i have created a .py in pig/bin
>> > > forder..
>> > > > > >>> how to
>> > > > > >>> > run the pig.. pig wiki is not so clear..please help.
>> > > > > >>> >
>> > > > > >>> > when i run the script inside grunt as run sample.py
>> > > > > >>> >
>> > > > > >>> > i got the following error
>> > > > > >>> >
>> > > > > >>> > grunt> #!/usr/bin/python
>> > > > > >>> > grunt> from org.apache.pig.scripting import Pig
>> > > > > >>> > 2012-01-12 11:50:18,637 [main] ERROR
>> > > > > org.apache.pig.tools.grunt.Grunt
>> > > > > >>> -
>> > > > > >>> > ERROR 1000: Error during parsing. Encountered " <IDENTIFIER>
>> > > "from
>> > > > ""
>> > > > > >>> at
>> > > > > >>> > line 2, column 1.
>> > > > > >>> >
>> > > > > >>> >
>> > > > > >>> > when i inside bin as pig sample.py
>> > > > > >>> >  i got this error..
>> > > > > >>> > hadoop1@karthi-ericsson:/usr/local/pig/bin$ pig sample.py
>> > > > > >>> > 2012-01-12 11:53:14,475 [main] INFO  org.apache.pig.Main -
>> > > Logging
>> > > > > >>> error
>> > > > > >>> > messages to: /usr/local/pig/bin/pig_1326349394473.log
>> > > > > >>> > 2012-01-12 11:53:14,485 [main] INFO  org.apache.pig.Main -
>> Run
>> > > > > >>> embedded
>> > > > > >>> > script: jython
>> > > > > >>> > 2012-01-12 11:53:14,597 [main] INFO
>> > > > > >>> >
>> org.apache.pig.backend.hadoop.executionengine.HExecutionEngine
>> > -
>> > > > > >>> Connecting
>> > > > > >>> > to hadoop file system at: hdfs://localhost:54310
>> > > > > >>> > 2012-01-12 11:53:14,736 [main] INFO
>> > > > > >>> >
>> org.apache.pig.backend.hadoop.executionengine.HExecutionEngine
>> > -
>> > > > > >>> Connecting
>> > > > > >>> > to map-reduce job tracker at: localhost:54311
>> > > > > >>> > hadoop1@karthi-ericsson:/usr/local/pig/bin$
>> > > > > >>> >
>> > > > > >>> >
>> > > > > >>> > please help
>> > > > > >>> > ./rahul
>> > > > > >>> >
>> > > > > >>>
>> > > > > >>
>> > > > > >>
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>>
>
>

Reply via email to