Răsfoiți Sursa

[beeswax] Add a test case for ',' and ':' in a partition key comments

Erick Tryzelaar 11 ani în urmă
părinte
comite
964c5a321a
1 a modificat fișierele cu 14 adăugiri și 1 ștergeri
  1. 14 1
      apps/beeswax/src/beeswax/tests.py

+ 14 - 1
apps/beeswax/src/beeswax/tests.py

@@ -60,7 +60,7 @@ from beeswax.models import SavedQuery, QueryHistory, HQL, HIVE_SERVER2
 from beeswax.server import dbms
 from beeswax.server import dbms
 from beeswax.server.dbms import QueryServerException
 from beeswax.server.dbms import QueryServerException
 from beeswax.server.hive_server2_lib import HiveServerClient,\
 from beeswax.server.hive_server2_lib import HiveServerClient,\
-  PartitionValueCompatible, HiveServerTable
+  PartitionKeyCompatible, PartitionValueCompatible, HiveServerTable
 from beeswax.test_base import BeeswaxSampleProvider
 from beeswax.test_base import BeeswaxSampleProvider
 from beeswax.hive_site import get_metastore
 from beeswax.hive_site import get_metastore
 
 
@@ -1789,6 +1789,19 @@ class MockHiveServerTable(HiveServerTable):
 
 
 class TestHiveServer2API():
 class TestHiveServer2API():
 
 
+  def test_partition_keys(self):
+    table = MockHiveServerTable({'path_location': '/my/table'})
+
+    key = PartitionKeyCompatible('name:a_name, type:int, comment:null')
+    assert_equal('a_name', key.name)
+    assert_equal('int', key.type)
+    assert_equal('null', key.comment)
+
+    key = PartitionKeyCompatible('name:a_name, type:int, comment:this, has extra: sigils')
+    assert_equal('a_name', key.name)
+    assert_equal('int', key.type)
+    assert_equal('this, has extra: sigils', key.comment)
+
   def test_partition_values(self):
   def test_partition_values(self):
     table = MockHiveServerTable({'path_location': '/my/table'})
     table = MockHiveServerTable({'path_location': '/my/table'})