Uploaded image for project: 'CarbonData'
  1. CarbonData
  2. CARBONDATA-2533

MV Datamap - MV with Expression in the Aggregation is not fetching data from the MV datamap table.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • data-query
    • 3 Node Opensource ANT cluster.

    Description

      MV with Expression in the Aggregation is not fetching data from the MV datamap table. It is fetching the data from the main table. Please see the below explain query - table name for more details.

      Test queries from Spark -shell:

      scala> carbon.sql("create datamap MV_expr1 using 'MV' as select sum(case when deptno=11 and (utilization=92) then salary else 0 end) as t from fact_table1 group by empno").show(200,false)
      ++

      ++
      ++

      scala> carbon.sql("rebuild datamap MV_expr1").show(200,false)
      ++

      ++
      ++

      scala> carbon.sql("explain select sum(case when deptno=11 and (utilization=92) then salary else 0 end) as t from fact_table1 group by empno").show(200,false)
      ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      plan

      ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      == CarbonData Profiler ==
      Table Scan on fact_table1
      • total blocklets: 2
      • filter: none
      • pruned by Main DataMap
      • skipped blocklets: 0
      == Physical Plan ==
      *HashAggregate(keys=empno#252, functions=sum(cast(CASE WHEN ((deptno#258 = 11) && (utilization#264 = 92)) THEN salary#265 ELSE 0 END as bigint)))
      +- Exchange hashpartitioning(empno#252, 200)
      +- *HashAggregate(keys=empno#252, functions=partial_sum(cast(CASE WHEN ((deptno#258 = 11) && (utilization#264 = 92)) THEN salary#265 ELSE 0 END as bigint)))
      +- BatchedScan CarbonDatasourceHadoopRelation [ Database name :default, *Table name :fact_table1, Schema :Some(StructType(StructField(empno,IntegerType,true), StructField(empname,StringType,true), StructField(designation,StringType,true), StructField(doj,TimestampType,true), StructField(workgroupcategory,IntegerType,true), StructField(workgroupcategoryname,StringType,true), StructField(deptno,IntegerType,true), StructField(deptname,StringType,true), StructField(projectcode,IntegerType,true), StructField(projectjoindate,TimestampType,true), StructField(projectenddate,TimestampType,true), StructField(attendance,IntegerType,true), StructField(utilization,IntegerType,true), StructField(salary,IntegerType,true))) ] default.fact_table1empno#252,deptno#258,utilization#264,salary#265

      ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

       

       

       

      Attachments

        1. data_mv.csv
          8 kB
          Prasanna Ravichandran

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Prasanna Ravichandran Prasanna Ravichandran
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: