Skip to content

Commit

Permalink
Remove redundant constructors from Extract
Browse files Browse the repository at this point in the history
  • Loading branch information
ebyhr authored and wendigo committed Sep 15, 2024
1 parent 17d20bf commit 57ec0d2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ protected Expression visitExtract(Extract node, Context<C> context)
Expression expression = rewrite(node.getExpression(), context.get());

if (node.getExpression() != expression) {
return new Extract(expression, node.getField());
return new Extract(node.getLocation().orElseThrow(), expression, node.getField());
}

return node;
Expand Down
12 changes: 1 addition & 11 deletions core/trino-parser/src/main/java/io/trino/sql/tree/Extract.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,9 @@ public enum Field
TIMEZONE_HOUR
}

public Extract(Expression expression, Field field)
{
this(Optional.empty(), expression, field);
}

public Extract(NodeLocation location, Expression expression, Field field)
{
this(Optional.of(location), expression, field);
}

private Extract(Optional<NodeLocation> location, Expression expression, Field field)
{
super(location);
super(Optional.of(location));
requireNonNull(expression, "expression is null");
requireNonNull(field, "field is null");

Expand Down

0 comments on commit 57ec0d2

Please sign in to comment.