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; }
AlterTableDesc alterTblDesc = new AlterTableDesc( AlterTableDesc.AlterTableTypes.ADDPROPS, null, false); alterTblDesc.setProps(mapProp); alterTblDesc.setOldName(tableName); Task<? extends Serializable> updateReplIdTask = TaskFactory.get(
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))); }
alterTblDesc = new AlterTableDesc(AlterTableTypes.ADDPROPS, partSpec, expectView); alterTblDesc.setProps(mapProp); alterTblDesc.setEnvironmentContext(environmentContext); alterTblDesc.setOldName(tableName);
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)); }
alterTblDesc = new AlterTableDesc(AlterTableTypes.ADDPROPS, partSpec, expectView); alterTblDesc.setProps(mapProp); alterTblDesc.setEnvironmentContext(environmentContext); alterTblDesc.setOldName(tableName);
Map<String, String> mapProps = new HashMap<>(); mapProps.put(hive_metastoreConstants.TABLE_IS_TRANSACTIONAL, Boolean.TRUE.toString()); alterTblDesc.setProps(mapProps); alterTblDesc.setOldName(newTableName); addExportTask(rootTasks, exportTask, 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))); }
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)); }
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); 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 analyzeAlterTableProps(ASTNode ast, boolean expectView) throws SemanticException { String tableName = getUnescapedName((ASTNode)ast.getChild(0)); HashMap<String, String> mapProp = getProps((ASTNode) (ast.getChild(1)) .getChild(0)); AlterTableDesc alterTblDesc = new AlterTableDesc(AlterTableTypes.ADDPROPS, expectView); alterTblDesc.setProps(mapProp); alterTblDesc.setOldName(tableName); try { Table tab = db.getTable(db.getCurrentDatabase(), tableName, false); if (tab != null) { inputs.add(new ReadEntity(tab)); outputs.add(new WriteEntity(tab)); } } catch (HiveException e) { throw new SemanticException(ErrorMsg.INVALID_TABLE.getMsg(tableName)); } rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), alterTblDesc), conf)); }
private void analyzeAlterTableProps(String[] qualified, ASTNode ast, boolean expectView, boolean isUnset) throws SemanticException { String tableName = getDotName(qualified); HashMap<String, String> mapProp = getProps((ASTNode) (ast.getChild(0)) .getChild(0)); AlterTableDesc alterTblDesc = null; if (isUnset == true) { alterTblDesc = new AlterTableDesc(AlterTableTypes.DROPPROPS, expectView); if (ast.getChild(1) != null) { alterTblDesc.setDropIfExists(true); } } else { alterTblDesc = new AlterTableDesc(AlterTableTypes.ADDPROPS, expectView); } alterTblDesc.setProps(mapProp); alterTblDesc.setOldName(tableName); addInputsOutputsAlterTable(tableName, null, 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), 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); rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), alterTblDesc), conf)); }