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

Commit

Permalink
[NSE-1023] [NSE-1046] Cover more supported expressions in getting Att…
Browse files Browse the repository at this point in the history
…ributeReference (#1041)

* Initial commit

* Consider leaf expression

* Revert some changes and support to get attr for conv/lpad

* Remove the handling for MakeTimestamp
  • Loading branch information
PHILO-HE authored Jul 29, 2022
1 parent 2479200 commit c288195
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,23 @@ object ConverterUtils extends Logging {
getAttrFromExpr(u.child)
case ss: Substring =>
getAttrFromExpr(ss.children(0))
case strTrim: StringTrim =>
getAttrFromExpr(strTrim.children(0))
case and: And =>
getAttrFromExpr(and.children(0))
case caseWhen: CaseWhen =>
getAttrFromExpr(caseWhen.children(0))
case greaterThanOrEqual: GreaterThanOrEqual =>
getAttrFromExpr(greaterThanOrEqual.children(0))
case conv: Conv =>
getAttrFromExpr(conv.children(0))
case lpad: StringLPad =>
getAttrFromExpr(lpad.children(0))
case unaryExpr: UnaryExpression =>
getAttrFromExpr(unaryExpr.child)
// For leaf expression like CurrentTimestamp, CurrentDate, Now.
case leafExpr: LeafExpression =>
new AttributeReference(leafExpr.prettyName, leafExpr.dataType, leafExpr.nullable)()
case other =>
throw new UnsupportedOperationException(
s"makeStructField is unable to parse from $other (${other.getClass}).")
Expand Down

0 comments on commit c288195

Please sign in to comment.