drill-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Matta <cma...@mapr.com>
Subject sqlline returns 0 wether or not the query fails
Date Wed, 19 Nov 2014 17:55:11 GMT
I have two sql files:

good_query.sql

show databases;

bad_query.sql

show databaes;

I’m calling them with a sqlline alias: sqlline -f filename.sql, both the
good and bad file return 0 at the shell:

[root@ip-172-16-1-173 ~]# sqlline -f good_query.sql
1/1          show databases;
+-------------+
| SCHEMA_NAME |
+-------------+
| maprdb      |
| cp.default  |
| mfs.default |
| mfs.cmatta  |
| mfs.nested  |
| mfs.root    |
| mfs.views   |
| mfs.flat    |
| sys         |
| INFORMATION_SCHEMA |
+-------------+
10 rows selected (0.203 seconds)
Closing: org.apache.drill.jdbc.DrillJdbc41Factory$DrillJdbc41Connection
sqlline version 1.1.6

[root@ip-172-16-1-173 ~]# echo $?
0

[root@ip-172-16-1-173 ~]# sqlline -f bad_query.sql
1/1          show databaes;
Query failed: Failure while parsing sql : Encountered "show databaes"
at line 1, column 1.
Was expecting one of:

--snip--
Error: exception while executing query: Failure while executing query.
(state=,code=0)
Aborting command set because "force" is false and command failed:
"show databaes;"
Closing: org.apache.drill.jdbc.DrillJdbc41Factory$DrillJdbc41Connection
sqlline version 1.1.6

[root@ip-172-16-1-173 ~]# echo $?
0

For scripting purposes shouldn’t the bad query return 1?

Chris Matta
cmatta@mapr.com
215-701-3146
​

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message