You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by ja...@apache.org on 2013/09/04 05:14:25 UTC
[05/13] git commit: sqlline and run bit changes
sqlline and run bit changes
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/1212cc71
Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/1212cc71
Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/1212cc71
Branch: refs/heads/master
Commit: 1212cc71a3335cb12739a70637d146f8f083edd5
Parents: 13fac4d
Author: Steven Phillips <sp...@maprtech.com>
Authored: Mon Sep 2 18:28:30 2013 -0700
Committer: Steven Phillips <sp...@maprtech.com>
Committed: Tue Sep 3 17:34:23 2013 -0700
----------------------------------------------------------------------
.../prototype/distribution/src/resources/runbit | 2 +-
.../distribution/src/resources/sqlline | 36 ++++++++++++++++++--
.../org/apache/drill/jdbc/DrillHandler.java | 1 +
3 files changed, 35 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/1212cc71/sandbox/prototype/distribution/src/resources/runbit
----------------------------------------------------------------------
diff --git a/sandbox/prototype/distribution/src/resources/runbit b/sandbox/prototype/distribution/src/resources/runbit
index 4e1b599..77f28a3 100755
--- a/sandbox/prototype/distribution/src/resources/runbit
+++ b/sandbox/prototype/distribution/src/resources/runbit
@@ -5,7 +5,7 @@ if [ -z $JAVA_HOME ]
then
JAVA=`which java`
else
- JAVA=$JAVA_HOME/bin/java
+ JAVA=`find $JAVA_HOME -name java`
fi
if [ -e $JAVA ]; then
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/1212cc71/sandbox/prototype/distribution/src/resources/sqlline
----------------------------------------------------------------------
diff --git a/sandbox/prototype/distribution/src/resources/sqlline b/sandbox/prototype/distribution/src/resources/sqlline
index 973da49..ea05cc8 100755
--- a/sandbox/prototype/distribution/src/resources/sqlline
+++ b/sandbox/prototype/distribution/src/resources/sqlline
@@ -1,11 +1,30 @@
#!/bin/bash
+ARGS=();
+while [ $# -gt 0 ]
+do
+ case "$1" in
+ -q) shift;
+ QUERY=$1;;
+ -e) shift;
+ QUERY=$1;;
+ -f) shift;
+ FILE=$1;;
+ *) ARGS+=($1);;
+ esac
+ shift
+done
+
+bin=`dirname "${BASH_SOURCE-$0}"`
+bin=`cd "$bin">/dev/null; pwd`
+
+. "$bin"/drill-config.sh
if [ -z $JAVA_HOME ]
then
JAVA=`which java`
else
- JAVA=$JAVA_HOME/bin/java
+ JAVA=`find $JAVA_HOME -name java`
fi
if [ -e $JAVA ]; then
@@ -24,7 +43,18 @@ fi
CP=$DRILL_HOME/jars/*:$CP
CP=$DRILL_HOME/lib/*:$CP
+CP=$DRILL_HOME/contrib/*:$CP
-CP=$CP:$DRILL_CONF_DIR
+CP=$DRILL_CONF_DIR:$CP
-exec $DRILL_JAVA_OPTS -cp $CP sqlline.SqlLine "$@"
+echo $QUERY
+
+if [ -n "$QUERY" ]
+then
+ echo $QUERY | exec $JAVA $DRILL_SHELL_JAVA_OPTS $DRILL_JAVA_OPTS -cp $CP sqlline.SqlLine "${ARGS[@]}"
+elif [ -n "$FILE" ]
+then
+ exec $JAVA $DRILL_SHELL_JAVA_OPTS $DRILL_JAVA_OPTS -cp $CP sqlline.SqlLine "${ARGS[@]}" --run=$FILE
+else
+ exec $JAVA $DRILL_SHELL_JAVA_OPTS $DRILL_JAVA_OPTS -cp $CP sqlline.SqlLine "${ARGS[@]}"
+fi
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/1212cc71/sandbox/prototype/sqlparser/src/main/java/org/apache/drill/jdbc/DrillHandler.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/sqlparser/src/main/java/org/apache/drill/jdbc/DrillHandler.java b/sandbox/prototype/sqlparser/src/main/java/org/apache/drill/jdbc/DrillHandler.java
index 6b45843..be5ab9c 100644
--- a/sandbox/prototype/sqlparser/src/main/java/org/apache/drill/jdbc/DrillHandler.java
+++ b/sandbox/prototype/sqlparser/src/main/java/org/apache/drill/jdbc/DrillHandler.java
@@ -108,6 +108,7 @@ public class DrillHandler extends HandlerImpl {
.getExpression()));
} catch (Exception ex) {
+ System.out.println(ex);
throw new SQLException("Failure trying to connect to Drill.", ex);
}
}