Job job = new Job(conf);
Properties properties = new Properties();
properties.setProperty(HBaseConstants.PROPERTY_TABLE_SNAPSHOT_KEY, "dummysnapshot");
HCatInputFormat.setInput(job, databaseName, tableName).setProperties(properties);
String modifiedInputInfo = job.getConfiguration().get(HCatConstants.HCAT_KEY_JOB_INFO);
InputJobInfo inputInfo = (InputJobInfo) HCatUtil.deserialize(modifiedInputInfo);
Map<String, Long> revMap = new HashMap<String, Long>();
revMap.put("cf1", 3L);
revMap.put("cf2", 5L);
TableSnapshot hbaseSnapshot = new TableSnapshot(fullyQualTableName, revMap, -1);
HCatTableSnapshot hcatSnapshot = HBaseRevisionManagerUtil.convertSnapshot(hbaseSnapshot, inputInfo.getTableInfo());
assertEquals(hcatSnapshot.getRevision("value1"), 3);
assertEquals(hcatSnapshot.getRevision("value2"), 5);
String dropTable = "DROP TABLE " + fullyQualTableName;
cmdResponse = hcatDriver.run(dropTable);
assertEquals(0, cmdResponse.getResponseCode());
tableName = newTableName("mytableTwo");
fullyQualTableName = databaseName + "." + tableName;
tableQuery = "CREATE TABLE " + fullyQualTableName
+ "(key string, value1 string, value2 string) STORED BY " +
"'org.apache.hcatalog.hbase.HBaseHCatStorageHandler'"
+ "TBLPROPERTIES ('hbase.columns.mapping'=':key,cf1:q1,cf1:q2')";
cmdResponse = hcatDriver.run(tableQuery);
assertEquals(0, cmdResponse.getResponseCode());
revMap.clear();
revMap.put("cf1", 3L);
hbaseSnapshot = new TableSnapshot(fullyQualTableName, revMap, -1);
HCatInputFormat.setInput(job, databaseName, tableName).setProperties(properties);
modifiedInputInfo = job.getConfiguration().get(HCatConstants.HCAT_KEY_JOB_INFO);
inputInfo = (InputJobInfo) HCatUtil.deserialize(modifiedInputInfo);
hcatSnapshot = HBaseRevisionManagerUtil.convertSnapshot(hbaseSnapshot, inputInfo.getTableInfo());
assertEquals(hcatSnapshot.getRevision("value1"), 3);
assertEquals(hcatSnapshot.getRevision("value2"), 3);
dropTable = "DROP TABLE " + fullyQualTableName;
cmdResponse = hcatDriver.run(dropTable);