private static ProtectMode getProtectMode(Map<String, String> parameters) { if (!parameters.containsKey(ProtectMode.PARAMETER_NAME)) { return new ProtectMode(); } else { return getProtectModeFromString(parameters.get(ProtectMode.PARAMETER_NAME)); } }
static public ProtectMode getProtectModeFromString(String sourceString) { return new ProtectMode(sourceString); }
private Table getTable(HiveMetastore metastore, SchemaTableName tableName) { Optional<Table> target = metastore.getTable(tableName.getSchemaName(), tableName.getTableName()); if (!target.isPresent()) { throw new TableNotFoundException(tableName); } Table table = target.get(); String protectMode = table.getParameters().get(ProtectMode.PARAMETER_NAME); if (protectMode != null && getProtectModeFromString(protectMode).offline) { throw new TableOfflineException(tableName); } String prestoOffline = table.getParameters().get(PRESTO_OFFLINE); if (!isNullOrEmpty(prestoOffline)) { throw new TableOfflineException(tableName, format("Table '%s' is offline for Presto: %s", tableName, prestoOffline)); } return table; }
/** * @param protectMode */ public void setProtectMode(ProtectMode protectMode){ Map<String, String> parameters = tTable.getParameters(); String pm = protectMode.toString(); if (pm != null) { parameters.put(ProtectMode.PARAMETER_NAME, pm); } else { parameters.remove(ProtectMode.PARAMETER_NAME); } tTable.setParameters(parameters); }
static public ProtectMode getProtectModeFromString(String sourceString) { return new ProtectMode(sourceString); }
if (protectMode != null && getProtectModeFromString(protectMode).offline) { throw new PartitionOfflineException(tableName, partName);
/** * @param protectMode */ public void setProtectMode(ProtectMode protectMode){ Map<String, String> parameters = tPartition.getParameters(); parameters.put(ProtectMode.PARAMETER_NAME, protectMode.toString()); tPartition.setParameters(parameters); }
private static ProtectMode getProtectMode(Map<String, String> parameters) { if (!parameters.containsKey(ProtectMode.PARAMETER_NAME)) { return new ProtectMode(); } else { return getProtectModeFromString(parameters.get(ProtectMode.PARAMETER_NAME)); } }
static public ProtectMode getProtectModeFromString(String sourceString) { return new ProtectMode(sourceString); }
/** * @param protectMode */ public void setProtectMode(ProtectMode protectMode){ Map<String, String> parameters = tTable.getParameters(); parameters.put(ProtectMode.PARAMETER_NAME, protectMode.toString()); tTable.setParameters(parameters); }
private static ProtectMode getProtectMode(Map<String, String> parameters) { if (parameters == null) { return null; } if (!parameters.containsKey(ProtectMode.PARAMETER_NAME)) { return new ProtectMode(); } else { return ProtectMode.getProtectModeFromString(parameters.get(ProtectMode.PARAMETER_NAME)); } }
static public ProtectMode getProtectModeFromString(String sourceString) { return new ProtectMode(sourceString); }
/** * @param protectMode */ public void setProtectMode(ProtectMode protectMode){ Map<String, String> parameters = tPartition.getParameters(); String pm = protectMode.toString(); if (pm != null) { parameters.put(ProtectMode.PARAMETER_NAME, pm); } else { parameters.remove(ProtectMode.PARAMETER_NAME); } tPartition.setParameters(parameters); }
private static ProtectMode getProtectMode(Map<String, String> parameters) { if (parameters == null) { return null; } if (!parameters.containsKey(ProtectMode.PARAMETER_NAME)) { return new ProtectMode(); } else { return ProtectMode.getProtectModeFromString(parameters.get(ProtectMode.PARAMETER_NAME)); } }
private static void getTableMetaDataInformation(StringBuilder tableInfo, Table tbl) { formatOutput("Database:", tbl.getDbName(), tableInfo); formatOutput("Owner:", tbl.getOwner(), tableInfo); formatOutput("CreateTime:", formatDate(tbl.getTTable().getCreateTime()), tableInfo); formatOutput("LastAccessTime:", formatDate(tbl.getTTable().getLastAccessTime()), tableInfo); String protectMode = tbl.getProtectMode().toString(); formatOutput("Protect Mode:", protectMode == null ? "None" : protectMode, tableInfo); formatOutput("Retention:", Integer.toString(tbl.getRetention()), tableInfo); if (!tbl.isView()) { formatOutput("Location:", tbl.getDataLocation().toString(), tableInfo); } formatOutput("Table Type:", tbl.getTableType().name(), tableInfo); if (tbl.getParameters().size() > 0) { tableInfo.append("Table Parameters:").append(LINE_DELIM); displayAllParameters(tbl.getParameters(), tableInfo); } }
/** * @return protect mode */ public ProtectMode getProtectMode(){ Map<String, String> parameters = tTable.getParameters(); if (!parameters.containsKey(ProtectMode.PARAMETER_NAME)) { return new ProtectMode(); } else { return ProtectMode.getProtectModeFromString( parameters.get(ProtectMode.PARAMETER_NAME)); } }
private static void getTableMetaDataInformation(StringBuilder tableInfo, Table tbl) { formatOutput("Database:", tbl.getDbName(), tableInfo); formatOutput("Owner:", tbl.getOwner(), tableInfo); formatOutput("CreateTime:", formatDate(tbl.getTTable().getCreateTime()), tableInfo); formatOutput("LastAccessTime:", formatDate(tbl.getTTable().getLastAccessTime()), tableInfo); String protectMode = tbl.getProtectMode().toString(); formatOutput("Protect Mode:", protectMode == null ? "None" : protectMode, tableInfo); formatOutput("Retention:", Integer.toString(tbl.getRetention()), tableInfo); if (!tbl.isView()) { formatOutput("Location:", tbl.getDataLocation().toString(), tableInfo); } formatOutput("Table Type:", tbl.getTableType().name(), tableInfo); if (tbl.getParameters().size() > 0) { tableInfo.append("Table Parameters:").append(LINE_DELIM); displayAllParameters(tbl.getParameters(), tableInfo); } }
/** * @return protect mode */ public ProtectMode getProtectMode(){ Map<String, String> parameters = tPartition.getParameters(); if (parameters == null) { return null; } if (!parameters.containsKey(ProtectMode.PARAMETER_NAME)) { return new ProtectMode(); } else { return ProtectMode.getProtectModeFromString( parameters.get(ProtectMode.PARAMETER_NAME)); } }
private static void getPartitionMetaDataInformation(StringBuilder tableInfo, Partition part) { formatOutput("Partition Value:", part.getValues().toString(), tableInfo); formatOutput("Database:", part.getTPartition().getDbName(), tableInfo); formatOutput("Table:", part.getTable().getTableName(), tableInfo); formatOutput("CreateTime:", formatDate(part.getTPartition().getCreateTime()), tableInfo); formatOutput("LastAccessTime:", formatDate(part.getTPartition().getLastAccessTime()), tableInfo); String protectMode = part.getProtectMode().toString(); formatOutput("Protect Mode:", protectMode == null ? "None" : protectMode, tableInfo); formatOutput("Location:", part.getLocation(), tableInfo); if (part.getTPartition().getParameters().size() > 0) { tableInfo.append("Partition Parameters:").append(LINE_DELIM); displayAllParameters(part.getTPartition().getParameters(), tableInfo); } }
private static void getPartitionMetaDataInformation(StringBuilder tableInfo, Partition part) { formatOutput("Partition Value:", part.getValues().toString(), tableInfo); formatOutput("Database:", part.getTPartition().getDbName(), tableInfo); formatOutput("Table:", part.getTable().getTableName(), tableInfo); formatOutput("CreateTime:", formatDate(part.getTPartition().getCreateTime()), tableInfo); formatOutput("LastAccessTime:", formatDate(part.getTPartition().getLastAccessTime()), tableInfo); String protectMode = part.getProtectMode().toString(); formatOutput("Protect Mode:", protectMode == null ? "None" : protectMode, tableInfo); formatOutput("Location:", part.getLocation(), tableInfo); if (part.getTPartition().getParameters().size() > 0) { tableInfo.append("Partition Parameters:").append(LINE_DELIM); displayAllParameters(part.getTPartition().getParameters(), tableInfo); } }