Can I modify Hive partition location using java api? -
i developping system job consume data kafka , put hive.since table have partition "day" , , location of partition on hdfs /root/tablelocation/day=20161110/adfadfaaf.avro
.
but, location cannot meet requirement.i want change location /root/tablelocation/20161110/adfadfaaf.avro .
the api using apache hive metastore.demo code when create table this:
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());
from code , can set table location , question , there way set partition location?
in hive , hdfs, partitions sub directories under table directory. way hive recognizes partition structure such as, <col name>=<partition value>
if change sub directory name <partition value>
, not recognized hive partition.
Comments
Post a Comment