Skip to content

Commit

Permalink
Trino dialect, the extract function supports dow and week parameters
Browse files Browse the repository at this point in the history
Signed-off-by: zhiminr.ren <[email protected]>
  • Loading branch information
renzhimin7 committed Nov 12, 2024
1 parent 134f856 commit 21f42c0
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -998,14 +998,9 @@ protected ParseNode visitCoalesceExpression(CoalesceExpression node, ParseTreeCo

@Override
protected ParseNode visitExtract(Extract node, ParseTreeContext context) {
String fieldString = node.getField().toString();
if (fieldString.equalsIgnoreCase("dow")) {
fieldString = "dayofweek_iso";
} else if (fieldString.equalsIgnoreCase("week")) {
fieldString = "week_iso";
}
return new FunctionCallExpr(fieldString,
new FunctionParams(Lists.newArrayList((Expr) visit(node.getExpression(), context))));
String fieldString = node.getField().toString().toLowerCase();
return Trino2SRFunctionCallTransformer.convert(fieldString,
Lists.newArrayList((Expr) visit(node.getExpression(), context)));
}

@Override
Expand Down

0 comments on commit 21f42c0

Please sign in to comment.