Skip to content

Commit

Permalink
[ISSUE-4342] Fix test case errors (#4343)
Browse files Browse the repository at this point in the history
Co-authored-by: QiangCai <davidcaiq@gmail.com>
  • Loading branch information
QiangCai and QiangCai committed Nov 19, 2023
1 parent 48f5976 commit 7195869
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ public TableIndex getIndex(CarbonTable table, IndexSchema indexSchema) {
// contains the stale carbon table schema mismatch exception is thrown. To avoid such scenarios
// it is always better to update the carbon table object retrieved
index.getIndexFactory().setCarbonTable(table);
index.getIndexFactory().setIndexSchema(indexSchema);
index.setIndexSchema(indexSchema);
return index;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,10 @@ public IndexSchema getIndexSchema() {
return indexSchema;
}

public void setIndexSchema(IndexSchema indexSchema) {
this.indexSchema = indexSchema;
}

public IndexFactory getIndexFactory() {
return indexFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public IndexSchema getIndexSchema() {
return indexSchema;
}

public void setIndexSchema(IndexSchema indexSchema) {
this.indexSchema = indexSchema;
}

public IndexInputSplitWrapper toDistributableSegment(Segment segment,
IndexSchema schema, AbsoluteTableIdentifier identifier, String uniqueId) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,12 @@ class MVCreateTestCase extends QueryTest with BeforeAndAfterAll {
}

test("test create materialized view with simple and sub group by query") {
sql("drop materialized view if exists mv13")
sql("create materialized view mv13 as select empname, sum(utilization) from fact_table1 group by empname")
sql("drop materialized view if exists mv13_1")
sql("create materialized view mv13_1 as select empname, sum(utilization) from fact_table1 group by empname")
val frame = sql("select sum(utilization) from fact_table1 group by empname")
assert(TestUtil.verifyMVHit(frame.queryExecution.optimizedPlan, "mv13"))
assert(TestUtil.verifyMVHit(frame.queryExecution.optimizedPlan, "mv13_1"))
checkAnswer(frame, sql("select sum(utilization) from fact_table2 group by empname"))
sql(s"drop materialized view mv13")
sql(s"drop materialized view mv13_1")
}

test("test create materialized view with simple and sub group by query with filter on query") {
Expand Down Expand Up @@ -858,15 +858,15 @@ class MVCreateTestCase extends QueryTest with BeforeAndAfterAll {

test("jira carbondata-2523") {

sql("drop materialized view if exists mv13")
sql("drop materialized view if exists mv13_2")
sql("drop table if exists test4")
sql("create table test4 ( name string,age int,salary int) STORED AS carbondata")

sql(" insert into test4 select 'babu',12,12").collect()
sql("create materialized view mv13 as select name,sum(salary) from test4 group by name")
sql("create materialized view mv13_2 as select name,sum(salary) from test4 group by name")
val frame = sql(
"select name,sum(salary) from test4 group by name")
assert(TestUtil.verifyMVHit(frame.queryExecution.optimizedPlan, "mv13"))
assert(TestUtil.verifyMVHit(frame.queryExecution.optimizedPlan, "mv13_2"))
}

test("jira carbondata-2528-1") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public CarbonWriterBuilder withTableProperties(Map<String, String> options) {
} else if ("local_dictionary_threshold".equalsIgnoreCase(entry.getKey())) {
this.localDictionaryThreshold(Integer.parseInt(entry.getValue()));
} else if ("local_dictionary_enable".equalsIgnoreCase(entry.getKey())) {
this.enableLocalDictionary(("true".equalsIgnoreCase(entry.getKey())));
this.enableLocalDictionary("true".equalsIgnoreCase(entry.getValue()));
} else if ("sort_columns".equalsIgnoreCase(entry.getKey())) {
//sort columns
String[] sortColumns;
Expand Down

0 comments on commit 7195869

Please sign in to comment.