You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by pa...@apache.org on 2015/03/12 05:15:13 UTC

[1/2] drill git commit: DRILL-1719 - handle the case in which /var/log/drill exists but the current user does not have permission to write to it

Repository: drill
Updated Branches:
  refs/heads/master b3bdc2790 -> 710656a19


DRILL-1719 - handle the case in which /var/log/drill exists but the current user does not have permission to write to it


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/103d40ef
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/103d40ef
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/103d40ef

Branch: refs/heads/master
Commit: 103d40efac82b1bfd7a6cedf6db2db94031ffaf8
Parents: b3bdc27
Author: Patrick Wong <pw...@maprtech.com>
Authored: Mon Nov 17 15:16:10 2014 -0800
Committer: Parth Chandra <pc...@maprtech.com>
Committed: Wed Mar 11 21:13:17 2015 -0700

----------------------------------------------------------------------
 distribution/src/resources/drill-config.sh | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/103d40ef/distribution/src/resources/drill-config.sh
----------------------------------------------------------------------
diff --git a/distribution/src/resources/drill-config.sh b/distribution/src/resources/drill-config.sh
index 210c246..0ee181d 100644
--- a/distribution/src/resources/drill-config.sh
+++ b/distribution/src/resources/drill-config.sh
@@ -80,10 +80,19 @@ fi
 # get log directory
 if [ "$DRILL_LOG_DIR" = "" ]; then
   DRILL_LOG_DIR=/var/log/drill
+  touch $DRILL_LOG_DIR/sqlline.log
+  TOUCH_EXIT_CODE=$?
+  if [ $TOUCH_EXIT_CODE = 0 ]; then
+    echo "Default Drill log directory: $DRILL_LOG_DIR"
+    DRILL_LOG_DIR_FALLBACK=0
+  else
+    #Force DRILL_LOG_DIR to fall back
+    DRILL_LOG_DIR_FALLBACK=1
+  fi
 fi
 
-if [ ! -d $DRILL_LOG_DIR ]; then
-  echo "Drill log directory $DRILL_LOG_DIR does not exist, defaulting to $DRILL_HOME/log"
+if [ ! -d $DRILL_LOG_DIR ] || [ $DRILL_LOG_DIR_FALLBACK = 1 ]; then
+  echo "Drill log directory $DRILL_LOG_DIR does not exist or is not writable, defaulting to $DRILL_HOME/log"
   DRILL_LOG_DIR=$DRILL_HOME/log
   mkdir -p $DRILL_LOG_DIR
 fi


[2/2] drill git commit: DRILL-2128.1: Preparatory changes: Labeled result cols.; formatted SQL. [MetaImpl]

Posted by pa...@apache.org.
DRILL-2128.1: Preparatory changes: Labeled result cols.; formatted SQL. [MetaImpl]


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/710656a1
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/710656a1
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/710656a1

Branch: refs/heads/master
Commit: 710656a1949e249dc7ad326dccc7c632f563495c
Parents: 103d40e
Author: dbarclay <db...@maprtech.com>
Authored: Tue Mar 10 21:10:14 2015 -0700
Committer: Parth Chandra <pc...@maprtech.com>
Committed: Wed Mar 11 21:13:59 2015 -0700

----------------------------------------------------------------------
 .../java/org/apache/drill/jdbc/MetaImpl.java    | 66 +++++++++++---------
 1 file changed, 36 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/710656a1/exec/jdbc/src/main/java/org/apache/drill/jdbc/MetaImpl.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/MetaImpl.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/MetaImpl.java
index 0ea8d5c..127751d 100644
--- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/MetaImpl.java
+++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/MetaImpl.java
@@ -125,48 +125,54 @@ public class MetaImpl implements Meta {
   }
 
   public ResultSet getColumns(String catalog, Pat schemaPattern, Pat tableNamePattern, Pat columnNamePattern) {
-
     StringBuilder sb = new StringBuilder();
-    sb.append("select "
-        + "TABLE_CATALOG as TABLE_CAT, "
-        + "TABLE_SCHEMA as TABLE_SCHEM, "
-        + "TABLE_NAME, "
-        + "COLUMN_NAME, "
-        + "DATA_TYPE, "
-        + "CHARACTER_MAXIMUM_LENGTH as BUFFER_LENGTH, "
-        + "NUMERIC_PRECISION as DECIMAL_PRECISION, "
-        + "NUMERIC_PRECISION_RADIX as NUM_PREC_RADIX, "
-        + DatabaseMetaData.columnNullableUnknown
-        + " as NULLABLE, "
-        + "'' as REMARKS, "
-        + "'' as COLUMN_DEF, "
-        + "0 as SQL_DATA_TYPE, "
-        + "0 as SQL_DATETIME_SUB, "
-        + "4 as CHAR_OCTET_LENGTH, "
-        + "1 as ORDINAL_POSITION, "
-        + "'YES' as IS_NULLABLE, "
-        + "'' as SCOPE_CATALOG,"
-        + "'' as SCOPE_SCHEMA, "
-        + "'' as SCOPE_TABLE, "
-        + "'' as SOURCE_DATA_TYPE, "
-        + "'' as IS_AUTOINCREMENT, "
-        + "'' as IS_GENERATEDCOLUMN "
-        + "FROM INFORMATION_SCHEMA.COLUMNS "
+    sb.append(
+        "SELECT \n"
+        // getColumns INFORMATION_SCHEMA.COLUMNS   getColumns()
+        // column     source column or             column name
+        // number     expression
+        // -------    ------------------------     -------------
+        + /*  1 */ "  TABLE_CATALOG            as  TABLE_CAT, \n"
+        + /*  2 */ "  TABLE_SCHEMA             as  TABLE_SCHEM, \n"
+        + /*  3 */ "  TABLE_NAME               as  TABLE_NAME, \n"
+        + /*  4 */ "  COLUMN_NAME              as  COLUMN_NAME, \n"
+        + /*  5 */ "  DATA_TYPE                as  DATA_TYPE, \n"
+        ///*  6 */                             #6: TYPE_NAME
+        ///*  7 */                             #7: COLUMN_SIZE
+        + /*  8 */ "  CHARACTER_MAXIMUM_LENGTH as  BUFFER_LENGTH, \n"
+        + /*  9 */ "  NUMERIC_PRECISION        as  DECIMAL_PRECISION, \n" // #9: DECIMAL_DIGITS
+        + /* 10 */ "  NUMERIC_PRECISION_RADIX  as  NUM_PREC_RADIX, \n"
+        + /* 11 */ "  " + DatabaseMetaData.columnNullableUnknown
+        +             "                        as  NULLABLE, \n"
+        + /* 12 */ "  ''                       as  REMARKS, \n"
+        + /* 13 */ "  ''                       as  COLUMN_DEF, \n"
+        + /* 14 */ "  0                        as  SQL_DATA_TYPE, \n"
+        + /* 15 */ "  0                        as  SQL_DATETIME_SUB, \n"
+        + /* 16 */ "  4                        as  CHAR_OCTET_LENGTH, \n"
+        + /* 17 */ "  1                        as  ORDINAL_POSITION, \n"
+        + /* 18 */ "  'YES'                    as  IS_NULLABLE, \n"
+        + /* 19 */ "  ''                       as  SCOPE_CATALOG,"
+        + /* 20 */ "  ''                       as  SCOPE_SCHEMA, \n"
+        + /* 21 */ "  ''                       as  SCOPE_TABLE, \n"
+        + /* 22 */ "  ''                       as  SOURCE_DATA_TYPE, \n"
+        + /* 23 */ "  ''                       as  IS_AUTOINCREMENT, \n"
+        + /* 24 */ "  ''                       as  IS_GENERATEDCOLUMN \n"
+        + "FROM INFORMATION_SCHEMA.COLUMNS \n"
         + "WHERE 1=1 ");
 
     if (catalog != null) {
-      sb.append(" AND TABLE_CATALOG = '" + DrillStringUtils.escapeSql(catalog) + "' ");
+      sb.append("\n  AND TABLE_CATALOG = '" + DrillStringUtils.escapeSql(catalog) + "'");
     }
     if (schemaPattern.s != null) {
-      sb.append(" AND TABLE_SCHEMA like '" + DrillStringUtils.escapeSql(schemaPattern.s) + "'");
+      sb.append("\n  AND TABLE_SCHEMA like '" + DrillStringUtils.escapeSql(schemaPattern.s) + "'");
     }
 
     if (tableNamePattern.s != null) {
-      sb.append(" AND TABLE_NAME like '" + DrillStringUtils.escapeSql(tableNamePattern.s) + "'");
+      sb.append("\n  AND TABLE_NAME like '" + DrillStringUtils.escapeSql(tableNamePattern.s) + "'");
     }
 
     if (columnNamePattern.s != null) {
-      sb.append(" AND COLUMN_NAME like '" + DrillStringUtils.escapeSql(columnNamePattern.s) + "'");
+      sb.append("\n  AND COLUMN_NAME like '" + DrillStringUtils.escapeSql(columnNamePattern.s) + "'");
     }
 
     sb.append(" ORDER BY TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME");