You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jo...@apache.org on 2019/07/03 17:42:41 UTC

[impala] 01/05: IMPALA-8734: Reload table schema on TBLPROPERTIES change

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

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

commit 252b117954065db68eba746ca5afb0476c94313b
Author: Fredy Wijaya <fw...@cloudera.com>
AuthorDate: Tue Jul 2 11:41:27 2019 -0500

    IMPALA-8734: Reload table schema on TBLPROPERTIES change
    
    Prior to this patch, an INVALIDATE METADATA was required when altering
    the TBLPROPERTIES for the changes to take effect. With this patch the
    table schema is automatically reloaded on TBLPROPERTIES change.
    
    Testing:
    - Added a new test in test_ddl.py
    - Ran test_ddl.py
    
    Change-Id: I2a43a962c2a456f3ddc078b2924f551fccb5c2ad
    Reviewed-on: http://gerrit.cloudera.org:8080/13785
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 .../org/apache/impala/service/CatalogOpExecutor.java  |  1 +
 tests/metadata/test_ddl.py                            | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/fe/src/main/java/org/apache/impala/service/CatalogOpExecutor.java b/fe/src/main/java/org/apache/impala/service/CatalogOpExecutor.java
index fc27cdb..ae968a9 100644
--- a/fe/src/main/java/org/apache/impala/service/CatalogOpExecutor.java
+++ b/fe/src/main/java/org/apache/impala/service/CatalogOpExecutor.java
@@ -654,6 +654,7 @@ public class CatalogOpExecutor {
         case SET_TBL_PROPERTIES:
           alterTableSetTblProperties(tbl, params.getSet_tbl_properties_params(),
               numUpdatedPartitions);
+          reloadTableSchema = true;
           if (params.getSet_tbl_properties_params().isSetPartition_set()) {
             addSummary(response,
                 "Updated " + numUpdatedPartitions.getRef() + " partition(s).");
diff --git a/tests/metadata/test_ddl.py b/tests/metadata/test_ddl.py
index 5266718..dce0b69 100644
--- a/tests/metadata/test_ddl.py
+++ b/tests/metadata/test_ddl.py
@@ -691,6 +691,25 @@ class TestDdlStatements(TestDdlBase):
     assert properties['p2'] == 'val3'
     assert properties[''] == ''
 
+  def test_alter_tbl_properties_reload(self, vector, unique_database):
+    # IMPALA-8734: Force a table schema reload when setting table properties.
+    tbl_name = "test_tbl"
+    self.execute_query_expect_success(self.client, "create table {0}.{1} (c1 string)"
+                                      .format(unique_database, tbl_name))
+    self.filesystem_client.create_file("test-warehouse/{0}.db/{1}/f".
+                                       format(unique_database, tbl_name),
+                                       file_data="\nfoo\n")
+    self.execute_query_expect_success(self.client,
+                                      "alter table {0}.{1} set tblproperties"
+                                      "('serialization.null.format'='foo')"
+                                      .format(unique_database, tbl_name))
+    result = self.execute_query_expect_success(self.client,
+                                               "select * from {0}.{1}"
+                                               .format(unique_database, tbl_name))
+    assert len(result.data) == 2
+    assert result.data[0] == ''
+    assert result.data[1] == 'NULL'
+
   @UniqueDatabase.parametrize(sync_ddl=True)
   def test_partition_ddl_predicates(self, vector, unique_database):
     self.run_test_case('QueryTest/partition-ddl-predicates-all-fs', vector,