You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2019/06/28 05:32:14 UTC

[impala] branch master updated (a20977a -> c353cf7)

This is an automated email from the ASF dual-hosted git repository.

tarmstrong pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git.


    from a20977a  IMPALA-8630: Hash the full path when calculating consistent remote placement
     new 63b2df7  Add ext-py/bitarray-0.9.0 in .gitignore
     new e59e926  IMPALA-8612: Fix sporadic NPE when dropping an authorized table
     new c353cf7  IMPALA-8713: fix stack overflow in unhex()

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 be/src/exprs/expr-test.cc                                   |  3 +++
 be/src/exprs/math-functions-ir.cc                           |  6 +++---
 .../org/apache/impala/analysis/DropTableOrViewStmt.java     | 13 +++++++++----
 shell/.gitignore                                            |  2 ++
 4 files changed, 17 insertions(+), 7 deletions(-)


[impala] 03/03: IMPALA-8713: fix stack overflow in unhex()

Posted by ta...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tarmstrong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit c353cf7a648651244ac39677d0cb028e704281d0
Author: Tim Armstrong <ta...@cloudera.com>
AuthorDate: Wed Jun 26 16:24:11 2019 -0700

    IMPALA-8713: fix stack overflow in unhex()
    
    Write the results into the output heap buffer
    instead of into a temporary stack buffer.
    
    No additional memory is used because
    AnyValUtil::FromBuffer() allocated a temporary
    buffer anyway.
    
    Testing:
    Added a targeted test to expr-test that caused
    a crash before this fix.
    
    Change-Id: Ie0c1760511a04c0823fc465cf6e529e9681b2488
    Reviewed-on: http://gerrit.cloudera.org:8080/13743
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 be/src/exprs/expr-test.cc         | 3 +++
 be/src/exprs/math-functions-ir.cc | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/be/src/exprs/expr-test.cc b/be/src/exprs/expr-test.cc
index 76fdf1a..b11dd52 100644
--- a/be/src/exprs/expr-test.cc
+++ b/be/src/exprs/expr-test.cc
@@ -5531,6 +5531,9 @@ TEST_P(ExprTest, MathConversionFunctions) {
   TestStringValue("unhex('30GA')", "");
   // Uneven number of chars results in empty string.
   TestStringValue("unhex('30A')", "");
+  // IMPALA-8713: stack overflow in unhex().
+  TestValue("length(unhex(repeat('a', 1024 * 1024 * 1024)))",
+      TYPE_INT, 512 * 1024 * 1024);
 
   // Run the test suite twice, once with a bigint parameter, and once with
   // string parameters.
diff --git a/be/src/exprs/math-functions-ir.cc b/be/src/exprs/math-functions-ir.cc
index d938953..527b51b 100644
--- a/be/src/exprs/math-functions-ir.cc
+++ b/be/src/exprs/math-functions-ir.cc
@@ -258,7 +258,7 @@ StringVal MathFunctions::Unhex(FunctionContext* ctx, const StringVal& s) {
   if (s.len % 2 != 0) return StringVal();
 
   int result_len = s.len / 2;
-  char result[result_len];
+  StringVal result(ctx, result_len);
   int res_index = 0;
   int s_index = 0;
   while (s_index < s.len) {
@@ -300,10 +300,10 @@ StringVal MathFunctions::Unhex(FunctionContext* ctx, const StringVal& s) {
           return StringVal();
       }
     }
-    result[res_index] = c;
+    result.ptr[res_index] = c;
     ++res_index;
   }
-  return AnyValUtil::FromBuffer(ctx, result, result_len);
+  return result;
 }
 
 StringVal MathFunctions::ConvInt(FunctionContext* ctx, const BigIntVal& num,


[impala] 01/03: Add ext-py/bitarray-0.9.0 in .gitignore

Posted by ta...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tarmstrong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 63b2df763223ba2bd8651e4db679579f3ab132e7
Author: Fredy Wijaya <fw...@cloudera.com>
AuthorDate: Wed Jun 26 16:41:36 2019 -0700

    Add ext-py/bitarray-0.9.0 in .gitignore
    
    Change-Id: I22abd82eb2c5a4a52fd56fd2266b636a0dbde071
    Reviewed-on: http://gerrit.cloudera.org:8080/13745
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 shell/.gitignore | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/shell/.gitignore b/shell/.gitignore
index f9874f8..e402362 100644
--- a/shell/.gitignore
+++ b/shell/.gitignore
@@ -8,6 +8,8 @@ ext-py/prettytable-0.7.1/prettytable.egg-info
 ext-py/sqlparse-0.1.19/dist/
 ext-py/sqlparse-0.1.19/build/
 ext-py/sqlparse-0.1.19/sqlparse.egg-info/
+ext-py/bitarray-0.9.0/bitarray.egg-info/
+ext-py/bitarray-0.9.0/dist/
 
 # This file is used by buildall.sh to find files that need to be removed during the
 # clean phase. Previous version of deps should be kept here for cleaning otherwise they


[impala] 02/03: IMPALA-8612: Fix sporadic NPE when dropping an authorized table

Posted by ta...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tarmstrong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit e59e9261339a7a353c05548df84ff0d8793b768d
Author: Gabor Kaszab <ga...@cloudera.com>
AuthorDate: Tue Jun 4 15:12:06 2019 +0200

    IMPALA-8612: Fix sporadic NPE when dropping an authorized table
    
    In the analyze() function of DropTableOrViewStmt it's possible that
    serverName_ is not set when analyzer.getTable() throws. As a result
    when the Catalog executes the drop table DDL it runs into a failing
    Precondition check and throws a NullPointerException when updating
    user privileges. Note, to run into the NPE it's required to have
    authorization enabled.
    
    Change-Id: I70bd7ca4796b24920ee156436bf8bbc682e7d952
    Reviewed-on: http://gerrit.cloudera.org:8080/13508
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 .../org/apache/impala/analysis/DropTableOrViewStmt.java     | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/fe/src/main/java/org/apache/impala/analysis/DropTableOrViewStmt.java b/fe/src/main/java/org/apache/impala/analysis/DropTableOrViewStmt.java
index 3619d9e..be083a4 100644
--- a/fe/src/main/java/org/apache/impala/analysis/DropTableOrViewStmt.java
+++ b/fe/src/main/java/org/apache/impala/analysis/DropTableOrViewStmt.java
@@ -28,6 +28,8 @@ import org.apache.impala.thrift.TAccessEvent;
 import org.apache.impala.thrift.TCatalogObjectType;
 import org.apache.impala.thrift.TDropTableOrViewParams;
 import org.apache.impala.thrift.TTableName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Preconditions;
 
@@ -35,6 +37,8 @@ import com.google.common.base.Preconditions;
  * Represents a DROP TABLE/VIEW [IF EXISTS] statement
  */
 public class DropTableOrViewStmt extends StatementBase {
+  private static final Logger LOG = LoggerFactory.getLogger(DropTableOrViewStmt.class);
+
   protected final TableName tableName_;
   protected final boolean ifExists_;
 
@@ -99,6 +103,9 @@ public class DropTableOrViewStmt extends StatementBase {
   @Override
   public void analyze(Analyzer analyzer) throws AnalysisException {
     dbName_ = analyzer.getTargetDbName(tableName_);
+    // Set the servername here if authorization is enabled because analyzer_ is not
+    // available in the toThrift() method.
+    serverName_ = analyzer.getServerName();
     try {
       FeTable table = analyzer.getTable(tableName_, /* add access event */ true,
           /* add column-level privilege */ false, Privilege.DROP);
@@ -112,10 +119,6 @@ public class DropTableOrViewStmt extends StatementBase {
         throw new AnalysisException(String.format(
             "DROP VIEW not allowed on a table: %s.%s", dbName_, getTbl()));
       }
-      // Set the servername here if authorization is enabled because analyzer_ is not
-      // available in the toThrift() method.
-      serverName_ = analyzer.getServerName();
-
     } catch (TableLoadingException e) {
       // We should still try to DROP tables that failed to load, so that tables that are
       // in a bad state, eg. deleted externally from Kudu, can be dropped.
@@ -125,8 +128,10 @@ public class DropTableOrViewStmt extends StatementBase {
       analyzer.addAccessEvent(new TAccessEvent(
           analyzer.getFqTableName(tableName_).toString(), TCatalogObjectType.TABLE,
           Privilege.DROP.toString()));
+      LOG.info("Ignoring TableLoadingException for {}", tableName_);
     } catch (AnalysisException e) {
       if (!ifExists_) throw e;
+      LOG.info("Ignoring AnalysisException for {}", tableName_);
     }
   }