Skip to content

Commit

Permalink
Fix substring issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ravipesala committed Jul 23, 2018
1 parent 4014b0f commit 814f4a2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Expand Up @@ -119,7 +119,12 @@ object MVHelper {
}

def updateColumnName(attr: Attribute): String = {
val name = attr.name.replace("(", "_").replace(")", "").replace(" ", "_").replace("=", "")
val name =
attr.name.replace("(", "_")
.replace(")", "")
.replace(" ", "_")
.replace("=", "")
.replace(",", "")
attr.qualifier.map(qualifier => qualifier + "_" + name).getOrElse(name)
}

Expand Down
Expand Up @@ -750,6 +750,18 @@ class MVCreateTestCase extends QueryTest with BeforeAndAfterAll {
sql("drop table if exists test1")
}

test("jira carbondata-2534") {

sql("drop datamap if exists MV_exp")
sql("create datamap MV_exp using 'mv' as select sum(salary),substring(empname,2,5),designation from fact_table1 group by substring(empname,2,5),designation")
sql("rebuild datamap MV_exp")
val frame = sql(
"select sum(salary),substring(empname,2,5),designation from fact_table1 group by substring(empname,2,5),designation")
val analyzed = frame.queryExecution.analyzed
assert(verifyMVDataMap(analyzed, "MV_exp"))
sql("drop datamap if exists MV_exp")
}

def verifyMVDataMap(logicalPlan: LogicalPlan, dataMapName: String): Boolean = {
val tables = logicalPlan collect {
case l: LogicalRelation => l.catalogTable.get
Expand Down

0 comments on commit 814f4a2

Please sign in to comment.