@Test public void testOutputWithPartitions() throws Exception { hiveServer.createTable("CREATE TABLE " + hiveTableDesc.getTableName() + " (i1 INT, d1 DOUBLE) " + " PARTITIONED BY (ds STRING) " + " ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'"); HiveOutputDescription outputDesc = new HiveOutputDescription(); outputDesc.putPartitionValue("ds", "foobar"); outputDesc.setTableDesc(hiveTableDesc); HiveTableSchema schema = HiveTableSchemas.lookup(hiveServer.getClient(), null, hiveTableDesc); writeData(outputDesc, schema); HiveInputDescription inputDesc = new HiveInputDescription(); inputDesc.setPartitionFilter("ds='foobar'"); inputDesc.setTableDesc(hiveTableDesc); verifyData(inputDesc); }
@Test public void testOutputWithPartitions() throws Exception { hiveServer.createTable("CREATE TABLE " + hiveTableDesc.getTableName() + " (i1 INT, d1 DOUBLE) " + " PARTITIONED BY (ds STRING) " + " ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'"); HiveOutputDescription outputDesc = new HiveOutputDescription(); outputDesc.putPartitionValue("ds", "foobar"); outputDesc.setTableDesc(hiveTableDesc); HiveTableSchema schema = HiveTableSchemas.lookup(hiveServer.getClient(), null, hiveTableDesc); writeData(outputDesc, schema); HiveInputDescription inputDesc = new HiveInputDescription(); inputDesc.setPartitionFilter("ds='foobar'"); inputDesc.setTableDesc(hiveTableDesc); verifyData(inputDesc); }
outputDesc.getMetastoreDesc().setPort(args.metastore.port); if (args.table.partitioned) { outputDesc.putPartitionValue("ds", "2013-04-01");