}
public void testModifyVarcharColumns() throws IOException {
String testDir = BuildDirectoryUtils.getBuildDirectoryPath();
Catalog catOriginal, catUpdated;
VoltProjectBuilder builder;
String report;
// start with a table
builder = new VoltProjectBuilder();
builder.addLiteralSchema("\nCREATE TABLE A (C1 BIGINT, v1 varchar(5), v2 varchar(5 BYTES) ) ;");
builder.compile(testDir + File.separator + "testVarchar0.jar");
catOriginal = catalogForJar(testDir + File.separator + "testVarchar0.jar");
// change from character to bytes
builder = new VoltProjectBuilder();
builder.addLiteralSchema("\nCREATE TABLE A (C1 BIGINT, v1 varchar(20 BYTES), v2 varchar(5 BYTES) );");
builder.compile(testDir + File.separator + "testVarchar1.jar");
catUpdated = catalogForJar(testDir + File.separator + "testVarchar1.jar");
report = verifyDiff(catOriginal, catUpdated);
assert(report.contains("Table A has been modified."));
// size not satisfied if non-empty table
builder = new VoltProjectBuilder();
builder.addLiteralSchema("\nCREATE TABLE A (C1 BIGINT, v1 varchar(15 BYTES), v2 varchar(5 BYTES) );");
builder.compile(testDir + File.separator + "testVarchar2.jar");
catUpdated = catalogForJar(testDir + File.separator + "testVarchar2.jar");
verifyDiffIfEmptyTable(catOriginal, catUpdated);
// inline character to not in line bytes.
builder = new VoltProjectBuilder();
builder.addLiteralSchema("\nCREATE TABLE A (C1 BIGINT, v1 varchar(100 BYTES), v2 varchar(5 BYTES) );");
builder.compile(testDir + File.separator + "testVarchar3.jar");
catUpdated = catalogForJar(testDir + File.separator + "testVarchar3.jar");
report = verifyDiff(catOriginal, catUpdated);
assert(report.contains("Table A has been modified."));
// bytes to character
builder = new VoltProjectBuilder();
builder.addLiteralSchema("\nCREATE TABLE A (C1 BIGINT, v1 varchar(5), v2 varchar(5 BYTES) ) ;");
builder.compile(testDir + File.separator + "testVarchar0.jar");
catOriginal = catalogForJar(testDir + File.separator + "testVarchar0.jar");
builder = new VoltProjectBuilder();
builder.addLiteralSchema("\nCREATE TABLE A (C1 BIGINT, v1 varchar(5), v2 varchar(5) );");
builder.compile(testDir + File.separator + "testVarchar4.jar");
catUpdated = catalogForJar(testDir + File.separator + "testVarchar4.jar");
report = verifyDiff(catOriginal, catUpdated);
assert(report.contains("Table A has been modified."));
builder = new VoltProjectBuilder();
builder.addLiteralSchema("\nCREATE TABLE A (C1 BIGINT, v1 varchar(5), v2 varchar(15) );");
builder.compile(testDir + File.separator + "testVarchar5.jar");
catUpdated = catalogForJar(testDir + File.separator + "testVarchar5.jar");
report = verifyDiff(catOriginal, catUpdated);
assert(report.contains("Table A has been modified."));
builder = new VoltProjectBuilder();
builder.addLiteralSchema("\nCREATE TABLE A (C1 BIGINT, v1 varchar(5), v2 varchar(150) );");
builder.compile(testDir + File.separator + "testVarchar6.jar");
catUpdated = catalogForJar(testDir + File.separator + "testVarchar6.jar");
report = verifyDiff(catOriginal, catUpdated);
assert(report.contains("Table A has been modified."));
builder = new VoltProjectBuilder();
builder.addLiteralSchema("\nCREATE TABLE A (C1 BIGINT, v1 varchar(5), v2 varchar(3) );");
builder.compile(testDir + File.separator + "testVarchar6.jar");
catUpdated = catalogForJar(testDir + File.separator + "testVarchar6.jar");
verifyDiffIfEmptyTable(catOriginal, catUpdated);
}