@Test public void testNamespaceExists() throws IOException { Configuration conf = new Configuration(); String warehousePath = temp.newFolder().getAbsolutePath(); HadoopCatalog catalog = new HadoopCatalog(conf, warehousePath); TableIdentifier tbl1 = TableIdentifier.of("db", "ns1", "ns2", "metadata"); TableIdentifier tbl2 = TableIdentifier.of("db", "ns2", "ns3", "tbl2"); TableIdentifier tbl3 = TableIdentifier.of("db", "ns3", "tbl4"); TableIdentifier tbl4 = TableIdentifier.of("db", "metadata"); Lists.newArrayList(tbl1, tbl2, tbl3, tbl4).forEach(t -> catalog.createTable(t, SCHEMA, PartitionSpec.unpartitioned()) ); Assert.assertTrue("Should true to namespace exist", catalog.namespaceExists(Namespace.of("db", "ns1", "ns2"))); Assert.assertTrue("Should false to namespace doesn't exist", !catalog.namespaceExists(Namespace.of("db", "db2", "ns2"))); }
@Override public Table createTable( TableIdentifier identifier, Schema schema, PartitionSpec spec, String location, Map<String, String> properties) { Preconditions.checkArgument(location == null, "Cannot set a custom location for a path-based table"); return super.createTable(identifier, schema, spec, null, properties); }
HadoopCatalog extends BaseMetastoreCatalog implements Closeable, SupportsNamespaces { @Override public Table createTable( TableIdentifier identifier, Schema schema, PartitionSpec spec, String location, Map<String, String> properties) { Preconditions.checkArgument(location == null, "Cannot set a custom location for a path-based table"); return super.createTable(identifier, schema, spec, null, properties); } }
HadoopCatalog extends BaseMetastoreCatalog implements Closeable, SupportsNamespaces { @Override public Table createTable( TableIdentifier identifier, Schema schema, PartitionSpec spec, String location, Map<String, String> properties) { Preconditions.checkArgument(location == null, "Cannot set a custom location for a path-based table"); return super.createTable(identifier, schema, spec, null, properties); } HadoopCatalog(String name, Configuration conf, String warehouseLocation);  HadoopCatalog(Configuration conf, String warehouseLocation);  HadoopCatalog(Configuration conf); }
HadoopCatalog extends BaseMetastoreCatalog implements Closeable, SupportsNamespaces { @Override public Table createTable( TableIdentifier identifier, Schema schema, PartitionSpec spec, String location, Map<String, String> properties) { Preconditions.checkArgument(location == null, "Cannot set a custom location for a path-based table"); return super.createTable(identifier, schema, spec, null, properties); } HadoopCatalog(String name, Configuration conf, String warehouseLocation);  HadoopCatalog(Configuration conf, String warehouseLocation);  HadoopCatalog(Configuration conf); @Override List<TableIdentifier> listTables(Namespace namespace); @Override Table createTable(
      TableIdentifier identifier, Schema schema, PartitionSpec spec, String location, Map<String, String> properties); @Override boolean dropTable(TableIdentifier identifier, boolean purge); @Override void renameTable(TableIdentifier from, TableIdentifier to); @Override void createNamespace(Namespace namespace, Map<String, String> meta); @Override List<Namespace> listNamespaces(Namespace namespace); @Override boolean dropNamespace(Namespace namespace); @Override boolean setProperties(Namespace namespace,  Map<String, String> properties); @Override boolean removeProperties(Namespace namespace,  Set<String> properties); @Override Map<String, String> loadNamespaceMetadata(Namespace namespace); @Override void close(); }
HadoopCatalog extends BaseMetastoreCatalog implements Closeable, SupportsNamespaces { @Override public Table createTable( TableIdentifier identifier, Schema schema, PartitionSpec spec, String location, Map<String, String> properties) { Preconditions.checkArgument(location == null, "Cannot set a custom location for a path-based table"); return super.createTable(identifier, schema, spec, null, properties); } HadoopCatalog(String name, Configuration conf, String warehouseLocation);  HadoopCatalog(Configuration conf, String warehouseLocation);  HadoopCatalog(Configuration conf); @Override List<TableIdentifier> listTables(Namespace namespace); @Override Table createTable(
      TableIdentifier identifier, Schema schema, PartitionSpec spec, String location, Map<String, String> properties); @Override boolean dropTable(TableIdentifier identifier, boolean purge); @Override void renameTable(TableIdentifier from, TableIdentifier to); @Override void createNamespace(Namespace namespace, Map<String, String> meta); @Override List<Namespace> listNamespaces(Namespace namespace); @Override boolean dropNamespace(Namespace namespace); @Override boolean setProperties(Namespace namespace,  Map<String, String> properties); @Override boolean removeProperties(Namespace namespace,  Set<String> properties); @Override Map<String, String> loadNamespaceMetadata(Namespace namespace); @Override void close();  }