jackylk commented on a change in pull request #3517: [CARBONDATA-3624] Support
creating MV datamap without giving filter columns in projection and bug fixes
URL: https://github.com/apache/carbondata/pull/3517#discussion_r360390631
##########
File path:
datamap/mv/core/src/test/scala/org/apache/carbondata/mv/rewrite/MVCreateTestCase.scala
##########
@@ -1345,7 +1346,31 @@ class MVCreateTestCase extends QueryTest with
BeforeAndAfterAll {
FileFactory.deleteAllFilesOfDir(new File(newPath))
}
-
+ test("test join query with & without filter columns in projection") {
+ sql("drop table if exists t1")
+ sql("drop table if exists t2")
+ sql("drop datamap if exists mv1")
+ sql("drop datamap if exists mv2")
+ sql("create table t1(userId string,score int) stored by 'carbondata'")
+ sql("create table t2(userId string,age int,sex string) stored by
'carbondata'")
+ sql("insert into t1 values(1,100),(2,500)")
+ sql("insert into t2 values(1,20,'f'),(2,30,'m')")
+ var result = sql("select avg(t1.score),t2.age,t2.sex from t1 join t2 on
t1.userId=t2.userId group by t2.age,t2.sex")
+ sql("create datamap mv1 using 'mv' as select avg(t1.score),t2.age,t2.sex
from t1 join t2 on t1.userId=t2.userId group by t2.age,t2.sex")
+ var df = sql("select avg(t1.score),t2.age,t2.sex from t1 join t2 on
t1.userId=t2.userId group by t2.age,t2.sex")
+ TestUtil.verifyMVDataMap(df.queryExecution.analyzed, "mv1")
+ checkAnswer(df, result)
+ intercept[ProcessMetaDataException] {
+ sql("alter table t1 drop columns(userId)")
+ }.getMessage.contains("Column name cannot be dropped because it exists in
mv datamap: mv1")
+ sql("drop datamap if exists mv1")
+ sql("create datamap mv2 using 'mv' as select
avg(t1.score),t2.age,t2.sex,sum(t1.userId),sum(t2.userId) from t1 join t2 on
t1.userId=t2.userId group by t2.age,t2.sex")
Review comment:
`sum(t1.userId),sum(t2.userId)` is strange, can you remove them
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services