drill-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Veera Naranammalpuram <vnaranammalpu...@maprtech.com>
Subject Re: Query execution in Drill
Date Fri, 03 Jun 2016 14:50:50 GMT
You can pass the -e or -q options to drill-embedded. Does the following
work?

[root@ip-172-16-2-147 apache-drill-1.6.0]# bin/*drill-embedded -e 'select
count(*) from (values(1));'*
Jun 03, 2016 10:46:32 AM org.glassfish.jersey.server.ApplicationHandler
initialize
INFO: Initiating Jersey application, version Jersey: 2.8 2014-04-29
01:25:26...
apache drill 1.6.0
"a drill is a terrible thing to waste"
0: jdbc:drill:zk=local> select count(*) from (values(1));
+---------+
| EXPR$0  |
+---------+
| 1       |
+---------+
1 row selected (2.091 seconds)
0: jdbc:drill:zk=local> Closing:
org.apache.drill.jdbc.impl.DrillConnectionImpl

Its really documented but this switch is embedded in the sqlline script
which is called by bin/drill-embedded

while [ $# -gt 0 ] ; do
  case "$1" in
  -q) shift;
      QUERY=$1;;
*  -e) shift;*
*      QUERY=$1;;*
  -f) shift;
      FILE=$1;;
   *) ARGS+=($1);;
  esac
  shift
done

-Veera


On Fri, Jun 3, 2016 at 10:41 AM, Sebastian Hamann <drvmmen@web.de> wrote:

> Hi,
> Iam currently trying to write a shell script to automatically setup drill
> (embedded for now) and execute queries on it.
> 1. Is there an option to execute SQL from command line or file, like in
> Hive?
> (I mean the hive -e 'sql statement' or hive -f <filename>)
>
> 2. If not: What is a good way to simulate such behaviour? Based on an idea
> of mine: Is there maybe a way to start drill without starting the drill
> prompt so that I can send queries through the rest API in the same script?
>
> I have looked throught he archives and google and still could not find an
> easy solution for this.
>
> Thanks in advance!
>



-- 
Veera Naranammalpuram
Product Specialist - SQL on Hadoop
*MapR Technologies (www.mapr.com <http://www.mapr.com>)*
*(Email) vnaranammalpuram@maprtech.com <naranammalpuram@maprtech.com>*
*(Mobile) 917 683 8116 - can text *
*Timezone: ET (UTC -5:00 / -4:00)*

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