Closed alexanderdean closed 10 years ago
This basically makes lingual shell unusable for non-interactive use (e.g. scripting).
can you try this: echo "select count(*) from \"api_in\".\"api_full_stats\";" | lingual shell -
Note the "-" at the end. It tells lingual, that this is not an interactive session, but it should just read from stdin, run and exit.
Hmm same problem:
vagrant@master:~$ echo "select count(*) from \"api_in\".\"api_full_stats\";" | lingual shell -
Concurrent, Inc - Lingual 1.0.2
only 10,000 rows will be displayed
sqlline version 1.1.6
0: jdbc:lingual:local> select count(*) from "api_in"."api_full_stats";
Error: From line 1, column 22 to line 1, column 46: "Table 'api_in.api_full_stats' not found" (state=,code=0)
0: jdbc:lingual:local> Closing: SC
vagrant@master:~$ echo $?
0
Thanks. We'll look into this.
On Sun, Feb 16, 2014 at 1:27 PM, Alexander Dean notifications@github.comwrote:
Hmm same problem:
vagrant@master:~$ echo "select count(_) from \"api_in\".\"api_fullstats\";" | lingual shell - Concurrent, Inc - Lingual 1.0.2 only 10,000 rows will be displayed sqlline version 1.1.6 0: jdbc:lingual:local> select count() from "api_in"."api_full_stats"; Error: From line 1, column 22 to line 1, column 46: "Table 'api_in.api_full_stats' not found" (state=,code=0) 0: jdbc:lingual:local> Closing: SC
vagrant@master:~$ echo $? 0
Reply to this email directly or view it on GitHubhttps://github.com/Cascading/lingual/issues/14#issuecomment-35213259 .
Thanks guys
Ouch, it's actually worse than I thought. Not only 0
for failed queries, but 1
for successful queries!
vagrant@master:~$ lingual shell <<- EOQ
> INSERT INTO "api_out"."api_full_stats"
>
.bash_history .bashrc .cascading/ .lingual/ postinstall.sh .ssh/ test.sh .veewee_version
.bash_logout .cache/ .ivy2/ load-hbase-txns.sh .profile .sudo_as_admin_successful .vbox_version
> SELECT * FROM "api_in"."api_full_stats";
> EOQ
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/CascadingSDK/tools/lingual-client/bin/cascading-hbase-2.2.0-provider.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/hadoop-1.2.1/lib/slf4j-log4j12-1.4.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
Concurrent, Inc - Lingual 1.0.2
only 10,000 rows will be displayed
sqlline version 1.1.6
0: jdbc:lingual:hadoop> INSERT INTO "api_out"."api_full_stats"
. . . . . . . . . . . > SELECT * FROM "api_in"."api_full_stats";
{utcTimestamp=1392737556637, currentTimestamp=1392737556637, localTimestamp=1392737556637, timeZone=sun.util.calendar.ZoneInfo[id="Etc/UTC",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]}
+-----------+
| ROWCOUNT |
+-----------+
| 100000 |
+-----------+
1 row selected (57.778 seconds)
0: jdbc:lingual:hadoop> Closing: SC
vagrant@master:~$ echo $?
1
even if there is a bug, you will have to add the "-" to the invocation, to make it all work. We should get to the problem soon.
Sorry yes, that was an attempt to see if the issue still happened without the '-', I was using '-' by default...
The bug is with the sqlline library we use which defaults to calling System.exit() when we don't really want it to (and to returning the opposite of what it should in non-interactive mode). I'm fixing the code to properly pass the error.
On Tue, Feb 18, 2014 at 7:48 AM, Alexander Dean notifications@github.comwrote:
Sorry yes, that was an attempt to see if the issue still happened without the '-', I was using '-' by default...
Reply to this email directly or view it on GitHubhttps://github.com/Cascading/lingual/issues/14#issuecomment-35397310 .
Nice one, thanks @joeposner
This is also fixed in the latest wip build. Closing this one as well.
We did have a bug that needed fixing and as noted, that's now resolved.
But that said you want to use "-sql -" not "-" as the arg when piping data to lingual shell. The "-sql -" means "process stdin with the expectation that it's SQL" whereas any other arg gets processed as if you typed it in the interactive prompt.
Thanks @joeposner - good to know about --sql -
...