Skip to content

Commit

Permalink
fix checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
whutpencil committed May 29, 2024
1 parent 8727207 commit 0a32f07
Showing 1 changed file with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ public static void beforeClass() throws Exception {

String createDbStmtStr = String.format("CREATE DATABASE %s;", UnitTestUtil.DB_NAME);
String createTableStr1 = String.format("CREATE TABLE %s.%s(k1 int, k2 bigint) DUPLICATE KEY(k1) DISTRIBUTED BY "
+ "HASH(k2) BUCKETS 1 PROPERTIES('replication_num' = '1');", UnitTestUtil.DB_NAME, UnitTestUtil.TABLE_NAME);
String createMVStr1 = String.format("CREATE MATERIALIZED VIEW %s.%s BUILD IMMEDIATE REFRESH AUTO ON MANUAL DISTRIBUTED BY RANDOM BUCKETS 1\n" +
" PROPERTIES ('replication_num' = '1') AS SELECT k1, sum(k2) as k3 from %s.%s "
+ "group by k1;", UnitTestUtil.DB_NAME, UnitTestUtil.MV_NAME, UnitTestUtil.DB_NAME, UnitTestUtil.TABLE_NAME);
+ "HASH(k2) BUCKETS 1 PROPERTIES('replication_num' = '1');", UnitTestUtil.DB_NAME, UnitTestUtil.TABLE_NAME);
String createMVStr1 = String.format("CREATE MATERIALIZED VIEW %s.%s BUILD IMMEDIATE REFRESH AUTO ON MANUAL "
+ "DISTRIBUTED BY RANDOM BUCKETS 1 PROPERTIES ('replication_num' = '1') AS SELECT k1, sum(k2) as k3 from %s.%s"
+ "group by k1;", UnitTestUtil.DB_NAME, UnitTestUtil.MV_NAME, UnitTestUtil.DB_NAME, UnitTestUtil.TABLE_NAME);
createDb(createDbStmtStr);
createTable(createTableStr1);
createMvByNereids(createMVStr1);
Expand Down Expand Up @@ -109,7 +109,7 @@ private static void createTable(String sql) throws Exception {

private static void dropTable(String db, String tbl, boolean isMaterializedView) throws Exception {
DropTableStmt dropTableStmt = new DropTableStmt(false,
new TableName(InternalCatalog.INTERNAL_CATALOG_NAME, db, tbl), false, false);
new TableName(InternalCatalog.INTERNAL_CATALOG_NAME, db, tbl), false, false);
if (isMaterializedView) {
dropTableStmt.setMaterializedView(true);
}
Expand All @@ -122,7 +122,7 @@ private static void checkAlterJob() throws InterruptedException {
for (AlterJobV2 alterJobV2 : alterJobs.values()) {
while (!alterJobV2.getJobState().isFinalState()) {
System.out.println("alter job " + alterJobV2.getDbId()
+ " is running. state: " + alterJobV2.getJobState());
+ " is running. state: " + alterJobV2.getJobState());
Thread.sleep(100);
}
System.out.println("alter job " + alterJobV2.getDbId() + " is done. state: " + alterJobV2.getJobState());
Expand All @@ -133,8 +133,7 @@ private static void checkAlterJob() throws InterruptedException {
// there is still a short gap between "job finish" and "table become normal",
// so if user send next alter job right after the "job finish",
// it may encounter "table's state not NORMAL" error.
Database db =
Env.getCurrentInternalCatalog().getDbOrMetaException(alterJobV2.getDbId());
Database db = Env.getCurrentInternalCatalog().getDbOrMetaException(alterJobV2.getDbId());
OlapTable tbl = (OlapTable) db.getTableOrMetaException(alterJobV2.getTableId(), Table.TableType.OLAP);
while (tbl.getState() != OlapTable.OlapTableState.NORMAL) {
Thread.sleep(1000);
Expand All @@ -150,10 +149,10 @@ private static void checkAlterJob() throws InterruptedException {
@Test
public void testDropMv() throws Exception {
ExceptionChecker.expectThrowsWithMsg(DdlException.class,
String.format("'%s.%s' is not TABLE. Use 'DROP MATERIALIZED VIEW %s.%s'",
UnitTestUtil.DB_NAME, UnitTestUtil.MV_NAME, UnitTestUtil.DB_NAME, UnitTestUtil.MV_NAME),
() -> dropTable(UnitTestUtil.DB_NAME, UnitTestUtil.MV_NAME, false));
String.format("'%s.%s' is not TABLE. Use 'DROP MATERIALIZED VIEW %s.%s'",
UnitTestUtil.DB_NAME, UnitTestUtil.MV_NAME, UnitTestUtil.DB_NAME, UnitTestUtil.MV_NAME),
() -> dropTable(UnitTestUtil.DB_NAME, UnitTestUtil.MV_NAME, false));
ExceptionChecker.expectThrowsNoException(() -> dropMvByNereids(String.format("DROP MATERIALIZED VIEW %s.%s",
UnitTestUtil.DB_NAME, UnitTestUtil.MV_NAME)));
UnitTestUtil.DB_NAME, UnitTestUtil.MV_NAME)));
}
}

0 comments on commit 0a32f07

Please sign in to comment.