Commit Graph

150 Commits

Author SHA1 Message Date
Matthew Jacobs
77a2941a42 IMPALA-3713,IMPALA-4439: Fix Kudu DML shell reporting
Adds support in the shell to report the number of modified
rows for all DML operations, as well as the number of rows
with errors.

Testing: Added shell tests.

Change-Id: I3d3d7aa8d176e03ea58fb00f2a81fb3e34965aa1
Reviewed-on: http://gerrit.cloudera.org:8080/5103
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: Internal Jenkins
2016-11-17 04:13:25 +00:00
Sailesh Mukil
c23bf38a20 IMPALA-3893, IMPALA-3901: impala-shell prints incorrect coordinator address, overly verbose
The webserver address was always configured as 0.0.0.0 (meaning that
the webserver could be reached on any IP for that machine) unless
otherwise specified. This is not a correct value to dispay to the
user. This patch returns the hostname of the node, when requested,
if the webserver host address is 0.0.0.0.

This patch also does not print the coordinator link for very simple
queries, as it's not necessary and is unnecessarily verbose.

This patch also does away with pinging the impalad an extra time per
query for finding the host time and webserver address. It instead
remembers the webserver address at connect time and displays client
local time for every query instead.

Change-Id: I9d167b66f2dd8629e40a7094d21ea7ce6b43d23b
Reviewed-on: http://gerrit.cloudera.org:8080/3994
Tested-by: Internal Jenkins
Reviewed-by: Sailesh Mukil <sailesh@cloudera.com>
Tested-by: Sailesh Mukil <sailesh@cloudera.com>
2016-08-23 18:25:06 +00:00
Tim Armstrong
50e21247d6 IMPALA-3992: bad shell error message when running nonexistent file
Fix the error handling code and add a test.

Change-Id: Iebcf1dc8a1a08b400a2c769a9cff38ea02c8e525
Reviewed-on: http://gerrit.cloudera.org:8080/4022
Reviewed-by: Henry Robinson <henry@cloudera.com>
Tested-by: Internal Jenkins
2016-08-18 03:37:48 +00:00
Dan Hecht
dd906a81d5 IMPALA-3918: remove Cloudera copyright from the shell welcome message
Change-Id: I3b3dcad8997e5b58b4ffda42fc95e3dba1e8a641
Reviewed-on: http://gerrit.cloudera.org:8080/4005
Reviewed-by: Tim Armstrong <tarmstrong@cloudera.com>
Tested-by: Internal Jenkins
2016-08-17 00:35:17 +00:00
Dan Hecht
ffa7829b70 IMPALA-3918: Remove Cloudera copyrights and add ASF license header
For files that have a Cloudera copyright (and no other copyright
notice), make changes to follow the ASF source file header policy here:

http://www.apache.org/legal/src-headers.html#headers

Specifically:
1) Remove the Cloudera copyright.
2) Modify NOTICE.txt according to
   http://www.apache.org/legal/src-headers.html#notice
   to follow that format and add a line for Cloudera.
3) Replace or add the existing ASF license text with the one given
   on the website.

Much of this change was automatically generated via:

git grep -li 'Copyright.*Cloudera' > modified_files.txt
cat modified_files.txt | xargs perl -n -i -e 'print unless m#Copyright.*Cloudera#i;'
cat modified_files_txt | xargs fix_apache_license.py [1]

Some manual fixups were performed following those steps, especially when
license text was completely missing from the file.

[1] https://gist.github.com/anonymous/ff71292094362fc5c594 with minor
    modification to ORIG_LICENSE to match Impala's license text.

Change-Id: I2e0bd8420945b953e1b806041bea4d72a3943d86
Reviewed-on: http://gerrit.cloudera.org:8080/3779
Reviewed-by: Dan Hecht <dhecht@cloudera.com>
Tested-by: Internal Jenkins
2016-08-09 08:19:41 +00:00
Sailesh Mukil
900f148078 IMPALA-1671: Print time and link to coordinator web UI once query is submitted in shell
To help supportability and debugging, it's helpful to have the impala
shell print out the coordinator time and the link to the coordinator
web UI once the query is submitted.

This is done by calling the PingImpalaService() routine everytime a
query is submitted, which returns the coordinator's hostname,
webserver port and the coordinator epoch time at that moment which the
shell then formats and prints out.

Added tests to verify these new messages.

Change-Id: I704eb64546e27c367830120241311fea6091266b
Reviewed-on: http://gerrit.cloudera.org:8080/3507
Reviewed-by: Sailesh Mukil <sailesh@cloudera.com>
Tested-by: Internal Jenkins
2016-07-14 19:04:45 +00:00
Henry Robinson
0dde1c2f86 IMPALA-3628: Fix cancellation from shell when security is enabled
To cancel a query, the shell will create a separate connection inside
it's SIGINT handler, and send the cancellation RPC. However this
connection did not start a secure connection if it needed to, meaning
that the cancellation attempt would just hang.

A workaround is to kill the shell process, which I expect is what users
have been doing with this bug which has been around since 2014.

Testing:

I added a custom cluster test that starts Impala with SSL
enabled, and wrote two tests - one just to check SSL connectivity, and
the other to mimic the existing test_cancellation which sends SIGINT to
the shell process. In doing so I refactored the shell testing code a bit
so that all tests use a single ImpalaShell object, rather than rolling
their own Popen() based approaches when they needed to do something
unusual, like cancel a query.

In the cancellation test on my machine, SIGINT can take a few tries to
be effective. I'm not sure if this is a timing thing - perhaps the
Python interpreter doesn't correctly pass signals through to a handler
if it's in a blocking call, for example. The test reliably passes within
~5 tries on my machine, so the test tries 30 times, once per second.

Change-Id: If99085e75708d92a08dbecf0131a2234fedad33a
Reviewed-on: http://gerrit.cloudera.org:8080/3302
Reviewed-by: Henry Robinson <henry@cloudera.com>
Tested-by: Henry Robinson <henry@cloudera.com>
2016-07-05 16:40:23 -07:00
Bharath Vissapragada
5ede8eb8a7 IMPALA-2336: Ignore trailing comments in non-interactive mode
This patch trims trailing comments while parsing queries in
non-interactive mode. Users usually have comments in the end
of the script which should be ignored. Without this patch,
the script fails with an exception since it expects a valid
SQL. The behavior however remains the same with interactive
mode.

Change-Id: I723763ef7eedd03cf22058fadf06e9673a0d94d2
Reviewed-on: http://gerrit.cloudera.org:8080/3169
Reviewed-by: Casey Ching <casey@cloudera.com>
Tested-by: Internal Jenkins
2016-05-31 23:32:11 -07:00
Henry Robinson
a805e100b2 IMPALA-3397: Source query files from shell.
This patch allows you to write SOURCE <file> or SRC <file>, and have the
shell read the file and execute all the queries in it.

Change-Id: Ib05df3e755cd12e9e9562de6b353857940eace03
Reviewed-on: http://gerrit.cloudera.org:8080/2663
Reviewed-by: Henry Robinson <henry@cloudera.com>
Tested-by: Internal Jenkins
2016-05-12 14:17:54 -07:00
Andre Araujo
f3733aed84 IMPALA-2180: Extend SET command to allow setting variables in Impala Shell.
The SET command has been extended with the following syntax, to allow
setting of variables in the Impala Shell:

SET VAR:<variable_name>=<value>

The UNSET command has also been modified to allow:

UNSET VAR:<variable_name>

This patch builds on the changes in IMPALA-2179. The main change for
this patch was to ensure that all SET commands are processed by the
shell, rather than being send to the front end as a query. For this
I had to modify the command sanitization function to remove comments
that happen in front of a SET command.

Comments can be a can of worms to parse, so I tried to be as strict
as possible to avoid collateral effects. Comments are only removed
if they happen right at the beginning of the line AND before a SET
command. NO other comments are touched, including comments before,
after or within queries.

Change-Id: I87e07385122187ab8d324346499896a3dfbbafe6
Reviewed-on: http://gerrit.cloudera.org:8080/679
Reviewed-by: Casey Ching <casey@cloudera.com>
Tested-by: Internal Jenkins
2016-02-10 10:17:18 +00:00
Andre Araujo
bcce19012d IMPALA-2179: Extend Impala shell to allow passing variables through the command line
This patch adds the command line option `--var` to allow the user to set
variable to be used in commands within the shell. It does *not* implement the
setting of variables through the SET command, as Hive does. This extension will
be implemented separately on IMPALA-2180.

The syntax for specifying a parameter in the command line is --var=KEY=VAL, as
for example: --var=start_date=20150101

Variables are textually replaced by their value in the Impala shell commands.
The substitution work similarly for interactive sessions as well as for command
line queries and/or scripts (-q and -f options, respectively).

Variables can be referenced as ${VAR:VAR_NAME} (case-insensitive). The form
${HIVEVAR:VAR_NAME} can also be used for compatibility with Hive scripts.

To prevent any of the reference expressions above from being replaced you can
escape them with a backslash (e.g. \${VAR:VAR_NAME} and \${HIVEVAR:VAR_NAME}).

The Impala shell's SET command now also reports the set variables and their
values.

Change-Id: Ia491fae91256334bb60c9066d119fe9a1e9779dd
Reviewed-on: http://gerrit.cloudera.org:8080/611
Reviewed-by: Casey Ching <casey@cloudera.com>
Tested-by: Internal Jenkins
2016-02-10 00:20:46 +00:00
Henry Robinson
cca964c3c6 IMPALA-1934: Allow shell to retrieve LDAP password from shell cmd
Adds a new option --ldap_password_cmd that takes a string which is
executed as a shell command. The stdout results are used as the LDAP
password for this shell session.

Tests are added for the negative case (where the command fails for some
reason), but without tests for successful LDAP connections we can't test
the case where the password is correct.

Change-Id: Ib0362be5e167ff752e764ad2152c4c4b679f83c2
Reviewed-on: http://gerrit.cloudera.org:8080/1542
Reviewed-by: Henry Robinson <henry@cloudera.com>
Tested-by: Internal Jenkins
2016-01-19 23:41:25 +00:00
Tim Armstrong
7f133b453e IMPALA-1325: don't suppress errors in shell
Remove a hack in impala-shell that suppressed any error messages that
included the string "Cancelled". This originally was necessary since
user-initiated cancellation messages were propagated back to the client,
but is no longer necessary. Certain errors that occur asynchronously
were suppressed, because the error is propagated by cancelling the
query.

Confirmed that no error messages are printed for manually cancelled
queries, and that error messages that were previously suppressed (from
my IMPALA-2298 patch) now show in the shell.

Change-Id: Iac53b1307768cbb07640ddc88b152ae71c71beab
Reviewed-on: http://gerrit.cloudera.org:8080/1529
Reviewed-by: Tim Armstrong <tarmstrong@cloudera.com>
Tested-by: Internal Jenkins
2015-12-19 05:43:59 +00:00
Juan Yu
0df3b419a0 IMPALA-2309: Compute stats query return error if set LIVE_PROGRESS=true
Impala shell cannot get child query handle so it cannot
query live progress for COMPUTE STATS query. Disable live
progress callback for compute stats query.

Change-Id: I2d2f342a805905a4fa868686e7c9e9362c2c2223
Reviewed-on: http://gerrit.cloudera.org:8080/1109
Reviewed-by: Juan Yu <jyu@cloudera.com>
Tested-by: Internal Jenkins
2015-10-05 11:30:37 -07:00
ishaan
cbfc65e041 IMPALA-2110: Readline bug in centos7 causes the shell to produce garbled output.
This patch addresses the problem by not importing readline if the shell is used in
non-interactive mode. More information on the readline bug can be found
here: https://bugs.python.org/issue19884

Change-Id: Ia9dae6308c3807d3fd323449766bf7e7371f800f
Reviewed-on: http://gerrit.cloudera.org:8080/511
Reviewed-by: Ishaan Joshi <ishaan@cloudera.com>
Tested-by: Internal Jenkins
2015-09-04 21:51:26 +00:00
Henry Robinson
c1fd862238 IMPALA-1975: Automatically reconnect failed connections from the shell
This patch calls PingImpalaService() at the beginning of each command
loop (if the shell is currently connected). If the call fails, the shell
will try and reconnect. Reconnecting is best-effort - if it fails, the
command is processed anyway so as not to interfere with any commands
that might still give useful output in a disconnected state.

Change-Id: I37cb2f4fc235fedff16d48ad5125b9a30bd7dfd0
Reviewed-on: http://gerrit.cloudera.org:8080/547
Reviewed-by: Henry Robinson <henry@cloudera.com>
Tested-by: Internal Jenkins
2015-08-05 01:00:54 +00:00
Henry Robinson
621205ebbc IMPALA-2143: Avoid sending auth credentials over insecure connections
This patch changes the behaviour of the Impala shell to refuse to
attempt an LDAP-authenticated connection to Impala unless SSL/TLS is
configured.

A new flag --auth_creds_in_clear_ok is added to suppress this
behaviour. This is similar to Impala's --ldap_passwords_in_clear_ok
flag. The shell will also now print a warning if an insecure
configuration is used.

Change-Id: Ide25d8dd881a61b9f08900112466c430da64a038
Reviewed-on: http://gerrit.cloudera.org:8080/546
Reviewed-by: Casey Ching <casey@cloudera.com>
Tested-by: Internal Jenkins
2015-07-30 07:15:29 +00:00
Henry Robinson
4702df40bc Add tips to shell
This patch adds a 'tip-of-the-day' message to the shell's intro header,
and a TIP command that prints out a random tip. This might be a good way
to make advanced or little-known functionality of both Impala and the
shell better known to users.

Change-Id: I987b386f8c96f8a75ccd5cd9197a8f2981c8bf43
Reviewed-on: http://gerrit.cloudera.org:8080/586
Reviewed-by: Tim Armstrong <tarmstrong@cloudera.com>
Reviewed-by: Casey Ching <casey@cloudera.com>
Tested-by: Internal Jenkins
2015-07-30 02:18:33 +00:00
Martin Grund
ed18dd4a8b IMPALA-80: Dynamic progress reporting for the shell
This patch adds a way to allow for dynamic progress reporting in the
shell. There are two new command line flags for the shell

   --live_progress - will print the completed vs total # of scan ranges
   --live_summary - prints an updated exec summary

In addition to the command line flags, these options can be set from
within the shell using:

   set LIVE_SUMMARY=True
   set LIVE_PROGRESS=True

The new options will be listed under shell options. Both reports will be
updated at most every second, for longer running queries it will be
adjusted to the time between two RPC calls to get the query status. To
provide this information in the ExecSummary, the Thrift structure for
the ExecSummary was extended to contain a progress indicator. The output
is printed to stderr and only available in interactive mode.

An example video is available here:

https://asciinema.org/a/5wi7ypckx4ol4ha1hlg3e3q1k

Change-Id: I70b2ab5fa74dc2ba5bc3b338ef13ddc6ccf367d2
Reviewed-on: http://gerrit.cloudera.org:8080/508
Tested-by: Internal Jenkins
Reviewed-by: Martin Grund <mgrund@cloudera.com>
2015-07-17 17:59:29 +00:00
Sailesh Mukil
42d118a8ad IMPALA-1413: Allow impala-shell -f option to read from stdin
The '-f' option in Impala shell is used to read from a file containing SQL queries.
Now, additional support is added to read from STDIN by using:

"-f -"

An additional bug was fixed in the test script test_shell_commandline.py where certain
tests(test_default_db and test_unsecure_message) would hang indefinitely due to the
subprocess(impala-shell) waiting for user input. Fixed by piping STDIN to the subprocess
which sends an implicit EOF that closes the impala-shell once the test is completed.

Change-Id: I9a2682e086a3345e089f3e9db7cc049ce3d2c19a
Reviewed-on: http://gerrit.cloudera.org:8080/479
Reviewed-by: Ishaan Joshi <ishaan@cloudera.com>
Tested-by: Internal Jenkins
2015-06-23 23:53:52 +00:00
Alex Leblang
dc8ef8d5d8 IMPALA-1396: Close queries cancelled with ctl-c in shell
This patch adds a line to the signal handler that closes
queries that have been cancelled. This patch closes the
cancelled query in the signal handler if it is not already
closed. This patch also improves the cancellation test so
it catches this problem in the future.

Change-Id: I1bb2a4a8fc3c3d40b8e4ba41f4b2bcf6d32bc297
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/5303
Reviewed-by: Alex Leblang <alex.leblang@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/5320
2014-11-20 12:48:47 -08:00
Martin Grund
0cb8ba98ec IMPALA-1439: Make sure all errors are fetched
This patch will make sure that all error and warning messages are
fetched from impala. Before this patch, error messages that would occur
after the first row was retrieved would not be catched correctly.

Change-Id: I82a9a1c810e2ffabc7e56c996276082548ced805
(cherry picked from commit c357f530963673859be33726e8e5a896d77de097)
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/5263
Reviewed-by: Martin Grund <mgrund@cloudera.com>
Tested-by: jenkins
2014-11-14 16:30:12 -08:00
ishaan
d60df19249 IMPALA-1261: The shell should not strip comments from the query text.
This patch enables the shell to pass query strings as-is to Impala's parser. In order to
preserve previous behaviour, we transform multi-line queries before writing them to
history. We replace EOL with an obscure ascii character (DLE), and re-apply the
transformation when reading it back from history.

Change-Id: I021b9c3d50b03df73bea1afd6ce3ec6b413484e0
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4664
Reviewed-by: Ishaan Joshi <ishaan@cloudera.com>
Tested-by: jenkins

Conflicts:

	shell/impala_shell.py
2014-10-07 15:56:12 -07:00
ishaan
a0463b6f3a Change the try/except/finally block to a try/finally block for python 2.4 compatibility.
Change-Id: I21fcbb761c168e2cbaeeae1c3850c97119f75cdd
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4735
Reviewed-by: Ishaan Joshi <ishaan@cloudera.com>
Tested-by: jenkins
2014-10-06 19:49:30 -07:00
ishaan
c84caf3957 IMPALA-1317: Explicitly close alter, use and drop ddl queries in the shell.
Change-Id: I034d9dcfd76666cdbfa622d3c8cdc59ea85a75c9
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4655
Reviewed-by: Ishaan Joshi <ishaan@cloudera.com>
Tested-by: jenkins
2014-10-06 15:13:27 -07:00
ishaan
f8af74a97f Convert 'exception as e' to 'exception, e' in the shell for python 2.4 compatibility.
socket.error is the only caught exception using the 'as e' syntax. This patch
fixes the syntax to be compatible with python2.4, which does not support it.
The shell cancellation tests exercise this path, so no tests need to be added.

Change-Id: I5588f25612953a28d0817081005d5770115ca106
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4638
Reviewed-by: Ishaan Joshi <ishaan@cloudera.com>
Tested-by: jenkins
2014-10-06 15:11:54 -07:00
ishaan
bfce732206 IMPALA-1235: Get a new Impala Client instance every time a user reconnects.
Earlier, if the user connected via the command line, the shell would only attempt to
create a new Impala Client instance if a connection did not exist. This resulted in the
shell not connecting to the user specified Impalad.

Change-Id: I74c291256d0c063f6324b01aa7336282e6969a4e
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4392
Reviewed-by: Ishaan Joshi <ishaan@cloudera.com>
Tested-by: jenkins
2014-09-26 11:27:10 -07:00
Alex Leblang
79493c9698 IMPALA-1098 Updated bad test name from CR
Change-Id: Ic7df7d37e8ca9e74231e760dcd411c528d02f730
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4124
Reviewed-by: Alex Leblang <alex.leblang@cloudera.com>
Tested-by: jenkins
2014-09-26 11:23:33 -07:00
Abdullah Yousufi
f11de455a0 Fix return status of summary within impala shell
Follow up fix to IMPALA-1153. Ensure that the correct
CmdStatus is returned by the summary command. (ERROR for
invalid queries and SUCCESS even if summary is not available.)

Change-Id: Icf67164dc82f202ec15071541f6ed3b26e3ad7fb
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4089
Reviewed-by: Abdullah Yousufi <abdullah.yousufi@cloudera.com>
Tested-by: jenkins
2014-09-26 11:00:15 -07:00
Abdullah Yousufi
9853f74db1 CDH-21036: Make --quiet flag suppress warning messages in impala-shell
Change-Id: Ia57652840b3e3483a06c0bbef283c60a229db27f
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4092
Reviewed-by: Abdullah Yousufi <abdullah.yousufi@cloudera.com>
Tested-by: jenkins
2014-09-26 11:00:05 -07:00
Nong Li
8f09a1b4ad Fix exec summary printing to match the plan exactly.
Change-Id: I92f234a6f7adf4061d82ac4a32d220af17fe152d
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4440
Tested-by: jenkins
Reviewed-by: Nong Li <nong@cloudera.com>
2014-09-23 07:26:56 -07:00
Abdullah Yousufi
bd1f38832a IMPALA-1153: Avoid reprinting shell's welcome message after exceptions
Restructured how the cmd control flow executes commands in postcmd,
removing the hack to make non-interactive mode work. Now there are
values to represent the different command execution statuses.

Change-Id: I149b65d8a64d63a978fed284f0ad0da95833149c
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/3850
Reviewed-by: Abdullah Yousufi <abdullah.yousufi@cloudera.com>
Tested-by: jenkins
(cherry picked from commit b33dc4d10bcc3982dad43015343c91f1d277bb3f)
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4096
Reviewed-by: Henry Robinson <henry@cloudera.com>
2014-09-15 01:23:27 -07:00
Mike Yoder
75a97d3d7e [CDH5] Kerberize mini-cluster and Impala daemons
This is the first iteration of a kerberized development environment.
All the daemons start and use kerberos, with the sole exception of the
hive metastore.  This is sufficient to test impala authentication.

When buildall.sh is run using '-kerberize', it will stop before
loading data or attempting to run tests.

Loading data into the cluster is known to not work at this time, the
root causes being that Beeline -> HiveServer2 -> MapReduce throws
errors, and Beeline -> HiveServer2 -> HBase has problems.  These are
left for later work.

However, the impala daemons will happily authenticate using kerberos
both from clients (like the impala shell) and amongst each other.
This means that if you can get data into the mini-cluster, you could
query it.

Usage:
* Supply a '-kerberize' option to buildall.sh, or
* Supply a '-kerberize' option to create-test-configuration.sh, then
  'run-all.sh -format', re-source impala-config.sh, and then start
  impala daemons as usual.  You must reformat the cluster because
  kerberizing it will change all the ownership of all files in HDFS.

Notable changes:
* Added clean start/stop script for the llama-minikdc
* Creation of Kerberized HDFS - namenode and datanodes
* Kerberized HBase (and Zookeeper)
* Kerberized Hive (minus the MetaStore)
* Kerberized Impala
* Loading of data very nearly working

Still to go:
* Kerberize the MetaStore
* Get data loading working
* Run all tests
* The unknown unknowns
* Extensive testing

Change-Id: Iee3f56f6cc28303821fc6a3bf3ca7f5933632160
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4019
Reviewed-by: Michael Yoder <myoder@cloudera.com>
Tested-by: jenkins
2014-09-05 12:36:21 -07:00
Abdullah Yousufi
58e230409b Fix error message in impala-shell for queries that crash the impalad
An anti-join query in IMPALA-1175 revealed that the shell
mishandled the exception when the impalad would crash. This
fix prints the correct error message and sets the shell
state as disconnected.

Note there isn't a way to test this easily due to the difficulty
in coming up with a query that will crash the impalad.

Change-Id: I534674880db224a0d93dfd8bd2c081a12b65532b
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/3998
Reviewed-by: Abdullah Yousufi <abdullah.yousufi@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4080
2014-08-28 02:01:39 -07:00
Abdullah Yousufi
cc517a26d5 IMPALA-1126: Remove strict unicode mode flag in shell
Removed the the --strict_unicode command-line option flag
because encoding to utf-8 is the same regardless if the
encoding policy is strict or ignore.

Change-Id: If71062d580072c51acb1bb401471ca818c97a9be
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/3725
Reviewed-by: Abdullah Yousufi <abdullah.yousufi@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4078
2014-08-27 22:27:42 -07:00
Abdullah Yousufi
81546f35a6 IMPALA-1130: Multi-line query with unicode input throws UnicodeEncodeError
Change-Id: If9e8696ddb0287525573deade61a3de85a9a1081
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/3771
Reviewed-by: Abdullah Yousufi <abdullah.yousufi@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4069
2014-08-27 19:45:24 -07:00
Abdullah Yousufi
a80506ff3c Refactored impala-shell
This is a reorganization of the existing impala-shell.

The basic idea was to split up the shell into two components: one part
soley responsible for the CLI functionality, and another to represent
the impala client/connection that would interact with the Beeswax api and
execute queries, fetch results, etc.

One major change was to redo how the existing shell handled cancellation,
which was to create a thread for each rpc, so that Ctrl+C would not interrupt
the system calls and break the socket connection. In the new approach,
a new client instance is created to close the query and if the socket connection is
broken, the client reconnects. Cancellation currently works.

Change-Id: I0f371f68552c065b2317f967c6cf7483b44be3df
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/3316
Reviewed-by: Abdullah Yousufi <abdullah.yousufi@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4008
2014-08-22 20:13:04 -07:00
Abdullah Yousufi
bb853c47c7 IMPALA-755: Fix shell hanging due to escaped quotes
Commands with escaped single quotes would cause
the shell to enter an infinite loop while trying
to parse the command due to shlex not escaping single
quotes correctly. Once that change was implemented,
shlex would now ignore escaped single and double quotes
outside of closed quotes, so there needed to be a check for
that as well.

ALSO, implemented testing of commands in interactive mode.
Needed this to test these inputs, as command line input
cannot span multiple lines.

Change-Id: Id67368944eeb9a73061bc3e90bd6cda73c9d9f64
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/3408
Reviewed-by: Abdullah Yousufi <abdullah.yousufi@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/3893
2014-08-22 15:39:01 -07:00
Abdullah Yousufi
91d262a1d7 Include summary in profile when show_profiles option is enabled
Before, when the show_profiles -p option was enabled, the runtime profile
would be printed before the query was closed, preventing the query summary
from being printed. Now the profile is printed after the query is closed.

Change-Id: Icf7b10f7612d8016736aac70aa7b77265d391a98
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/3770
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/3821
Reviewed-by: Abdullah Yousufi <abdullah.yousufi@cloudera.com>
2014-08-18 16:10:09 -07:00
Abdullah Yousufi
504c83fe78 IMPALA-601: Read shell configuration from a file
Optionally loads options from a file in the user's home directory, called
'.impalarc', though the path to another file can be passed in as a command-line
option. The file must have a case-sensitive [impala] header. Specifying
the option in the command line overwrites the config file's value
for the option for that instance of the shell. If an option is not
specified in the config file, its default value is used.

Change-Id: I218da2c1e10308c5b8729883fa625f0c284397a7
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2956
Reviewed-by: Abdullah Yousufi <abdullah.yousufi@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/3629
2014-07-29 22:14:50 -07:00
Abdullah Yousufi
6c1e272ef7 IMPALA-1059: Make backticking -d option argument idempotent
There was an issue with the previous fix to IMPALA-1059
if the user tried to reconnect within the shell after
having passed in a database via the -d option. The
passed database would be doubly backticked. This makes
the backticking of the argument idempotent.

Change-Id: I6eaed997c2be73d8659a2a12046ce393b97ec82c
Reviewed-on: http://gerrit.ent.cloudera.com:8080/3467
Reviewed-by: Abdullah Yousufi <abdullah.yousufi@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/3502
2014-07-15 18:10:40 -07:00
Abdullah Yousufi
864ed53511 IMPALA-1059: Backtick argument passed to USE by shell -d option
If not backticked, arguments such as parquet are interpreted as
keywords, when it is possible a database by that name exists.

This could have been avoided via single quotes around backticks: -d '`parquet`'
Otherwise, -d `parquet` throws a commandline error.

In interactive mode, backticks alone (ex. use `parquet`) will pass the
name as an identifier rather than a keyword.

Change-Id: I24b43eeeb6b4bfda5388165856788a20b64bc2ba
Reviewed-on: http://gerrit.ent.cloudera.com:8080/3307
Reviewed-by: Abdullah Yousufi <abdullah.yousufi@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/3500
2014-07-15 15:43:49 -07:00
ishaan
f262fcea64 Support utf-8 input and out in the shell
Also add --strict_unicode option which controls whether invalid unicode
code points should be ignored on input.

Change-Id: Ice59d6dd3df4557ab3b1fc91d7ddc0e1bf03f1c7
Reviewed-on: http://gerrit.ent.cloudera.com:8080/3218
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Tested-by: jenkins
2014-07-02 23:18:27 -07:00
Skye Wanderman-Milne
c3c9365c17 Change shell to print WARNINGS instead of ERRORS
Change-Id: I8b41a2f4307e31eda970ca891adb4f12fea926bb
Reviewed-on: http://gerrit.ent.cloudera.com:8080/3088
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: Skye Wanderman-Milne <skye@cloudera.com>
(cherry picked from commit 0a655f759d5096def89d2c72be5aa9a0cb2c10b1)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/3149
2014-06-19 10:42:58 -07:00
Henry Robinson
d162571211 Fix 'summary' when exch map is not set
Change-Id: I66d9987f45f6cee045a300f86de357a2761929d7
Reviewed-on: http://gerrit.ent.cloudera.com:8080/3000
Reviewed-by: Henry Robinson <henry@cloudera.com>
Tested-by: jenkins
(cherry picked from commit 6f82cb296d0b3f0546d4e8a26485b79f20ff8996)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/3020
Tested-by: Henry Robinson <henry@cloudera.com>
2014-06-12 22:18:04 -07:00
Henry Robinson
9a7c6d286f Add 'summary' to shell
Users can now type 'summary' in the Impala shell after a query executes
to get a breakdown of the work done by each part of the query plan.

Change-Id: Ia6a43429ffc7778f3c2c8fcbf45d83828263c2ab
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2963
Tested-by: jenkins
Reviewed-by: Henry Robinson <henry@cloudera.com>
(cherry picked from commit 9b98d42acb14d43a64832767528ee572eac4979b)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2995
2014-06-12 02:59:58 -07:00
ayousufi
66e90d75ee IMPALA-286: Display set query options in default section in impala-shell
Options displayed with 'set' command. Default values distinguished
from set values by square brackets.

Change-Id: Iacf0574555aab78aa0ba2008ceb8776d372a57a5
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2913
Reviewed-by: Abdullah Yousufi <abdullah.yousufi@cloudera.com>
Tested-by: jenkins
2014-06-11 11:51:19 -07:00
Skye Wanderman-Milne
76fa721cc4 Make shell only print error/warning log once.
Without this change, the shell would always print the error log twice
for successful non-insert queries (once in __execute_query() and once
in __fetch()).

Change-Id: I0ab038230df897559b30feaea34778ea72988bc3
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2815
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: jenkins
(cherry picked from commit 095dba7f395491db03daf19ff3bff2e2b4640ee4)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2908
2014-06-09 13:40:14 -07:00
ayousufi
5a4a8aca81 IMPALA-931: Indicate in impala-shell --help that verbose output is enabled by default
Change-Id: I6c29d542c4379d46fcdce62905c89b319628dd61
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2842
Reviewed-by: Abdullah Yousufi <abdullah.yousufi@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2892
2014-06-06 19:58:07 -07:00
Taras Bobrovytsky
46aba6149d CDH-18512: Modification to allow spaces around the = sign in SET in impala-shell
Change-Id: I3c149e9a27962ed1130b1ddbb02952f4254bd4c9
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2609
Reviewed-by: Taras Bobrovytsky <tbobrovytsky@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2645
2014-05-21 15:34:24 -07:00