When I enter some erroneous command in a Pig interactive shell environment, it enters into listening mode (>>) like below. How do I safely come out of this command, but still stay in the pig shell environment?
Ctrl + C takes me out of the pig shell and I lose my environment setup till that point.
**grunt> Test_group = group Block2_Prep_filter by (page_visit_id as grp_page_visit_id, page_user_guid as grp_page_user_guid);
>> ;
>>
>>**
I've looked in the pig source code. This is called the secondary_prompt (found in PigScriptParser.jj, a context-free parser grammar file for JavaCC). To my eye it looks like it can't be gotten out of. I tried a lot of combinations of things I saw in that code and nothing worked. Also tried all the exit type words I could think of, to no avail.
When I did Ctrl + D, it exited and displayed:
>> 2013-06-19 12:51:43,632 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1000:
Error during parsing. Lexical error at line 83, column 0. Encountered: <EOF> after : ""
Looking in the Grunt class, at that point, it does:
parser.setInteractive(false);
return parser.parseStopOnError();
This suggests to me that interactivity is over at this point.
Related
Trying to declare a variable in Hive using Hue online. Using the following code:
SET hivevar:TABLE1=location.tablename;
I am getting the following error message:
Error while compiling statement: FAILED: ParseException line 1:12 missing KW_ROLE at 'hivevar' near 'hivevar' line 1:19 missing EOF at ':' near 'hivevar'.
Can anyone tell me what this error message means or even what the KW_ROLE statement means?
Do you by any chance have a comment above that instruction ? Are you running that line and that line only ?
For example, the following will raise a similar Exception :
--This is a comment
SET hivevar:TABLE1=location.tablename;
But it works fine without the comment.
I guess you are making changes in MAC/Windows and moving the script to the server, Double dash "--" in MAC is a different from double dash "--" on Linux server, make changes on server itself and run the script...
I'm writing a small Ruby script that does a statistical analysis on a list of names generated by another script of mine.
When I run it with this command:
ruby [first script] [args] | ruby -- [second script] _
it throws this error:
./name_gen_test.rb:15:in `gets': No such file or directory # rb_sysopen - _ (Errno:ENOENT)
from .name_gen_test.rb:15:in `gets'
from .name_gen_test.rb:15:in `<main>'
(Apologies for typos; Powershell wouldn't let me copy/paste)
This is line 15:
until (cur_line = gets).nil?
Then there's the body of a loop, the rest of the code, etc. However, if I put this line:
gets
as the very first line, I get the same error. In fact, if I totally empty the file and have nothing but a call to gets, I get the error that the file '_' cannot be found.
How can I make it understand that '_' is a command line argument and not a file to be... read from, I guess? Why doesn't gets work like I expect it to (i.e. reading from the standard input)?
I'm running it with Powershell, if that makes a difference.
Sorry if this is a duplicate; simply Googling the error message leads to a dozen different issues and a dozen different solutions, none of which apply, and I couldn't figure out how to put this problem into a Google query.
STDIN.gets will do what you want. By default, gets is (pretty much) equivalent to ARGF.gets. ARGF reads from standard input if there are no ARGS, and from files that correspond to ARGS if there are.
Two questions about problems I'm having writing up a BASH script that uses variables. I cannot for the life of me figure this out and it is KILLING me.
1) I have the following code.
pdir=/media/The_Enforcer/ICA_Doug/Participants/RS1
cd ${pdir}
for subject in * ; do
subdir=${pdir}/${subject} ;
cd ${subdir} ;
subj= echo ${subject} | head -c-9
3dAFNItoNIFTI -prefix ICA/cleanRS_NII_${subj} RSFC_LFF_rall_${subj}+orig ;
cd ${pdir} ;
done
${subject} is a subject ID which is ########.results. For example: 1R101U1A.results. Basically my code cd's me into that directory in which is a file called RSFC_LFF_rall_1R101U1A+orig which I want to process via the code line that starts with 3dAFNItoNIFTI. Obviously I can't use ${subject} variable in that code line because it would attempt to find the file RSFC_LFF_rall_1R101U1A.results+orig which does not exist. So to fix this I made a new variable called ${subj} which, via the echo pipeline, basically cuts off the last 9 letters of ${subject} which, in effect, removes the .results. When I do this and echo ${subj} it gives me 1R101U1A which is exactly what I want.
However, the line of code that starts with 3dAFNItoNIFTI errors with the following:
FATAL ERROR: Can't open dataset 'RSFC_LFF_rall_+orig'
I have tried declaring the ${subj} variable like, five different ways (including using head, tail, cut, and colons) and I still get this error.
What am I doing wrong?
2) In attempting to define ${subj} in numerous ways I also tried this method:
${subj}= ${subject:0:8}
When I did this, the final bracket refused to close - i.e. the closing bracket did not turn the color of the opening bracket and when I attempted to run the script I got an error at that line saying 'command not found.' I checked my syntax against the examples I was following and it looks fine? Am I missing something here?
Try this:
cd "/media/The_Enforcer/ICA_Doug/Participants/RS1"
for subject in * ; do
cd $subject
subj=${subject%.results}
3dAFNItoNIFTI -prefix ICA/cleanRS_NII_${subj} RSFC_LFF_rall_${subj}+orig
cd ..
done
${subject%.results} removes .results from the end of the string.
See Shell-Parameter-Expansion.
I am trying to register a UDF jar in the Pig grunt shell (Pig 0.13.0). The register statement below errors due to what I believe is the space in the path:
register '/home/hadoop/Eclipse Projects/pigudfs/target/pigudfs-0.0.1-SNAPSHOT.jar';
The following error is generated:
[main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1000: Error during parsing. Encountered " <QUOTEDSTRING> "\'/home/hadoop/Eclipse Projects/pigudfs/target/pigudfs-0.0.1-SNAPSHOT.jar\' "" at line 7, column 10
I have tried an array of options to try to escape the space without any luck...
Try this,
give the path name without the single quotes,
like
register home/hadoop/Eclipse Projects/pigudfs/target/pigudfs-0.0.1-SNAPSHOT.jar;
I have an OTP based Erlang application that seems to behave weird.
I want to connect to the erlang shell and trace exactly what is happening.
I can do all my calls to dbg:tracer(), dbg:tp() etc. just fine, however no output is sent to my shell.
I think this might be, because I am connecting via a remote shell.
However, when I call dbg:n(wiwob#vlxd38-wob). I get an error:
** exception error: bad argument in an arithmetic expression
in operator -/2
called as wiwob#vlxd38 - wob
How can I find out which shell the output is sent to and pipe it to my shell?
The argument to dbg:n/1 must be an atom and wiwob#vlxd38-wob is not an atom, it needs to quoted like 'wiwob#vlxd38-wob'. For the syntax of an atom, and other data types, see Atoms.
I cannot help you for the dbg problem, you do not give enough information about how you connect the debugger to a process, module ...
For the second point the error is self explanatory, parsing the expression wiwob#vlxd38-wob, the shell try to execute
wiwob#vlxd38 minus wob, which is impossible with 2 atoms.
the function dbg:n/1 has the folowing specs:
n(Nodename) -> {ok, Nodename} | {error, Reason}
Nodename = atom()
Reason = term()
so you must write your node name as 'wiwob#vlxd38-wob' in order to force the whole expression to be a single atom.