@@ -658,7 +658,7 @@ class TableCatalogSuite extends SparkFunSuite {
658658
659659 test(" listNamespaces: list namespaces from metadata" ) {
660660 val catalog = newCatalog()
661- catalog.createNamespaceMetadata (Array (" ns1" ), Map (" property" -> " value" ).asJava)
661+ catalog.createNamespace (Array (" ns1" ), Map (" property" -> " value" ).asJava)
662662
663663 assert(catalog.listNamespaces === Array (Array (" ns1" )))
664664 assert(catalog.listNamespaces(Array ()) === Array (Array (" ns1" )))
@@ -684,7 +684,7 @@ class TableCatalogSuite extends SparkFunSuite {
684684 val ident1 = Identifier .of(Array (" ns1" , " ns2" ), " test_table_1" )
685685 val ident2 = Identifier .of(Array (" ns1" , " ns2" ), " test_table_2" )
686686
687- catalog.createNamespaceMetadata (Array (" ns1" ), Map (" property" -> " value" ).asJava)
687+ catalog.createNamespace (Array (" ns1" ), Map (" property" -> " value" ).asJava)
688688 catalog.createTable(ident1, schema, Array .empty, emptyProps)
689689 catalog.createTable(ident2, schema, Array .empty, emptyProps)
690690
@@ -717,7 +717,7 @@ class TableCatalogSuite extends SparkFunSuite {
717717 test(" loadNamespaceMetadata: metadata exists, no tables" ) {
718718 val catalog = newCatalog()
719719
720- catalog.createNamespaceMetadata (testNs, Map (" property" -> " value" ).asJava)
720+ catalog.createNamespace (testNs, Map (" property" -> " value" ).asJava)
721721
722722 val metadata = catalog.loadNamespaceMetadata(testNs)
723723
@@ -727,49 +727,52 @@ class TableCatalogSuite extends SparkFunSuite {
727727 test(" loadNamespaceMetadata: metadata and table exist" ) {
728728 val catalog = newCatalog()
729729
730+ catalog.createNamespace(testNs, Map (" property" -> " value" ).asJava)
730731 catalog.createTable(testIdent, schema, Array .empty, emptyProps)
731- catalog.createNamespaceMetadata(testNs, Map (" property" -> " value" ).asJava)
732732
733733 val metadata = catalog.loadNamespaceMetadata(testNs)
734734
735735 assert(metadata.asScala === Map (" property" -> " value" ))
736736 }
737737
738- test(" createNamespaceMetadata : basic behavior" ) {
738+ test(" createNamespace : basic behavior" ) {
739739 val catalog = newCatalog()
740740
741- catalog.createNamespaceMetadata (testNs, Map (" property" -> " value" ).asJava)
741+ catalog.createNamespace (testNs, Map (" property" -> " value" ).asJava)
742742
743743 assert(catalog.namespaceExists(testNs) === true )
744744 assert(catalog.loadNamespaceMetadata(testNs).asScala === Map (" property" -> " value" ))
745745 }
746746
747- test(" createNamespaceMetadata : fail if metadata already exists" ) {
747+ test(" createNamespace : fail if metadata already exists" ) {
748748 val catalog = newCatalog()
749749
750- catalog.createNamespaceMetadata (testNs, Map (" property" -> " value" ).asJava)
750+ catalog.createNamespace (testNs, Map (" property" -> " value" ).asJava)
751751
752752 val exc = intercept[NamespaceAlreadyExistsException ] {
753- catalog.createNamespaceMetadata (testNs, Map (" property" -> " value" ).asJava)
753+ catalog.createNamespace (testNs, Map (" property" -> " value" ).asJava)
754754 }
755755
756756 assert(exc.getMessage.contains(testNs.quoted))
757757 assert(catalog.namespaceExists(testNs) === true )
758758 assert(catalog.loadNamespaceMetadata(testNs).asScala === Map (" property" -> " value" ))
759759 }
760760
761- test(" createNamespaceMetadata: table exists" ) {
761+ test(" createNamespace: fail if namespace already exists from table " ) {
762762 val catalog = newCatalog()
763763
764764 catalog.createTable(testIdent, schema, Array .empty, emptyProps)
765765
766766 assert(catalog.namespaceExists(testNs) === true )
767767 assert(catalog.loadNamespaceMetadata(testNs).asScala === Map .empty)
768768
769- catalog.createNamespaceMetadata(testNs, Map (" property" -> " value" ).asJava)
769+ val exc = intercept[NamespaceAlreadyExistsException ] {
770+ catalog.createNamespace(testNs, Map (" property" -> " value" ).asJava)
771+ }
770772
773+ assert(exc.getMessage.contains(testNs.quoted))
771774 assert(catalog.namespaceExists(testNs) === true )
772- assert(catalog.loadNamespaceMetadata(testNs).asScala === Map ( " property " -> " value " ) )
775+ assert(catalog.loadNamespaceMetadata(testNs).asScala === Map .empty )
773776 }
774777
775778 test(" dropNamespace: drop missing namespace" ) {
@@ -785,7 +788,7 @@ class TableCatalogSuite extends SparkFunSuite {
785788 test(" dropNamespace: drop empty namespace" ) {
786789 val catalog = newCatalog()
787790
788- catalog.createNamespaceMetadata (testNs, Map (" property" -> " value" ).asJava)
791+ catalog.createNamespace (testNs, Map (" property" -> " value" ).asJava)
789792
790793 assert(catalog.namespaceExists(testNs) === true )
791794 assert(catalog.loadNamespaceMetadata(testNs).asScala === Map (" property" -> " value" ))
@@ -799,8 +802,8 @@ class TableCatalogSuite extends SparkFunSuite {
799802 test(" dropNamespace: fail if not empty" ) {
800803 val catalog = newCatalog()
801804
805+ catalog.createNamespace(testNs, Map (" property" -> " value" ).asJava)
802806 catalog.createTable(testIdent, schema, Array .empty, emptyProps)
803- catalog.createNamespaceMetadata(testNs, Map (" property" -> " value" ).asJava)
804807
805808 val exc = intercept[IllegalStateException ] {
806809 catalog.dropNamespace(testNs)
@@ -814,7 +817,7 @@ class TableCatalogSuite extends SparkFunSuite {
814817 test(" alterNamespace: basic behavior" ) {
815818 val catalog = newCatalog()
816819
817- catalog.createNamespaceMetadata (testNs, Map (" property" -> " value" ).asJava)
820+ catalog.createNamespace (testNs, Map (" property" -> " value" ).asJava)
818821
819822 catalog.alterNamespace(testNs, NamespaceChange .setProperty(" property2" , " value2" ))
820823 assert(catalog.loadNamespaceMetadata(testNs).asScala === Map (
0 commit comments