public AlterTableDesc(String tableName, HashMap<String, String> partSpec, int numBuckets) throws SemanticException { op = AlterTableTypes.ALTERBUCKETNUM; setOldName(tableName); this.partSpec = partSpec; this.numberBuckets = numBuckets; }
public AlterTableDesc(String tableName, List<SQLPrimaryKey> primaryKeyCols, List<SQLForeignKey> foreignKeyCols, List<SQLUniqueConstraint> uniqueConstraintCols, ReplicationSpec replicationSpec) throws SemanticException { setOldName(tableName); this.primaryKeyCols = primaryKeyCols; this.foreignKeyCols = foreignKeyCols; this.uniqueConstraintCols = uniqueConstraintCols; this.replicationSpec = replicationSpec; op = AlterTableTypes.ADDCONSTRAINT; }
public AlterTableDesc(String tableName, boolean sortingOff, HashMap<String, String> partSpec) throws SemanticException { setOldName(tableName); op = AlterTableTypes.ADDCLUSTERSORTCOLUMN; isTurnOffSorting = sortingOff; this.partSpec = partSpec; }
public AlterTableDesc(String tableName, String newLocation, HashMap<String, String> partSpec) throws SemanticException { op = AlterTableTypes.ALTERLOCATION; setOldName(tableName); this.newLocation = newLocation; this.partSpec = partSpec; }
public AlterTableDesc(String tableName, String dropConstraintName, ReplicationSpec replicationSpec) throws SemanticException { setOldName(tableName); this.dropConstraintName = dropConstraintName; this.replicationSpec = replicationSpec; op = AlterTableTypes.DROPCONSTRAINT; }
public AlterTableDesc(String tableName, Map<List<String>, String> locations, HashMap<String, String> partSpec) throws SemanticException { op = AlterTableTypes.ALTERSKEWEDLOCATION; setOldName(tableName); this.skewedLocations = locations; this.partSpec = partSpec; }
public AlterTableDesc(String tableName, List<SQLPrimaryKey> primaryKeyCols, List<SQLForeignKey> foreignKeyCols, List<SQLUniqueConstraint> uniqueConstraintCols, List<SQLNotNullConstraint> notNullConstraintCols, List<SQLDefaultConstraint> defaultConstraints, List<SQLCheckConstraint> checkConstraints, ReplicationSpec replicationSpec) throws SemanticException { setOldName(tableName); this.primaryKeyCols = primaryKeyCols; this.foreignKeyCols = foreignKeyCols; this.uniqueConstraintCols = uniqueConstraintCols; this.notNullConstraintCols = notNullConstraintCols; this.defaultConstraintsCols = defaultConstraints; this.checkConstraintsCols = checkConstraints; this.replicationSpec = replicationSpec; op = AlterTableTypes.ADDCONSTRAINT; }
/** * @param oldName * old name of the table * @param newName * new name of the table * @param expectView * Flag to denote if current table can be a view * @param replicationSpec * Replication specification with current event ID * @throws SemanticException */ public AlterTableDesc(String oldName, String newName, boolean expectView, ReplicationSpec replicationSpec) throws SemanticException { op = AlterTableTypes.RENAME; setOldName(oldName); this.newName = newName; this.expectView = expectView; this.replicationSpec = replicationSpec; }
/** * @param name * name of the table * @param newCols * new columns to be added * @throws SemanticException */ public AlterTableDesc(String name, HashMap<String, String> partSpec, List<FieldSchema> newCols, AlterTableTypes alterType, boolean isCascade) throws SemanticException { op = alterType; setOldName(name); this.newCols = new ArrayList<FieldSchema>(newCols); this.partSpec = partSpec; this.isCascade = isCascade; }
public AlterTableDesc(String tableName, int numBuckets, List<String> bucketCols, List<Order> sortCols, HashMap<String, String> partSpec) throws SemanticException { setOldName(tableName); op = AlterTableTypes.ADDCLUSTERSORTCOLUMN; numberBuckets = numBuckets; bucketColumns = new ArrayList<String>(bucketCols); sortColumns = new ArrayList<Order>(sortCols); this.partSpec = partSpec; }
public AlterTableDesc(String tableName, boolean turnOffSkewed, List<String> skewedColNames, List<List<String>> skewedColValues) throws SemanticException { setOldName(tableName); op = AlterTableTypes.ADDSKEWEDBY; this.isTurnOffSkewed = turnOffSkewed; this.skewedColNames = new ArrayList<String>(skewedColNames); this.skewedColValues = new ArrayList<List<String>>(skewedColValues); }
public static Task<?> getTableCheckpointTask(ImportTableDesc tableDesc, HashMap<String, String> partSpec, String dumpRoot, HiveConf conf) throws SemanticException { HashMap<String, String> mapProp = new HashMap<>(); mapProp.put(REPL_CHECKPOINT_KEY, dumpRoot); AlterTableDesc alterTblDesc = new AlterTableDesc(AlterTableDesc.AlterTableTypes.ADDPROPS); alterTblDesc.setProps(mapProp); alterTblDesc.setOldName( StatsUtils.getFullyQualifiedTableName(tableDesc.getDatabaseName(), tableDesc.getTableName())); if (partSpec != null) { alterTblDesc.setPartSpec(partSpec); } return TaskFactory.get(new DDLWork(new HashSet<>(), new HashSet<>(), alterTblDesc), conf); }
@SuppressWarnings("unchecked") private void setStatsForNonNativeTable(String dbName, String tableName) throws SemanticException { String qTableName = DDLSemanticAnalyzer.getDotName(new String[] { dbName, tableName }); AlterTableDesc alterTblDesc = new AlterTableDesc(AlterTableTypes.DROPPROPS, null, false); HashMap<String, String> mapProp = new HashMap<>(); mapProp.put(StatsSetupConst.COLUMN_STATS_ACCURATE, null); alterTblDesc.setOldName(qTableName); alterTblDesc.setProps(mapProp); alterTblDesc.setDropIfExists(true); this.rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), alterTblDesc))); }
@SuppressWarnings("unchecked") private void setStatsForNonNativeTable(Table tab) throws SemanticException { String tableName = DDLSemanticAnalyzer.getDotName(new String[] { tab.getDbName(), tab.getTableName() }); AlterTableDesc alterTblDesc = new AlterTableDesc(AlterTableTypes.DROPPROPS, null, false); HashMap<String, String> mapProp = new HashMap<>(); mapProp.put(StatsSetupConst.COLUMN_STATS_ACCURATE, null); alterTblDesc.setOldName(tableName); alterTblDesc.setProps(mapProp); alterTblDesc.setDropIfExists(true); this.rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), alterTblDesc), conf)); }
private Task<? extends Serializable> tableUpdateReplStateTask(String dbName, String tableName, Map<String, String> partSpec, String replState, Task<? extends Serializable> preCursor) throws SemanticException { HashMap<String, String> mapProp = new HashMap<>(); mapProp.put(ReplicationSpec.KEY.CURR_STATE_ID.toString(), replState); AlterTableDesc alterTblDesc = new AlterTableDesc( AlterTableDesc.AlterTableTypes.ADDPROPS, new ReplicationSpec(replState, replState)); alterTblDesc.setProps(mapProp); alterTblDesc.setOldName(StatsUtils.getFullyQualifiedTableName(dbName, tableName)); alterTblDesc.setPartSpec((HashMap<String, String>) partSpec); Task<? extends Serializable> updateReplIdTask = TaskFactory.get(new DDLWork(inputs, outputs, alterTblDesc), conf); // Link the update repl state task with dependency collection task if (preCursor != null) { preCursor.addDependentTask(updateReplIdTask); log.debug("Added {}:{} as a precursor of {}:{}", preCursor.getClass(), preCursor.getId(), updateReplIdTask.getClass(), updateReplIdTask.getId()); } return updateReplIdTask; }
private void analyzeAlterTableSerdeProps(ASTNode ast, String tableName, HashMap<String, String> partSpec) throws SemanticException { HashMap<String, String> mapProp = getProps((ASTNode) (ast.getChild(0)) .getChild(0)); AlterTableDesc alterTblDesc = new AlterTableDesc( AlterTableTypes.ADDSERDEPROPS); alterTblDesc.setProps(mapProp); alterTblDesc.setOldName(tableName); alterTblDesc.setPartSpec(partSpec); addInputsOutputsAlterTable(tableName, partSpec, alterTblDesc); rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), alterTblDesc))); }
private void analyzeAlterTableUpdateColumns(ASTNode ast, String tableName, HashMap<String, String> partSpec) throws SemanticException { boolean isCascade = false; if (null != ast.getFirstChildWithType(HiveParser.TOK_CASCADE)) { isCascade = true; } AlterTableDesc alterTblDesc = new AlterTableDesc(AlterTableTypes.UPDATECOLUMNS); alterTblDesc.setOldName(tableName); alterTblDesc.setIsCascade(isCascade); alterTblDesc.setPartSpec(partSpec); Table tbl = getTable(tableName); if (AcidUtils.isTransactionalTable(tbl)) { setAcidDdlDesc(alterTblDesc); } rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), alterTblDesc), conf)); }
private void analyzeAlterTableSerdeProps(ASTNode ast, String tableName, HashMap<String, String> partSpec) throws SemanticException { HashMap<String, String> mapProp = getProps((ASTNode) (ast.getChild(0)) .getChild(0)); AlterTableDesc alterTblDesc = new AlterTableDesc( AlterTableTypes.ADDSERDEPROPS); alterTblDesc.setProps(mapProp); alterTblDesc.setOldName(tableName); alterTblDesc.setPartSpec(partSpec); addInputsOutputsAlterTable(tableName, partSpec, alterTblDesc); rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), alterTblDesc), conf)); }
private void analyzeAlterTableSerde(ASTNode ast, String tableName, HashMap<String, String> partSpec) throws SemanticException { String serdeName = unescapeSQLString(ast.getChild(0).getText()); AlterTableDesc alterTblDesc = new AlterTableDesc(AlterTableTypes.ADDSERDE); if (ast.getChildCount() > 1) { HashMap<String, String> mapProp = getProps((ASTNode) (ast.getChild(1)) .getChild(0)); alterTblDesc.setProps(mapProp); } alterTblDesc.setOldName(tableName); alterTblDesc.setSerdeName(serdeName); alterTblDesc.setPartSpec(partSpec); addInputsOutputsAlterTable(tableName, partSpec, alterTblDesc); rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), alterTblDesc))); }
private void analyzeAlterTableSerde(ASTNode ast, String tableName, HashMap<String, String> partSpec) throws SemanticException { String serdeName = unescapeSQLString(ast.getChild(0).getText()); AlterTableDesc alterTblDesc = new AlterTableDesc(AlterTableTypes.ADDSERDE); if (ast.getChildCount() > 1) { HashMap<String, String> mapProp = getProps((ASTNode) (ast.getChild(1)) .getChild(0)); alterTblDesc.setProps(mapProp); } alterTblDesc.setOldName(tableName); alterTblDesc.setSerdeName(serdeName); alterTblDesc.setPartSpec(partSpec); addInputsOutputsAlterTable(tableName, partSpec, alterTblDesc); rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), alterTblDesc), conf)); }