Browse Source

HUE-1307 [metastore] Browsing partition fails

Abraham Elmahrek 12 năm trước cách đây
mục cha
commit
aca5696f36

+ 1 - 1
apps/beeswax/src/beeswax/server/dbms.py

@@ -339,7 +339,7 @@ class Dbms:
 
     partition_query = ""
     for idx, key in enumerate(partitions[partition_id].values):
-      partition_query += (idx > 0 and " AND " or "") + table.partition_keys[idx].name + "=" + key
+      partition_query += (idx > 0 and " AND " or "") + table.partition_keys[idx].name + "='%s'" % key
 
     hql = "SELECT * FROM `%s.%s` WHERE %s" % (db_name, table_name, partition_query)
 

+ 2 - 2
apps/metastore/src/metastore/templates/popups/load_data.mako

@@ -19,7 +19,7 @@ from django.utils.translation import ugettext as _
 
 <%namespace name="comps" file="../components.mako" />
 
-<form method="POST" class="form-horizontal" id="load-data-form">
+<form method="POST" class="form-horizontal" id="load-data-form" onsubmit="return false;">
     <div class="modal-header">
         <a href="#" class="close" data-dismiss="modal">&times;</a>
         <h3>${_('Import data')}</h3>
@@ -58,7 +58,7 @@ from django.utils.translation import ugettext as _
 
     <div class="modal-footer">
         <a href="#" class="btn" data-dismiss="modal">${_('Cancel')}</a>
-        <button href="#" class="btn btn-primary" id="load-data-submit-btn" disabled="disabled">${_('Submit')}</button>
+        <button class="btn btn-primary" id="load-data-submit-btn" disabled="disabled">${_('Submit')}</button>
     </div>
 </form>
 

+ 6 - 1
apps/metastore/src/metastore/tests.py

@@ -126,7 +126,7 @@ class TestMetastoreWithHadoop(BeeswaxSampleProvider):
     response = self.client.get("/metastore/table/default/test/partitions", follow=True)
     assert_true("is not partitioned." in response.content)
 
-  def test_browse_partitions_with_limit(self):
+  def test_browse_partitioned_table_with_limit(self):
     # Limit to 90
     finish = BROWSE_PARTITIONED_TABLE_LIMIT.set_for_testing("90")
     try:
@@ -136,6 +136,11 @@ class TestMetastoreWithHadoop(BeeswaxSampleProvider):
     finally:
       finish()
 
+  def test_browse_partitions(self):
+    response = self.client.get("/metastore/table/default/test_partitions/partitions/0", follow=True)
+    response = wait_for_query_to_finish(self.client, response, max=30.0)
+    assert_true(len(response.context['results']) > 10)
+
   def test_drop_multi_tables(self):
     hql = """
       CREATE TABLE test_drop_1 (a int);