コード例 #1
0
    def test_alter_partition(self):
        self.catalog.create_database(self.db1, self.create_db(), False)
        self.catalog.create_table(self.path1, self.create_partitioned_table(),
                                  False)
        self.catalog.create_partition(self.path1, self.create_partition_spec(),
                                      self.create_partition(), False)

        cp = self.catalog.get_partition(self.path1,
                                        self.create_partition_spec())
        self.check_catalog_partition_equals(self.create_partition(), cp)
        self.assertIsNone(cp.get_properties().get("k"))

        gateway = get_gateway()
        j_partition = gateway.jvm.GenericCatalogPartition(
            {
                "is_streaming": "false",
                "k": "v"
            }, "Generic batch table")
        another = CatalogPartition(j_partition)
        self.catalog.alter_partition(self.path1, self.create_partition_spec(),
                                     another, False)

        cp = self.catalog.get_partition(self.path1,
                                        self.create_partition_spec())
        self.check_catalog_partition_equals(another, cp)
        self.assertEqual("v", cp.get_properties().get("k"))
コード例 #2
0
ファイル: test_catalog.py プロジェクト: zhuzhengjun01/flink
    def test_alter_partition(self):
        self.catalog.create_database(self.db1, self.create_db(), False)
        self.catalog.create_table(self.path1, self.create_partitioned_table(), False)
        self.catalog.create_partition(self.path1, self.create_partition_spec(),
                                      self.create_partition(), False)

        cp = self.catalog.get_partition(self.path1, self.create_partition_spec())
        self.check_catalog_partition_equals(self.create_partition(), cp)
        self.assertIsNone(cp.get_properties().get("k"))

        another = CatalogPartition.create_instance(
            {"is_streaming": "false", "k": "v"}, "catalog partition")
        self.catalog.alter_partition(self.path1, self.create_partition_spec(), another, False)

        cp = self.catalog.get_partition(self.path1, self.create_partition_spec())
        self.check_catalog_partition_equals(another, cp)
        self.assertEqual("v", cp.get_properties().get("k"))
コード例 #3
0
 def create_partition():
     gateway = get_gateway()
     j_partition = gateway.jvm.GenericCatalogPartition(
         CatalogTestBase.get_batch_table_properties(),
         "Generic batch table")
     return CatalogPartition(j_partition)
コード例 #4
0
 def create_partition():
     gateway = get_gateway()
     j_partition = gateway.jvm.CatalogPartitionImpl(
         CatalogTestBase.get_batch_table_properties(),
         "catalog partition tests")
     return CatalogPartition(j_partition)
コード例 #5
0
 def create_partition():
     return CatalogPartition.create_instance(
         CatalogTestBase.get_batch_table_properties(),
         "catalog partition tests")