Program: 171121
Project: 171121
Buggy source:
@Test public void testAlterTableChangeColumn() throws Exception {
  String oldColName="String_Node_Str";
  String newColName="String_Node_Str";
  String tableName=createTable();
  String query=String.format("String_Node_Str",tableName,oldColName,newColName);
  runCommand(query);
  assertColumnIsNotRegistered(HiveMetaStoreBridge.getColumnQualifiedName(HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME,DEFAULT_DB,tableName),oldColName));
  assertColumnIsRegistered(HiveMetaStoreBridge.getColumnQualifiedName(HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME,DEFAULT_DB,tableName),newColName));
  List<Referenceable> columns=getColumns(DEFAULT_DB,tableName);
  Assert.assertEquals(columns.size(),2);
  oldColName="String_Node_Str";
  newColName="String_Node_Str";
  final String newColType="String_Node_Str";
  query=String.format("String_Node_Str",tableName,oldColName,newColName,newColType);
  runCommand(query);
  columns=getColumns(DEFAULT_DB,tableName);
  Assert.assertEquals(columns.size(),2);
  assertColumnIsNotRegistered(HiveMetaStoreBridge.getColumnQualifiedName(HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME,DEFAULT_DB,tableName),oldColName));
  String newColQualifiedName=HiveMetaStoreBridge.getColumnQualifiedName(HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME,DEFAULT_DB,tableName),newColName);
  assertColumnIsRegistered(newColQualifiedName);
  Assert.assertEquals(columns.get(1).get("String_Node_Str"),"String_Node_Str");
  oldColName="String_Node_Str";
  newColName="String_Node_Str";
  final String comment="String_Node_Str";
  query=String.format("String_Node_Str",tableName,oldColName,newColName,newColType,comment);
  runCommand(query);
  columns=getColumns(DEFAULT_DB,tableName);
  Assert.assertEquals(columns.size(),2);
  assertColumnIsNotRegistered(HiveMetaStoreBridge.getColumnQualifiedName(HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME,DEFAULT_DB,tableName),oldColName));
  newColQualifiedName=HiveMetaStoreBridge.getColumnQualifiedName(HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME,DEFAULT_DB,tableName),newColName);
  assertColumnIsRegistered(newColQualifiedName);
  Assert.assertEquals(columns.get(1).get(HiveDataModelGenerator.COMMENT),comment);
}

Fixed version (ground truth):
@Test public void testAlterTableChangeColumn() throws Exception {
  String oldColName="String_Node_Str";
  String newColName="String_Node_Str";
  String tableName=createTable();
  String query=String.format("String_Node_Str",tableName,oldColName,newColName);
  runCommand(query);
  assertColumnIsNotRegistered(HiveMetaStoreBridge.getColumnQualifiedName(HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME,DEFAULT_DB,tableName),oldColName));
  assertColumnIsRegistered(HiveMetaStoreBridge.getColumnQualifiedName(HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME,DEFAULT_DB,tableName),newColName));
  List<Referenceable> columns=getColumns(DEFAULT_DB,tableName);
  Assert.assertEquals(columns.size(),2);
  oldColName="String_Node_Str";
  newColName="String_Node_Str";
  final String newColType="String_Node_Str";
  query=String.format("String_Node_Str",tableName,oldColName,newColName,newColType);
  runCommand(query);
  columns=getColumns(DEFAULT_DB,tableName);
  Assert.assertEquals(columns.size(),2);
  assertColumnIsNotRegistered(HiveMetaStoreBridge.getColumnQualifiedName(HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME,DEFAULT_DB,tableName),oldColName));
  String newColQualifiedName=HiveMetaStoreBridge.getColumnQualifiedName(HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME,DEFAULT_DB,tableName),newColName);
  assertColumnIsRegistered(newColQualifiedName);
  Assert.assertEquals(columns.get(1).get("String_Node_Str"),"String_Node_Str");
  oldColName="String_Node_Str";
  newColName="String_Node_Str";
  final String comment="String_Node_Str";
  query=String.format("String_Node_Str",tableName,oldColName,newColName,newColType,comment);
  runCommand(query);
  columns=getColumns(DEFAULT_DB,tableName);
  Assert.assertEquals(columns.size(),2);
  assertColumnIsNotRegistered(HiveMetaStoreBridge.getColumnQualifiedName(HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME,DEFAULT_DB,tableName),oldColName));
  newColQualifiedName=HiveMetaStoreBridge.getColumnQualifiedName(HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME,DEFAULT_DB,tableName),newColName);
  assertColumnIsRegistered(newColQualifiedName);
  Assert.assertEquals(columns.get(1).get(HiveDataModelGenerator.COMMENT),comment);
  oldColName="String_Node_Str";
  newColName="String_Node_Str";
  query=String.format("String_Node_Str",tableName,oldColName,newColName,newColType);
  runCommand(query);
  columns=getColumns(DEFAULT_DB,tableName);
  Assert.assertEquals(columns.size(),2);
  assertColumnIsNotRegistered(HiveMetaStoreBridge.getColumnQualifiedName(HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME,DEFAULT_DB,tableName),oldColName));
  newColQualifiedName=HiveMetaStoreBridge.getColumnQualifiedName(HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME,DEFAULT_DB,tableName),newColName);
  assertColumnIsRegistered(newColQualifiedName);
  Assert.assertEquals(columns.get(0).get(HiveDataModelGenerator.NAME),newColName);
  Assert.assertEquals(columns.get(1).get(HiveDataModelGenerator.NAME),"String_Node_Str");
  oldColName="String_Node_Str";
  newColName="String_Node_Str";
  query=String.format("String_Node_Str",tableName,oldColName,newColName,newColType);
  runCommand(query);
  columns=getColumns(DEFAULT_DB,tableName);
  Assert.assertEquals(columns.size(),2);
  assertColumnIsNotRegistered(HiveMetaStoreBridge.getColumnQualifiedName(HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME,DEFAULT_DB,tableName),oldColName));
  newColQualifiedName=HiveMetaStoreBridge.getColumnQualifiedName(HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME,DEFAULT_DB,tableName),newColName);
  assertColumnIsRegistered(newColQualifiedName);
  Assert.assertEquals(columns.get(1).get(HiveDataModelGenerator.NAME),newColName);
  Assert.assertEquals(columns.get(0).get(HiveDataModelGenerator.NAME),"String_Node_Str");
}