outStream.write(tbl.getTTable().toString().getBytes("UTF-8")); outStream.write(separator); outStream.write(terminator);
LOG.info("Exporting the metadata of table " + tbl.toString() + " to path " + metaPath.toString()); try {
String tableDesc = HiveStringUtils.escapeJava(tbl.getTTable().toString()); outStream.write(tableDesc.getBytes("UTF-8")); outStream.write(separator);
LOG.info("Exporting the metadata of table " + tbl.toString() + " to path " + metaPath.toString()); try {
@Override public void create_table_with_environment_context(final Table tbl, final EnvironmentContext envContext) throws AlreadyExistsException, MetaException, InvalidObjectException, InvalidInputException { startFunction("create_table", ": " + tbl.toString()); boolean success = false; Exception ex = null; try { create_table_core(getMS(), tbl, envContext); success = true; } catch (NoSuchObjectException e) { LOG.warn("create_table_with_environment_context got ", e); ex = e; throw new InvalidObjectException(e.getMessage()); } catch (MetaException | InvalidObjectException | AlreadyExistsException | InvalidInputException e) { ex = e; throw e; } catch (Exception e) { ex = e; throw newMetaException(e); } finally { endFunction("create_table", success, ex, tbl.getTableName()); } }
@Override public void create_table_with_constraints(final Table tbl, final List<SQLPrimaryKey> primaryKeys, final List<SQLForeignKey> foreignKeys, List<SQLUniqueConstraint> uniqueConstraints, List<SQLNotNullConstraint> notNullConstraints, List<SQLDefaultConstraint> defaultConstraints, List<SQLCheckConstraint> checkConstraints) throws AlreadyExistsException, MetaException, InvalidObjectException, InvalidInputException { startFunction("create_table", ": " + tbl.toString()); boolean success = false; Exception ex = null; try { create_table_core(getMS(), tbl, null, primaryKeys, foreignKeys, uniqueConstraints, notNullConstraints, defaultConstraints, checkConstraints); success = true; } catch (NoSuchObjectException e) { ex = e; throw new InvalidObjectException(e.getMessage()); } catch (MetaException | InvalidObjectException | AlreadyExistsException | InvalidInputException e) { ex = e; throw e; } catch (Exception e) { ex = e; throw newMetaException(e); } finally { endFunction("create_table", success, ex, tbl.getTableName()); } }
runStatementOnDriver(String.format("import table %s from '%s'", importName, exportPath)); org.apache.hadoop.hive.metastore.api.Table imported = msClient.getTable("default", importName); Assert.assertEquals(imported.toString(), "insert_only", imported.getParameters().get("transactional_properties")); Path importPath = new Path(imported.getSd().getLocation()); runStatementOnDriver(String.format("import table %s from '%s'", importName, exportPath)); imported = msClient.getTable("default", importName); Assert.assertNull(imported.toString(), imported.getParameters().get("transactional")); Assert.assertNull(imported.toString(), imported.getParameters().get("transactional_properties")); importPath = new Path(imported.getSd().getLocation());
outStream.write(tbl.getTTable().toString().getBytes("UTF-8")); outStream.write(separator); outStream.write(terminator);
LOG.info("Exporting the metadata of table " + tbl.toString() + " to path " + metaPath.toString()); try {
outStream.writeBytes(tbl.getTTable().toString()); outStream.write(separator); outStream.write(terminator);
@Override public void create_table_with_environment_context(final Table tbl, final EnvironmentContext envContext) throws AlreadyExistsException, MetaException, InvalidObjectException { startFunction("create_table", ": " + tbl.toString()); boolean success = false; Exception ex = null; try { create_table_core(getMS(), tbl, envContext); success = true; } catch (NoSuchObjectException e) { LOG.warn("create_table_with_environment_context got ", e); ex = e; throw new InvalidObjectException(e.getMessage()); } catch (Exception e) { ex = e; if (e instanceof MetaException) { throw (MetaException) e; } else if (e instanceof InvalidObjectException) { throw (InvalidObjectException) e; } else if (e instanceof AlreadyExistsException) { throw (AlreadyExistsException) e; } else { throw newMetaException(e); } } finally { endFunction("create_table", success, ex, tbl.getTableName()); } }
@Override public Index add_index(final Index newIndex, final Table indexTable) throws InvalidObjectException, AlreadyExistsException, MetaException, TException { startFunction("add_index", ": " + newIndex.toString() + " " + indexTable.toString()); Index ret = null; Exception ex = null; try { ret = add_index_core(getMS(), newIndex, indexTable); } catch (Exception e) { ex = e; if (e instanceof InvalidObjectException) { throw (InvalidObjectException) e; } else if (e instanceof AlreadyExistsException) { throw (AlreadyExistsException) e; } else if (e instanceof MetaException) { throw (MetaException) e; } else if (e instanceof TException) { throw (TException) e; } else { MetaException me = new MetaException(e.toString()); me.initCause(e); throw me; } } finally { String tableName = indexTable != null ? indexTable.getTableName() : null; endFunction("add_index", ret != null, ex, tableName); } return ret; }
@Override public void create_table_with_environment_context(final Table tbl, final EnvironmentContext envContext) throws AlreadyExistsException, MetaException, InvalidObjectException { startFunction("create_table", ": " + tbl.toString()); boolean success = false; Exception ex = null; try { create_table_core(getMS(), tbl, envContext); success = true; } catch (NoSuchObjectException e) { ex = e; throw new InvalidObjectException(e.getMessage()); } catch (Exception e) { ex = e; if (e instanceof MetaException) { throw (MetaException) e; } else if (e instanceof InvalidObjectException) { throw (InvalidObjectException) e; } else if (e instanceof AlreadyExistsException) { throw (AlreadyExistsException) e; } else { MetaException me = new MetaException(e.toString()); me.initCause(e); throw me; } } finally { endFunction("create_table", success, ex, tbl.getTableName()); } }
@Override public Index add_index(final Index newIndex, final Table indexTable) throws InvalidObjectException, AlreadyExistsException, MetaException, TException { startFunction("add_index", ": " + newIndex.toString() + " " + indexTable.toString()); Index ret = null; Exception ex = null; try { ret = add_index_core(getMS(), newIndex, indexTable); } catch (Exception e) { ex = e; if (e instanceof InvalidObjectException) { throw (InvalidObjectException) e; } else if (e instanceof AlreadyExistsException) { throw (AlreadyExistsException) e; } else if (e instanceof MetaException) { throw (MetaException) e; } else if (e instanceof TException) { throw (TException) e; } else { throw newMetaException(e); } } finally { String tableName = indexTable != null ? indexTable.getTableName() : null; endFunction("add_index", ret != null, ex, tableName); } return ret; }
@Override public Index add_index(final Index newIndex, final Table indexTable) throws InvalidObjectException, AlreadyExistsException, MetaException, TException { startFunction("add_index", ": " + newIndex.toString() + " " + indexTable.toString()); Index ret = null; Exception ex = null; try { ret = add_index_core(getMS(), newIndex, indexTable); } catch (Exception e) { ex = e; if (e instanceof InvalidObjectException) { throw (InvalidObjectException) e; } else if (e instanceof AlreadyExistsException) { throw (AlreadyExistsException) e; } else if (e instanceof MetaException) { throw (MetaException) e; } else if (e instanceof TException) { throw (TException) e; } else { throw newMetaException(e); } } finally { String tableName = indexTable != null ? indexTable.getTableName() : null; endFunction("add_index", ret != null, ex, tableName); } return ret; }
@Override public void create_table_with_environment_context(final Table tbl, final EnvironmentContext envContext) throws AlreadyExistsException, MetaException, InvalidObjectException { startFunction("create_table", ": " + tbl.toString()); boolean success = false; Exception ex = null; try { create_table_core(getMS(), tbl, envContext); success = true; } catch (NoSuchObjectException e) { ex = e; throw new InvalidObjectException(e.getMessage()); } catch (Exception e) { ex = e; if (e instanceof MetaException) { throw (MetaException) e; } else if (e instanceof InvalidObjectException) { throw (InvalidObjectException) e; } else if (e instanceof AlreadyExistsException) { throw (AlreadyExistsException) e; } else { throw newMetaException(e); } } finally { endFunction("create_table", success, ex, tbl.getTableName()); } }
@Override public void create_table_with_environment_context(final Table tbl, final EnvironmentContext envContext) throws AlreadyExistsException, MetaException, InvalidObjectException { startFunction("create_table", ": " + tbl.toString()); boolean success = false; Exception ex = null; try { create_table_core(getMS(), tbl, envContext); success = true; } catch (NoSuchObjectException e) { ex = e; throw new InvalidObjectException(e.getMessage()); } catch (Exception e) { ex = e; if (e instanceof MetaException) { throw (MetaException) e; } else if (e instanceof InvalidObjectException) { throw (InvalidObjectException) e; } else if (e instanceof AlreadyExistsException) { throw (AlreadyExistsException) e; } else { throw newMetaException(e); } } finally { endFunction("create_table", success, ex, tbl.getTableName()); } }
List<SQLCheckConstraint> checkConstraints) throws AlreadyExistsException, MetaException, InvalidObjectException { startFunction("create_table", ": " + tbl.toString()); boolean success = false; Exception ex = null;