Skip to content

Commit

Permalink
[BugFix] Fix the NPE issue with cast filter condition querying the JD…
Browse files Browse the repository at this point in the history
…BC data source (#56306)

Signed-off-by: miomiocat <[email protected]>
(cherry picked from commit eabc473)
  • Loading branch information
miomiocat authored and mergify[bot] committed Feb 26, 2025
1 parent 2a280b8 commit 25517ff
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,11 @@ public String visitCastExpr(CastExpr node, Void context) {
if (isImplicit) {
return visit(node.getChild(0));
}
return "CAST(" + printWithParentheses(node.getChild(0)) + " AS " + node.getTargetTypeDef().toString() + ")";
if (node.getTargetTypeDef() == null) {
return "CAST(" + printWithParentheses(node.getChild(0)) + " AS " + node.getType().toString() + ")";
} else {
return "CAST(" + printWithParentheses(node.getChild(0)) + " AS " + node.getTargetTypeDef().toString() + ")";
}
}

public String visitCompoundPredicate(CompoundPredicate node, Void context) {
Expand Down

0 comments on commit 25517ff

Please sign in to comment.