Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonLiTree committed Sep 18, 2023
1 parent e59ae96 commit 6e0bc3c
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,7 @@ public Expression visitFromUnixtime(FromUnixtime fromUnixtime, ExpressionRewrite
return fromUnixtime;
}

private Expression translateJavaFormatter(Expression function, int formatterIndex) {
Expression formatterExpr = function.getArgument(formatterIndex);
Expression newFormatterExpr = translateJavaFormatter(formatterExpr);
if (newFormatterExpr != formatterExpr) {
List<Expression> newArguments = Lists.newArrayList(function.getArguments());
newArguments.set(formatterIndex, newFormatterExpr);
return function.withChildren(newArguments);
}
return function;
}

@Override
public Expression visitUnixTimestamp(UnixTimestamp unixTimestamp, ExpressionRewriteContext context) {
Expression expr = super.visitUnixTimestamp(unixTimestamp, context);
if (!(expr instanceof UnixTimestamp)) {
Expand All @@ -83,6 +73,17 @@ public Expression visitUnixTimestamp(UnixTimestamp unixTimestamp, ExpressionRewr
return unixTimestamp;
}

private Expression translateJavaFormatter(Expression function, int formatterIndex) {
Expression formatterExpr = function.getArgument(formatterIndex);
Expression newFormatterExpr = translateJavaFormatter(formatterExpr);
if (newFormatterExpr != formatterExpr) {
List<Expression> newArguments = Lists.newArrayList(function.getArguments());
newArguments.set(formatterIndex, newFormatterExpr);
return function.withChildren(newArguments);
}
return function;
}

private Expression translateJavaFormatter(Expression formatterExpr) {
if (formatterExpr.isLiteral() && formatterExpr.getDataType().isStringLikeType()) {
Literal literal = (Literal) formatterExpr;
Expand Down

0 comments on commit 6e0bc3c

Please sign in to comment.