Skip to content

Add support for Presto#881

Merged
mrigger merged 1 commit intosqlancer:mainfrom
axiomq:presto
Aug 30, 2023
Merged

Add support for Presto#881
mrigger merged 1 commit intosqlancer:mainfrom
axiomq:presto

Conversation

@branimir-vujicic
Copy link
Contributor

@branimir-vujicic branimir-vujicic commented Aug 22, 2023

This is the first Pull Request for Presto implementation.
The following oracles are currently completed:

  • NoRec oracle
  • TLP Where
  • TLP Aggregate (basic aggregate function)

Data types

The following data types are currently supported:
BOOLEAN, INT, FLOAT, DECIMAL, VARCHAR, CHAR, VARBINARY, JSON,
DATE, TIME, TIMESTAMP, TIME_WITH_TIME_ZONE,
TIMESTAMP_WITH_TIME_ZONE, INTERVAL_YEAR_TO_MONTH,
INTERVAL_DAY_TO_SECOND, ARRAY.
Others such as MAP, ROW, IPADDRESS, UID, IPPREFIX, HyperLogLog,
P4HyperLogLog, KHyperLogLog, QDigest and TDigest
will be supported in the future.

Functions

Large number of Presto supported are implemented,
but only small number are actually used in test.
Most of the functions will be supported in the future.

@mrigger
Copy link
Contributor

mrigger commented Aug 22, 2023

Thanks a lot for the PR! Given that it is quite large, do you think it would be possible to first integrate the changes to the common SQLancer classes, and then the Presto implementation?

@mrigger
Copy link
Contributor

mrigger commented Aug 22, 2023

I see that currently the formatting check is failing. You can use mvn formatter:format to format the files, and mvn verify -DskipTests=true to check for potential violations.

@branimir-vujicic branimir-vujicic marked this pull request as draft August 22, 2023 17:09
@branimir-vujicic
Copy link
Contributor Author

Hi,
thanks for the comment, I changed this PR to draft.
I'll extract common classes updates in different PR.

@branimir-vujicic
Copy link
Contributor Author

Created new PR with common classes updates:
Add support for Presto - common classes #884 #884

@branimir-vujicic branimir-vujicic marked this pull request as ready for review August 28, 2023 09:29
Copy link
Contributor

@mrigger mrigger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the PR. It's great to see how mature the Presto SQLancer implementation already is! I've added minor various suggestions. None of the suggestions is very important, so I'd be happy to merge the PR after you think you addressed those that make sense.

// TODO: check
errors.add("io.airlift.slice.Slice cannot be cast to java.lang.Number");
errors.add("Cannot cast java.lang.Long to io.airlift.slice.Slice");
errors.add("Unexpected subquery expression in logical plan");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like an internal error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some errors that occur in certain versions of Presto.
Some of them are analyzed by the Presto team and they will not be addressed in the near future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private final JsonValueType jvt;
private final String val;

public PrestoJsonConstant() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps an opportunity for a future PR could be to add a JSON implementation to Randomly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we could implement fully random JSON generator

if (returnType.getPrimitiveDataType() == PrestoSchema.PrestoDataType.ARRAY) {
savedArrayType = returnType;
}
if (getNumberOfArguments() == -1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code here looks quite similar to the one in PrestoDefaultFunction. Could we extract them to a common method? Also see my comments there (e.g., with respect to -1).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PrestoDefaultFunction will be removed in the next PR.

This is the first Pull Request for [Presto](https://prestodb.io/) implementation.
The following oracles are currently completed:
 * NoRec oracle
 * TLP Where
 * TLP Aggregate (basic aggregate function)

## Data types
The following data types are currently supported:
BOOLEAN, INT, FLOAT, DECIMAL, VARCHAR, CHAR, VARBINARY, JSON, DATE, TIME,
TIMESTAMP, TIME_WITH_TIME_ZONE, TIMESTAMP_WITH_TIME_ZONE,
INTERVAL_YEAR_TO_MONTH, INTERVAL_DAY_TO_SECOND, ARRAY.
Others such as MAP, ROW, IPADDRESS, UID, IPPREFIX, HyperLogLog,
P4HyperLogLog, KHyperLogLog, QDigest and TDigest will be
supported in the future.

## Functions

Large number of Presto supported are implemented, but only small number
are actually used in test. Most of the functions will be supported in
the future.
Copy link
Contributor

@mrigger mrigger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, based on my perspective, the PR is ready to be merged. @branimir-vujicic, I assume this is fine, or did you still plan on any additional changes as part of this PR?

@branimir-vujicic
Copy link
Contributor Author

Thank you @mrigger,
It's OK to merge this PR. I'll add more features in future PRs.

@mrigger mrigger merged commit 7804a3a into sqlancer:main Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants