Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
[followup] support substring_index (#898)
Browse files Browse the repository at this point in the history
This patch adds the missing columnar expression replacement for substring_index
  • Loading branch information
jackylee-ch authored May 9, 2022
1 parent 3b4ce7e commit d8ce978
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,23 @@ object ColumnarExpressionConverter extends Logging {
attributeSeq,
convertBoundRefToAttrRef = convertBoundRefToAttrRef),
expr)
case ssi: SubstringIndex =>
check_if_no_calculation = false
logInfo(s"${expr.getClass} ${expr} is supported, no_cal is $check_if_no_calculation.")
ColumnarTernaryOperator.create(
replaceWithColumnarExpression(
ssi.strExpr,
attributeSeq,
convertBoundRefToAttrRef = convertBoundRefToAttrRef),
replaceWithColumnarExpression(
ssi.delimExpr,
attributeSeq,
convertBoundRefToAttrRef = convertBoundRefToAttrRef),
replaceWithColumnarExpression(
ssi.countExpr,
attributeSeq,
convertBoundRefToAttrRef = convertBoundRefToAttrRef),
expr)
case sr: StringRegexExpression =>
check_if_no_calculation = false
logInfo(s"${expr.getClass} ${expr} is supported, no_cal is $check_if_no_calculation.")
Expand Down Expand Up @@ -437,7 +454,7 @@ object ColumnarExpressionConverter extends Logging {
case regexp: RegExpReplace =>
containsSubquery(regexp.subject) || containsSubquery(
regexp.regexp) || containsSubquery(regexp.rep) || containsSubquery(regexp.pos)
case substrIndex: ColumnarSubstringIndex =>
case substrIndex: SubstringIndex =>
substrIndex.children.map(containsSubquery).exists(_ == true)
case sr: StringReplace =>
containsSubquery(sr.srcExpr) ||
Expand Down

0 comments on commit d8ce978

Please sign in to comment.