akashrn5 commented on a change in pull request #3541:
[CARBONDATA-3636]Timeseries query is not hitting datamap if granularity in
query is given case insensitive
URL: https://github.com/apache/carbondata/pull/3541#discussion_r373319253
##########
File path:
datamap/mv/core/src/main/scala/org/apache/carbondata/mv/rewrite/Utils.scala
##########
@@ -519,4 +521,73 @@ object Utils extends PredicateHelper {
}
}
+ /**
+ * Check's if timeseries udf function exists. If exists, compare literal
with case insensitive
+ * value
+ */
+ def isExpressionMatchesUDF(exp: Expression, exprList: Seq[Expression]):
Boolean = {
+ exp match {
+ case Alias(s: ScalaUDF, _) if
s.function.isInstanceOf[TimeSeriesFunction] =>
+ val children = s.children
+ val finalExpr = exprList.filter(a1 =>
+ a1.isInstanceOf[Alias] &&
a1.asInstanceOf[Alias].child.isInstanceOf[ScalaUDF] &&
+ a1.asInstanceOf[Alias].child.asInstanceOf[ScalaUDF].function.
+ isInstanceOf[TimeSeriesFunction])
+ finalExpr.exists(f => {
+ val finalExp =
f.asInstanceOf[Alias].child.asInstanceOf[ScalaUDF].children
+ finalExp.head.semanticEquals(children.head) &&
+ finalExp.last.asInstanceOf[Literal].toString().equalsIgnoreCase(
+ children.last.asInstanceOf[Literal].toString())
+ })
+ case s: ScalaUDF if s.function.isInstanceOf[TimeSeriesFunction] =>
+ val children = s.children
+ var expList: Seq[Expression] = Seq.empty
Review comment:
rename to more meaningful one, here `expList` and `exprList` are both
confusing
----------------------------------------------------------------
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