org.apache.hadoop.hive.metastore.api.Table.unsetCatName()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中org.apache.hadoop.hive.metastore.api.Table.unsetCatName()方法的一些代码示例,展示了Table.unsetCatName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.unsetCatName()方法的具体详情如下:
包路径:org.apache.hadoop.hive.metastore.api.Table
类名称:Table
方法名:unsetCatName

Table.unsetCatName介绍

暂无

代码示例

代码示例来源:origin: apache/hive

  1. @Test
  2. public void getTableMeta() throws TException {
  3. String dbName = "db9";
  4. // For this one don't specify a location to make sure it gets put in the catalog directory
  5. Database db = new DatabaseBuilder()
  6. .setName(dbName)
  7. .build(conf);
  8. db.unsetCatalogName();
  9. client.createDatabase(db);
  10. String[] tableNames = {"table_in_other_catalog_1", "table_in_other_catalog_2", "random_name"};
  11. List<TableMeta> expected = new ArrayList<>(tableNames.length);
  12. for (int i = 0; i < tableNames.length; i++) {
  13. Table table = new TableBuilder()
  14. .inDb(db)
  15. .setTableName(tableNames[i])
  16. .addCol("id", "int")
  17. .addCol("name", "string")
  18. .build(conf);
  19. table.unsetCatName();
  20. client.createTable(table);
  21. TableMeta tableMeta = new TableMeta(dbName, tableNames[i], TableType.MANAGED_TABLE.name());
  22. tableMeta.setCatName(expectedCatalog());
  23. expected.add(tableMeta);
  24. }
  25. List<String> types = Collections.singletonList(TableType.MANAGED_TABLE.name());
  26. List<TableMeta> actual = client.getTableMeta(dbName, "*", types);
  27. Assert.assertEquals(new TreeSet<>(expected), new TreeSet<>(actual));
  28. actual = client.getTableMeta("*", "table_*", types);
  29. Assert.assertEquals(expected.subList(0, 2), actual.subList(0, 2));
  30. }

代码示例来源:origin: apache/hive

  1. t.unsetCatName();
  2. client.createTable(t);

代码示例来源:origin: apache/hive

  1. .addTableParam("PARTITION_LEVEL_PRIVILEGE", "true")
  2. .build(conf);
  3. table.unsetCatName();
  4. client.createTable(table);

代码示例来源:origin: apache/hive

  1. @Test
  2. public void tablesGetExists() throws TException {
  3. String dbName = "db_in_other_catalog";
  4. // For this one don't specify a location to make sure it gets put in the catalog directory
  5. Database db = new DatabaseBuilder()
  6. .setName(dbName)
  7. .build(conf);
  8. db.unsetCatalogName();
  9. client.createDatabase(db);
  10. String[] tableNames = new String[4];
  11. for (int i = 0; i < tableNames.length; i++) {
  12. tableNames[i] = "table_in_other_catalog_" + i;
  13. Table table = new TableBuilder()
  14. .inDb(db)
  15. .setTableName(tableNames[i])
  16. .addCol("col1_" + i, ColumnType.STRING_TYPE_NAME)
  17. .addCol("col2_" + i, ColumnType.INT_TYPE_NAME)
  18. .build(conf);
  19. table.unsetCatName();
  20. client.createTable(table);
  21. }
  22. Set<String> tables = new HashSet<>(client.getTables(dbName, "*e_in_other_*"));
  23. Assert.assertEquals(4, tables.size());
  24. for (String tableName : tableNames) Assert.assertTrue(tables.contains(tableName));
  25. List<String> fetchedNames = client.getTables(dbName, "*_3");
  26. Assert.assertEquals(1, fetchedNames.size());
  27. Assert.assertEquals(tableNames[3], fetchedNames.get(0));
  28. Assert.assertTrue("Table exists", client.tableExists(dbName, tableNames[0]));
  29. Assert.assertFalse("Table not exists", client.tableExists(dbName, "non_existing_table"));
  30. }

代码示例来源:origin: apache/hive

  1. .addPartCol("partcol", "string")
  2. .build(conf);
  3. table.unsetCatName();
  4. client.createTable(table);

代码示例来源:origin: apache/hive

  1. @Test
  2. public void tablesList() throws TException {
  3. String dbName = "db_in_other_catalog";
  4. // For this one don't specify a location to make sure it gets put in the catalog directory
  5. Database db = new DatabaseBuilder()
  6. .setName(dbName)
  7. .build(conf);
  8. db.unsetCatalogName();
  9. client.createDatabase(db);
  10. String[] tableNames = new String[4];
  11. for (int i = 0; i < tableNames.length; i++) {
  12. tableNames[i] = "table_in_other_catalog_" + i;
  13. TableBuilder builder = new TableBuilder()
  14. .inDb(db)
  15. .setTableName(tableNames[i])
  16. .addCol("col1_" + i, ColumnType.STRING_TYPE_NAME)
  17. .addCol("col2_" + i, ColumnType.INT_TYPE_NAME);
  18. if (i == 0) builder.addTableParam("the_key", "the_value");
  19. Table table = builder.build(conf);
  20. table.unsetCatName();
  21. client.createTable(table);
  22. }
  23. String filter = hive_metastoreConstants.HIVE_FILTER_FIELD_PARAMS + "the_key=\"the_value\"";
  24. List<String> fetchedNames = client.listTableNamesByFilter(dbName, filter, (short)-1);
  25. Assert.assertEquals(1, fetchedNames.size());
  26. Assert.assertEquals(tableNames[0], fetchedNames.get(0));
  27. }

代码示例来源:origin: apache/hive

  1. .addPartCol("partcol", "string")
  2. .build(conf);
  3. table.unsetCatName();
  4. client.createTable(table);

代码示例来源:origin: apache/hive

  1. .addPartCol("partcol", "string")
  2. .build(conf);
  3. table.unsetCatName();
  4. client.createTable(table);

代码示例来源:origin: apache/hive

  1. .addCol("col6", "int")
  2. .build(conf);
  3. table.unsetCatName();

代码示例来源:origin: apache/hive

  1. .addPartCol("partcol", "string")
  2. .build(conf);
  3. table.unsetCatName();
  4. client.createTable(table);

代码示例来源:origin: apache/hive

  1. unsetCatName();
  2. } else {
  3. setCatName((String)value);

代码示例来源:origin: apache/hive

  1. t.unsetCatName();
  2. client.createTable(t);

代码示例来源:origin: org.apache.hive/hive-standalone-metastore

  1. unsetCatName();
  2. } else {
  3. setCatName((String)value);

相关文章

Table类方法