void updateTableLocation(Table table, Path newLocation) throws HiveException { String msg = String.format("ALTER TABLE %s SET LOCATION '%s'", getQualifiedName(table), newLocation); LOG.info(msg); boolean isTxn = TxnUtils.isTransactionalTable(table); org.apache.hadoop.hive.ql.metadata.Table modifiedTable = new org.apache.hadoop.hive.ql.metadata.Table(table); modifiedTable.setDataLocation(newLocation); alterTableInternal(isTxn, table, modifiedTable); }
private Table getTargetTable(Table originTable, Path targetLocation) throws IOException { try { Table targetTable = originTable.copy(); targetTable.setDbName(this.targetDatabase); targetTable.setDataLocation(targetLocation); /* * Need to set the table owner as the flow executor */ targetTable.setOwner(UserGroupInformation.getCurrentUser().getShortUserName()); targetTable.getTTable().putToParameters(HiveDataset.REGISTERER, GOBBLIN_DISTCP); targetTable.getTTable().putToParameters(HiveDataset.REGISTRATION_GENERATION_TIME_MILLIS, Long.toString(this.startTime)); targetTable.getTTable().unsetCreateTime(); HiveAvroCopyEntityHelper.updateTableAttributesIfAvro(targetTable, this); return targetTable; } catch (HiveException he) { throw new IOException(he); } }
fields.add(new FieldSchema("val", "int", null)); table.setFields(fields); table.setDataLocation(Warehouse.getDnsPath(new Path(SessionState.get().getTempTableSpace(), tableName), conf)); table.getTTable().setTemporary(true);
fields.add(new FieldSchema("val", "int", null)); table.setFields(fields); table.setDataLocation(Warehouse.getDnsPath(new Path(SessionState.get().getTempTableSpace(), tableName), conf)); table.getTTable().setTemporary(true);
Table table = context.getHive().newTable(desc.getTableName()); if (desc.getLocation() != null) { table.setDataLocation(new Path(desc.getLocation()));
tempTableObj.setDataLocation(new Path(fromURI)); if (inputFormatClassName != null && serDeClassName != null) { try {
table.setSerializationLib(format.getSerde()); table.setFields(fields); table.setDataLocation(tablePath); table.getTTable().setTemporary(true); table.setStoredAsSubDirectories(false);
tbl.setDataLocation(new Path(crtTbl.getLocation())); } else { tbl.unsetDataLocation();
tbl.setDataLocation(new Path(crtTbl.getLocation())); } else { tbl.unsetDataLocation();
tbl.setDataLocation(new Path(getLocation()));
tbl.setDataLocation(new Path(getLocation()));
tbl.setDataLocation(new Path(getLocation()));
table.setDataLocation(null); if(!externalTableOnSource) { replicationSpec().setMigratingToExternalTable();
tbl.setDataLocation(ft.getDataLocation()); tbl.setCreateTime(ft.getTTable().getCreateTime()); tbl.getParameters().put(hive_metastoreConstants.DDL_TIME,
tbl.setDataLocation(new Path(crtView.getLocation()));
private Table getTargetTable(Table originTable, Path targetLocation) throws IOException { try { Table targetTable = originTable.copy(); targetTable.setDbName(this.targetDatabase); targetTable.setDataLocation(targetLocation); /* * Need to set the table owner as the flow executor */ targetTable.setOwner(UserGroupInformation.getCurrentUser().getShortUserName()); targetTable.getTTable().putToParameters(HiveDataset.REGISTERER, GOBBLIN_DISTCP); targetTable.getTTable().putToParameters(HiveDataset.REGISTRATION_GENERATION_TIME_MILLIS, Long.toString(this.startTime)); targetTable.getTTable().unsetCreateTime(); HiveAvroCopyEntityHelper.updateTableAttributesIfAvro(targetTable, this); return targetTable; } catch (HiveException he) { throw new IOException(he); } }
private Table getTargetTable(Table originTable, Path targetLocation) throws IOException { try { Table targetTable = originTable.copy(); targetTable.setDbName(this.targetDatabase); targetTable.setDataLocation(targetLocation); /* * Need to set the table owner as the flow executor */ targetTable.setOwner(UserGroupInformation.getCurrentUser().getShortUserName()); targetTable.getTTable().putToParameters(HiveDataset.REGISTERER, GOBBLIN_DISTCP); targetTable.getTTable().putToParameters(HiveDataset.REGISTRATION_GENERATION_TIME_MILLIS, Long.toString(this.startTime)); targetTable.getTTable().unsetCreateTime(); HiveAvroCopyEntityHelper.updateTableAttributesIfAvro(targetTable, this); return targetTable; } catch (HiveException he) { throw new IOException(he); } }
private Table constructAvroTable(String database, String tableName, Schema schema, Partitioner partitioner) throws HiveMetaStoreException { Table table = new Table(database, tableName); table.setTableType(TableType.EXTERNAL_TABLE); table.getParameters().put("EXTERNAL", "TRUE"); String tablePath = FileUtils.hiveDirectoryName(url, topicsDir, tableName); table.setDataLocation(new Path(tablePath)); table.setSerializationLib(avroSerde); try { table.setInputFormatClass(avroInputFormat); table.setOutputFormatClass(avroOutputFormat); } catch (HiveException e) { throw new HiveMetaStoreException("Cannot find input/output format:", e); } List<FieldSchema> columns = HiveSchemaConverter.convertSchema(schema); table.setFields(columns); table.setPartCols(partitioner.partitionFields()); table.getParameters().put(AVRO_SCHEMA_LITERAL, avroData.fromConnectSchema(schema).toString()); return table; } }
private Table constructParquetTable(String database, String tableName, Schema schema, Partitioner partitioner) throws HiveMetaStoreException { Table table = new Table(database, tableName); table.setTableType(TableType.EXTERNAL_TABLE); table.getParameters().put("EXTERNAL", "TRUE"); String tablePath = FileUtils.hiveDirectoryName(url, topicsDir, tableName); table.setDataLocation(new Path(tablePath)); table.setSerializationLib(getHiveParquetSerde()); try { table.setInputFormatClass(getHiveParquetInputFormat()); table.setOutputFormatClass(getHiveParquetOutputFormat()); } catch (HiveException e) { throw new HiveMetaStoreException("Cannot find input/output format:", e); } // convert copycat schema schema to Hive columns List<FieldSchema> columns = HiveSchemaConverter.convertSchema(schema); table.setFields(columns); table.setPartCols(partitioner.partitionFields()); return table; }
tbl.setDataLocation(new Path(crtTbl.getLocation()).toUri()); } else { tbl.unsetDataLocation();