-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement skyline syntax (preferring clause)
- Loading branch information
Stefan Steinhauser
committed
Sep 13, 2024
1 parent
60f4d74
commit c2f3305
Showing
23 changed files
with
691 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/net/sf/jsqlparser/expression/HighExpression.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/*- | ||
* #%L | ||
* JSQLParser library | ||
* %% | ||
* Copyright (C) 2004 - 2019 JSQLParser | ||
* %% | ||
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0 | ||
* #L% | ||
*/ | ||
package net.sf.jsqlparser.expression; | ||
|
||
import net.sf.jsqlparser.parser.ASTNodeAccessImpl; | ||
|
||
public class HighExpression extends ASTNodeAccessImpl implements Expression { | ||
private Expression expression; | ||
|
||
public HighExpression() { | ||
// empty constructor | ||
} | ||
|
||
public HighExpression(Expression expression) { | ||
this.expression = expression; | ||
} | ||
|
||
@Override | ||
public <T, S> T accept(ExpressionVisitor<T> expressionVisitor, S context) { | ||
return expressionVisitor.visit(this, context); | ||
} | ||
|
||
public Expression getExpression() { | ||
return expression; | ||
} | ||
|
||
public void setExpression(Expression expression) { | ||
this.expression = expression; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "HIGH " + expression.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/*- | ||
* #%L | ||
* JSQLParser library | ||
* %% | ||
* Copyright (C) 2004 - 2019 JSQLParser | ||
* %% | ||
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0 | ||
* #L% | ||
*/ | ||
package net.sf.jsqlparser.expression; | ||
|
||
import net.sf.jsqlparser.parser.ASTNodeAccessImpl; | ||
|
||
public class Inverse extends ASTNodeAccessImpl implements Expression { | ||
private Expression expression; | ||
|
||
public Inverse() { | ||
// empty constructor | ||
} | ||
|
||
public Inverse(Expression expression) { | ||
this.expression = expression; | ||
} | ||
|
||
@Override | ||
public <T, S> T accept(ExpressionVisitor<T> expressionVisitor, S context) { | ||
return expressionVisitor.visit(this, context); | ||
} | ||
|
||
public Expression getExpression() { | ||
return expression; | ||
} | ||
|
||
public void setExpression(Expression expression) { | ||
this.expression = expression; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "INVERSE (" + expression.toString() + ")"; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/net/sf/jsqlparser/expression/LowExpression.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/*- | ||
* #%L | ||
* JSQLParser library | ||
* %% | ||
* Copyright (C) 2004 - 2019 JSQLParser | ||
* %% | ||
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0 | ||
* #L% | ||
*/ | ||
package net.sf.jsqlparser.expression; | ||
|
||
import net.sf.jsqlparser.parser.ASTNodeAccessImpl; | ||
|
||
public class LowExpression extends ASTNodeAccessImpl implements Expression { | ||
private Expression expression; | ||
|
||
public LowExpression() { | ||
// empty constructor | ||
} | ||
|
||
public LowExpression(Expression expression) { | ||
this.expression = expression; | ||
} | ||
|
||
@Override | ||
public <T, S> T accept(ExpressionVisitor<T> expressionVisitor, S context) { | ||
return expressionVisitor.visit(this, context); | ||
} | ||
|
||
public Expression getExpression() { | ||
return expression; | ||
} | ||
|
||
public void setExpression(Expression expression) { | ||
this.expression = expression; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "LOW " + expression.toString(); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/net/sf/jsqlparser/expression/PreferringClause.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/*- | ||
* #%L | ||
* JSQLParser library | ||
* %% | ||
* Copyright (C) 2004 - 2019 JSQLParser | ||
* %% | ||
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0 | ||
* #L% | ||
*/ | ||
package net.sf.jsqlparser.expression; | ||
|
||
import net.sf.jsqlparser.expression.operators.relational.ExpressionList; | ||
|
||
import java.io.Serializable; | ||
|
||
public class PreferringClause implements Serializable { | ||
private Expression preferring; | ||
private PartitionByClause partitionBy; | ||
|
||
public PreferringClause(Expression preferring) { | ||
this.preferring = preferring; | ||
} | ||
|
||
public void setPartitionExpressionList(ExpressionList expressionList, | ||
boolean brackets) { | ||
if (this.partitionBy == null) { | ||
this.partitionBy = new PartitionByClause(); | ||
} | ||
partitionBy.setPartitionExpressionList(expressionList, brackets); | ||
} | ||
|
||
public void toStringPreferring(StringBuilder b) { | ||
b.append("PREFERRING "); | ||
b.append(preferring.toString()); | ||
|
||
if (partitionBy != null) { | ||
b.append(" "); | ||
partitionBy.toStringPartitionBy(b); | ||
} | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder sb = new StringBuilder(); | ||
toStringPreferring(sb); | ||
return sb.toString(); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/net/sf/jsqlparser/expression/operators/relational/Plus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/*- | ||
* #%L | ||
* JSQLParser library | ||
* %% | ||
* Copyright (C) 2004 - 2019 JSQLParser | ||
* %% | ||
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0 | ||
* #L% | ||
*/ | ||
package net.sf.jsqlparser.expression.operators.relational; | ||
|
||
import net.sf.jsqlparser.expression.BinaryExpression; | ||
import net.sf.jsqlparser.expression.Expression; | ||
import net.sf.jsqlparser.expression.ExpressionVisitor; | ||
|
||
public class Plus extends BinaryExpression { | ||
public Plus(Expression leftExpression, Expression rightExpression) { | ||
super(leftExpression, rightExpression); | ||
} | ||
|
||
@Override | ||
public String getStringExpression() { | ||
return "PLUS"; | ||
} | ||
|
||
@Override | ||
public <T, S> T accept(ExpressionVisitor<T> expressionVisitor, S context) { | ||
return expressionVisitor.visit(this, context); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/net/sf/jsqlparser/expression/operators/relational/PriorTo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/*- | ||
* #%L | ||
* JSQLParser library | ||
* %% | ||
* Copyright (C) 2004 - 2019 JSQLParser | ||
* %% | ||
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0 | ||
* #L% | ||
*/ | ||
package net.sf.jsqlparser.expression.operators.relational; | ||
|
||
import net.sf.jsqlparser.expression.BinaryExpression; | ||
import net.sf.jsqlparser.expression.Expression; | ||
import net.sf.jsqlparser.expression.ExpressionVisitor; | ||
|
||
public class PriorTo extends BinaryExpression { | ||
public PriorTo(Expression leftExpression, Expression rightExpression) { | ||
super(leftExpression, rightExpression); | ||
} | ||
|
||
@Override | ||
public String getStringExpression() { | ||
return "PRIOR TO"; | ||
} | ||
|
||
@Override | ||
public <T, S> T accept(ExpressionVisitor<T> expressionVisitor, S context) { | ||
return expressionVisitor.visit(this, context); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.