/** * Gets the tbl props. * * @return the tbl props */ @Deprecated // @deprecated in favour of {@link HCatTable.#getTblProps()}. To be removed in Hive 0.16. public Map<String, String> getTblProps() { return this.hcatTable.getTblProps(); }
/** * Gets the last known replication state of the provided table. This * is applicable only if it is the destination of a replication * and has had data replicated into it via imports previously. * Defaults to 0. */ public static long getLastReplicationId(HCatTable tbl) { Map<String, String> tblProps = tbl.getTblProps(); if (tblProps != null){ if (tblProps.containsKey(REPL_STATE_ID)){ return Long.parseLong(tblProps.get(REPL_STATE_ID)); } } return 0l; // default is to return earliest possible state. }
@Override public String toString() { return "HCatTable [ " + "tableName=" + tableName + ", " + "dbName=" + dbName + ", " + "tableType=" + tableType + ", " + "cols=" + cols + ", " + "partCols=" + partCols + ", " + "bucketCols=" + getBucketCols() + ", " + "numBuckets=" + getNumBuckets() + ", " + "sortCols=" + getSortCols() + ", " + "inputFormat=" + getInputFileFormat() + ", " + "outputFormat=" + getOutputFileFormat() + ", " + "storageHandler=" + getStorageHandler() + ", " + "serde=" + getSerdeLib() + ", " + "tblProps=" + getTblProps() + ", " + "location=" + getLocation() + ", " + "owner=" + owner() + " ]"; }
assertNotNull(importedTable); assertTrue(importedTable.getTblProps().containsKey("repl.last.id"));
/** * This test tests that a plain table instantiation matches what hive says an * empty table create should look like. * @throws Exception */ @Test public void testEmptyTableInstantiation() throws Exception { HCatClient client = HCatClient.create(new Configuration(hcatConf)); String dbName = "default"; String tblName = "testEmptyCreate"; ArrayList<HCatFieldSchema> cols = new ArrayList<HCatFieldSchema>(); cols.add(new HCatFieldSchema("id", Type.INT, "id comment")); cols.add(new HCatFieldSchema("value", Type.STRING, "value comment")); client.dropTable(dbName, tblName, true); // Create a minimalistic table client.createTable(HCatCreateTableDesc .create(new HCatTable(dbName, tblName).cols(cols), false) .build()); HCatTable tCreated = client.getTable(dbName, tblName); org.apache.hadoop.hive.metastore.api.Table emptyTable = Table.getEmptyTable(dbName, tblName); Map<String, String> createdProps = tCreated.getTblProps(); Map<String, String> emptyProps = emptyTable.getParameters(); mapEqualsContainedIn(emptyProps, createdProps); // Test sd params - we check that all the parameters in an empty table // are retained as-is. We may add beyond it, but not change values for // any parameters that hive defines for an empty table. Map<String, String> createdSdParams = tCreated.getSerdeParams(); Map<String, String> emptySdParams = emptyTable.getSd().getSerdeInfo().getParameters(); mapEqualsContainedIn(emptySdParams, createdSdParams); }
assertNotNull(importedTable); assertTrue(importedTable.getTblProps().containsKey("repl.last.id"));
/** * Gets the tbl props. * * @return the tbl props */ @Deprecated // @deprecated in favour of {@link HCatTable.#getTblProps()}. To be removed in Hive 0.16. public Map<String, String> getTblProps() { return this.hcatTable.getTblProps(); }
/** * Gets the tbl props. * * @return the tbl props */ @Deprecated // @deprecated in favour of {@link HCatTable.#getTblProps()}. To be removed in Hive 0.16. public Map<String, String> getTblProps() { return this.hcatTable.getTblProps(); }
/** * Gets the tbl props. * * @return the tbl props */ @Deprecated // @deprecated in favour of {@link HCatTable.#getTblProps()}. To be removed in Hive 0.16. public Map<String, String> getTblProps() { return this.hcatTable.getTblProps(); }
/** * Gets the last known replication state of the provided table. This * is applicable only if it is the destination of a replication * and has had data replicated into it via imports previously. * Defaults to 0. */ public static long getLastReplicationId(HCatTable tbl) { Map<String, String> tblProps = tbl.getTblProps(); if (tblProps != null){ if (tblProps.containsKey(REPL_STATE_ID)){ return Long.parseLong(tblProps.get(REPL_STATE_ID)); } } return 0l; // default is to return earliest possible state. }
/** * Gets the last known replication state of the provided table. This * is applicable only if it is the destination of a replication * and has had data replicated into it via imports previously. * Defaults to 0. */ public static long getLastReplicationId(HCatTable tbl) { Map<String, String> tblProps = tbl.getTblProps(); if (tblProps != null){ if (tblProps.containsKey(REPL_STATE_ID)){ return Long.parseLong(tblProps.get(REPL_STATE_ID)); } } return 0l; // default is to return earliest possible state. }
/** * Gets the last known replication state of the provided table. This * is applicable only if it is the destination of a replication * and has had data replicated into it via imports previously. * Defaults to 0. */ public static long getLastReplicationId(HCatTable tbl) { Map<String, String> tblProps = tbl.getTblProps(); if (tblProps != null){ if (tblProps.containsKey(REPL_STATE_ID)){ return Long.parseLong(tblProps.get(REPL_STATE_ID)); } } return 0l; // default is to return earliest possible state. }
@Override public String toString() { return "HCatTable [ " + "tableName=" + tableName + ", " + "dbName=" + dbName + ", " + "tableType=" + tableType + ", " + "cols=" + cols + ", " + "partCols=" + partCols + ", " + "bucketCols=" + getBucketCols() + ", " + "numBuckets=" + getNumBuckets() + ", " + "sortCols=" + getSortCols() + ", " + "inputFormat=" + getInputFileFormat() + ", " + "outputFormat=" + getOutputFileFormat() + ", " + "storageHandler=" + getStorageHandler() + ", " + "serde=" + getSerdeLib() + ", " + "tblProps=" + getTblProps() + ", " + "location=" + getLocation() + ", " + "owner=" + owner() + " ]"; }
@Override public String toString() { return "HCatTable [ " + "tableName=" + tableName + ", " + "dbName=" + dbName + ", " + "tableType=" + tableType + ", " + "cols=" + cols + ", " + "partCols=" + partCols + ", " + "bucketCols=" + getBucketCols() + ", " + "numBuckets=" + getNumBuckets() + ", " + "sortCols=" + getSortCols() + ", " + "inputFormat=" + getInputFileFormat() + ", " + "outputFormat=" + getOutputFileFormat() + ", " + "storageHandler=" + getStorageHandler() + ", " + "serde=" + getSerdeLib() + ", " + "tblProps=" + getTblProps() + ", " + "location=" + getLocation() + ", " + "owner=" + owner() + " ]"; }
@Override public String toString() { return "HCatTable [ " + "tableName=" + tableName + ", " + "dbName=" + dbName + ", " + "tableType=" + tableType + ", " + "cols=" + cols + ", " + "partCols=" + partCols + ", " + "bucketCols=" + getBucketCols() + ", " + "numBuckets=" + getNumBuckets() + ", " + "sortCols=" + getSortCols() + ", " + "inputFormat=" + getInputFileFormat() + ", " + "outputFormat=" + getOutputFileFormat() + ", " + "storageHandler=" + getStorageHandler() + ", " + "serde=" + getSerdeLib() + ", " + "tblProps=" + getTblProps() + ", " + "location=" + getLocation() + ", " + "owner=" + owner() + " ]"; }