0
我现在开发的系统的任务是从卡夫卡使用数据并将其放入配置单元中。由于该表具有“日”分区,所以该分区在hdfs上的位置将为/root/tableLocation/day=20161110/adfadfaaf.avro
。我可以使用java api修改Hive分区位置吗?
但是,这个位置不能满足我的requirement.I要将此位置更改为/root/tableLocation/20161110/adfadfaaf.avro .
我使用的API就是Apache蜂巢metastore.Demo代码时,我创建表是这样的:
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());
从代码中我可以设置表的位置, 但我的问题是,有没有办法设置分区的位置?
我认为不,因为这个信息应该是元数据的一部分... –