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

[NSE-1023] [NSE-1046] Cover more supported expressions in getting AttributeReference #1041

Merged
merged 4 commits into from
Jul 29, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,25 @@ object ConverterUtils extends Logging {
getAttrFromExpr(u.child)
case ss: Substring =>
getAttrFromExpr(ss.children(0))
case strTrim: StringTrim =>
getAttrFromExpr(strTrim.children(0))
case makeTimestamp: MakeTimestamp =>
getAttrFromExpr(makeTimestamp.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 =>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hex is covered here.

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