-
Notifications
You must be signed in to change notification settings - Fork 388
Support CODDTest for DuckDB #1224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1e55cb1
8d308f6
5233a4a
82813cb
d919ce9
980bb3f
3d0c1e8
ce735d8
9de0d28
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| package sqlancer.common.ast.newast; | ||
|
|
||
| public class NewExistsNode<T> { | ||
| private final T expr; | ||
| private final Boolean isNot; | ||
|
|
||
| public NewExistsNode(T expr, Boolean isNot) { | ||
| this.expr = expr; | ||
| this.isNot = isNot; | ||
| } | ||
|
|
||
| public T getExpr() { | ||
| return expr; | ||
| } | ||
|
|
||
| public Boolean getIsNot() { | ||
| return isNot; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package sqlancer.common.ast.newast; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public class NewValuesNode<T> { | ||
| private final List<T> valuesList; | ||
|
|
||
| public NewValuesNode(List<T> valuesList) { | ||
| this.valuesList = valuesList; | ||
| } | ||
|
|
||
| public List<T> getValues() { | ||
| return this.valuesList; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package sqlancer.common.ast.newast; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public class NewWithNode<T> { | ||
| private final T leftExpr; | ||
| private final List<T> rightExpr; | ||
|
|
||
| public NewWithNode(T leftExpr, List<T> rightExpr) { | ||
| this.leftExpr = leftExpr; | ||
| this.rightExpr = rightExpr; | ||
| } | ||
|
|
||
| public T getLeftExpr() { | ||
| return this.leftExpr; | ||
| } | ||
|
|
||
| public List<T> getRightExpr() { | ||
| return this.rightExpr; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,6 +77,25 @@ public class DuckDBOptions implements DBMSSpecificOptions<DuckDBOracleFactory> { | |
| @Parameter(names = "--max-num-updates", description = "The maximum number of UPDATE statements that are issued for a database", arity = 1) | ||
| public int maxNumUpdates = 5; | ||
|
|
||
| public enum CODDTestModel { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is the same for all CODDTest implementations, perhaps we could extract this to a common enum with the next PR? |
||
| RANDOM, EXPRESSION, SUBQUERY; | ||
|
|
||
| public boolean isRandom() { | ||
| return this == RANDOM; | ||
| } | ||
|
|
||
| public boolean isExpression() { | ||
| return this == EXPRESSION; | ||
| } | ||
|
|
||
| public boolean isSubquery() { | ||
| return this == SUBQUERY; | ||
| } | ||
| } | ||
|
|
||
| @Parameter(names = { "--coddtest-model" }, description = "Apply CODDTest on EXPRESSION, SUBQUERY, or RANDOM") | ||
| public CODDTestModel coddTestModel = CODDTestModel.RANDOM; | ||
|
|
||
| @Parameter(names = "--oracle") | ||
| public List<DuckDBOracleFactory> oracles = Arrays.asList(DuckDBOracleFactory.QUERY_PARTITIONING); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,9 +41,19 @@ public static class DuckDBCompositeDataType { | |
|
|
||
| private final int size; | ||
|
|
||
| // This is used to handle the type that out of the scope of our code | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I don't understand the comment and use of this. Could we perhaps explain or give an example? |
||
| private final String typeName; | ||
|
|
||
| public DuckDBCompositeDataType(DuckDBDataType dataType, int size) { | ||
| this.dataType = dataType; | ||
| this.size = size; | ||
| this.typeName = ""; | ||
| } | ||
|
|
||
| public DuckDBCompositeDataType(String typeName) { | ||
| this.dataType = null; | ||
| this.size = 0; | ||
| this.typeName = typeName; | ||
| } | ||
|
|
||
| public DuckDBDataType getPrimitiveDataType() { | ||
|
|
@@ -82,6 +92,9 @@ public static DuckDBCompositeDataType getRandomWithoutNull() { | |
|
|
||
| @Override | ||
| public String toString() { | ||
| if (getPrimitiveDataType() == null) { | ||
| return this.typeName; | ||
| } | ||
| switch (getPrimitiveDataType()) { | ||
| case INT: | ||
| switch (size) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we can remove these commented-out messages?