Exit pig shell command safely
Asked Answered
A

1

7

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);
>> ;
>>
>>**
Anchusin answered 17/3, 2013 at 3:2 Comment(1)
I am facing the same issue. I tried quit command or ending with Ctrl-C but then somehow it overrides existing keymap settings and then all my backspace is converted to ^HSeeto
S
4

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.

Salley answered 19/6, 2013 at 17:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.