Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
jackylk committed Nov 13, 2018
1 parent a2c9aeb commit 818d624
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,6 @@ class TestNonTransactionalCarbonTable extends QueryTest with BeforeAndAfterAll {
|'carbondata' LOCATION
|'$writerPath' """.stripMargin)

checkExistence(sql("carboncli for table sdkOutputTable options('-cmd summary -a -v -c age')"), false, "written_by", "Version")

checkExistence(sql("describe formatted sdkOutputTable"), true, writerPath)

buildTestDataWithSortColumns(List("age"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,19 @@ class AddColumnTestCases extends Spark2QueryTest with BeforeAndAfterAll {
test("test compaction after adding new column") {
sqlContext.setConf("carbon.enable.vector.reader", "true")
sql("ALTER TABLE addcolumntest COMPACT 'major'")
checkExistence(sql("SHOW SEGMENTS FOR TABLE addcolumntest"), true, "0Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE addcolumntest"), true, "1Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE addcolumntest"), true, "0.1Success")
sql("SHOW SEGMENTS FOR TABLE addcolumntest").show(100, false)
checkExistence(sql("SHOW SEGMENTS FOR TABLE addcolumntest"), true, "0 Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE addcolumntest"), true, "1 Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE addcolumntest"), true, "0.1 Success")
checkAnswer(sql("SELECT charField FROM addcolumntest"), Seq(Row("abc"), Row("def")))

afterAll
beforeAll
sqlContext.setConf("carbon.enable.vector.reader", "false")
sql("ALTER TABLE addcolumntest COMPACT 'major'")
checkExistence(sql("SHOW SEGMENTS FOR TABLE addcolumntest"), true, "0Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE addcolumntest"), true, "1Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE addcolumntest"), true, "0.1Success")
checkExistence(sql("SHOW SEGMENTS FOR TABLE addcolumntest"), true, "0 Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE addcolumntest"), true, "1 Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE addcolumntest"), true, "0.1 Success")
checkAnswer(sql("SELECT charField FROM addcolumntest"), Seq(Row("abc"), Row("def")))
}

Expand Down Expand Up @@ -563,9 +564,9 @@ class AddColumnTestCases extends Spark2QueryTest with BeforeAndAfterAll {
sql("ALTER TABLE alter_dict DROP COLUMNS(charField)")
sql(s"LOAD DATA LOCAL INPATH '$resourcesPath/restructure/data7.csv' INTO TABLE alter_dict OPTIONS('FILEHEADER'='stringField')")
sql("ALTER TABLE alter_dict COMPACT 'major'")
checkExistence(sql("SHOW SEGMENTS FOR TABLE alter_dict"), true, "0Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE alter_dict"), true, "1Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE alter_dict"), true, "0.1Success")
checkExistence(sql("SHOW SEGMENTS FOR TABLE alter_dict"), true, "0 Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE alter_dict"), true, "1 Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE alter_dict"), true, "0.1 Success")
sql("DROP TABLE IF EXISTS alter_dict")
}

Expand All @@ -590,9 +591,9 @@ class AddColumnTestCases extends Spark2QueryTest with BeforeAndAfterAll {
sql("ALTER TABLE alter_no_dict DROP COLUMNS(charField)")
sql(s"LOAD DATA LOCAL INPATH '$resourcesPath/restructure/data7.csv' INTO TABLE alter_no_dict OPTIONS('FILEHEADER'='stringField')")
sql("ALTER TABLE alter_no_dict COMPACT 'major'")
checkExistence(sql("SHOW SEGMENTS FOR TABLE alter_no_dict"), true, "0Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE alter_no_dict"), true, "1Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE alter_no_dict"), true, "0.1Success")
checkExistence(sql("SHOW SEGMENTS FOR TABLE alter_no_dict"), true, "0 Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE alter_no_dict"), true, "1 Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE alter_no_dict"), true, "0.1 Success")
sql("DROP TABLE IF EXISTS alter_no_dict")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ class ChangeDataTypeTestCases extends Spark2QueryTest with BeforeAndAfterAll {
checkAnswer(sql("SELECT decimalField FROM changedatatypetest"),
Seq(Row(new BigDecimal("21.23").setScale(5)), Row(new BigDecimal("21.23").setScale(5))))
sql("ALTER TABLE changedatatypetest COMPACT 'major'")
checkExistence(sql("SHOW SEGMENTS FOR TABLE changedatatypetest"), true, "0Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE changedatatypetest"), true, "1Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE changedatatypetest"), true, "0.1Success")
checkExistence(sql("SHOW SEGMENTS FOR TABLE changedatatypetest"), true, "0 Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE changedatatypetest"), true, "1 Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE changedatatypetest"), true, "0.1 Success")
afterAll
}
sqlContext.setConf("carbon.enable.vector.reader", "true")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ class DropColumnTestCases extends Spark2QueryTest with BeforeAndAfterAll {
sql(s"LOAD DATA LOCAL INPATH '$resourcesPath/restructure/data4.csv' INTO TABLE dropcolumntest"
+ s" OPTIONS('FILEHEADER'='intField,stringField,timestampField,decimalField')")
sql("ALTER TABLE dropcolumntest COMPACT 'major'")
checkExistence(sql("SHOW SEGMENTS FOR TABLE dropcolumntest"), true, "0Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE dropcolumntest"), true, "1Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE dropcolumntest"), true, "0.1Success")
checkExistence(sql("SHOW SEGMENTS FOR TABLE dropcolumntest"), true, "0 Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE dropcolumntest"), true, "1 Compacted")
checkExistence(sql("SHOW SEGMENTS FOR TABLE dropcolumntest"), true, "0.1 Success")
afterAll
}
sqlContext.setConf("carbon.enable.vector.reader", "true")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class GetDataSizeAndIndexSizeTest extends QueryTest with BeforeAndAfterAll {
test("get last update time for empty table") {
sql("CREATE TABLE tableSize9 (empno int, workgroupcategory string, deptno int, projectcode int, attendance int) STORED BY 'org.apache.carbondata.format'")
val res7 = sql("DESCRIBE FORMATTED tableSize9").collect()
.filter(row => row.getString(0).contains(CarbonCommonConstants.LAST_UPDATE_TIME))
.filter(row => row.getString(0).contains("Last Update"))
assert(res7.length == 1)
}

Expand All @@ -146,7 +146,7 @@ class GetDataSizeAndIndexSizeTest extends QueryTest with BeforeAndAfterAll {
sql(s"""LOAD DATA local inpath '$resourcesPath/data.csv' INTO TABLE tableSize10 OPTIONS ('DELIMITER'= ',', 'QUOTECHAR'= '\"', 'FILEHEADER'='')""")

val res8 = sql("DESCRIBE FORMATTED tableSize10").collect()
.filter(row => row.getString(0).contains(CarbonCommonConstants.LAST_UPDATE_TIME))
.filter(row => row.getString(0).contains("Last Update"))
assert(res8.length == 1)
}

Expand Down

0 comments on commit 818d624

Please sign in to comment.