HCatCreateDBDesc dbDesc = HCatCreateDBDesc.create(dbName)
.ifNotExists(true).build();
client.createDatabase(dbDesc);
ArrayList<HCatFieldSchema> cols = new ArrayList<HCatFieldSchema>();
cols.add(new HCatFieldSchema("userid", Type.INT, "id columns"));
cols.add(new HCatFieldSchema("viewtime", Type.BIGINT,
"view time columns"));
cols.add(new HCatFieldSchema("pageurl", Type.STRING, ""));
cols.add(new HCatFieldSchema("ip", Type.STRING,
"IP Address of the User"));
ArrayList<HCatFieldSchema> ptnCols = new ArrayList<HCatFieldSchema>();
ptnCols.add(new HCatFieldSchema("dt", Type.STRING, "date column"));
ptnCols.add(new HCatFieldSchema("country", Type.STRING,
"country column"));
HCatCreateTableDesc tableDesc = HCatCreateTableDesc
.create(dbName, tableName, cols).fileFormat("sequencefile")
.partCols(ptnCols).build();
client.createTable(tableDesc);