> MV query fails for table having same col name and table name and other issues
> -----------------------------------------------------------------------------
>
> Key: CARBONDATA-3444
> URL:
https://issues.apache.org/jira/browse/CARBONDATA-3444> Project: CarbonData
> Issue Type: Bug
> Reporter: Akash R Nilugal
> Priority: Major
> Time Spent: 9h 40m
> Remaining Estimate: 0h
>
> 1. MV creation fails for in join case for table having col name as table name
> 2. MV query fails for query with cast expression presnt as projection in ctas query with alias
> use below test cases to reproduce the issue
> test("test cast expression with mv") {
> sql("drop table IF EXISTS maintable")
> sql("create table maintable (m_month bigint, c_code string, " +
> "c_country smallint, d_dollar_value double, q_quantity double, u_unit smallint, b_country smallint, i_id int, y_year smallint) stored by 'carbondata'")
> sql("insert into maintable select 10, 'xxx', 123, 456, 45, 5, 23, 1, 2000")
> sql("drop datamap if exists da_cast")
> sql("create datamap da_cast using 'mv' as select cast(floor((m_month +1000) / 900) * 900 - 2000 AS INT) as a, c_code as abc,m_month from maintable")
> val df1 = sql(" select cast(floor((m_month +1000) / 900) * 900 - 2000 AS INT) as a ,c_code as abc from maintable")
> val df2 = sql(" select cast(floor((m_month +1000) / 900) * 900 - 2000 AS INT),c_code as abc from maintable")
> val analyzed1 = df1.queryExecution.analyzed
> assert(TestUtil.verifyMVDataMap(analyzed1, "da_cast"))
> }
> test("test mv query when the column names and table name same in join scenario") {
> sql("drop table IF EXISTS price")
> sql("drop table IF EXISTS quality")
> sql("create table price(product string,price int) stored by 'carbondata'")
> sql("create table quality(product string,quality string) stored by 'carbondata'")
> sql("create datamap same_mv using 'mv' as select price.product,price.price,quality.product,quality.quality from price,quality where price.product = quality.product")
> val df1 = sql("select price.product from price,quality where price.product = quality.product")
> val analyzed1 = df1.queryExecution.analyzed
> assert(TestUtil.verifyMVDataMap(analyzed1, "same_mv"))
> }