Skip to content
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

HHH-14146 Add Presto dialect #3496

Closed
wants to merge 1 commit into from
Closed

Conversation

findepi
Copy link
Contributor

@findepi findepi commented Aug 10, 2020

Add dialect for Presto (https://prestosql.io/)

@Sanne
Copy link
Member

Sanne commented Aug 11, 2020

Thanks! Great to see support for new modern databases being contributed.

We'll need to add Presto support to our continuous integration systems; my preference would be a container, as it helps us to diagnose issues locally - should we need to.
Would you suggest we use https://github.com/prestosql/presto/tree/master/docker ?

// DdlTransactionIsolatorNonJtaImpl works with Presto driver only in autocommit mode (hibernate.connection.autocommit=true)
// When this is set, DriverConnectionCreator will pass autocommit connection property which Presto
// driver does not accept. Here we remove the property as a workaround, it's being handled on the
// Hibernate's side.
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit concerned about this, could you expand on "it's being handled" ?

What are the implications of this, and what should users do when configuring a production connection pool and/or a Datasource configuration managed by an application server?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently the hibernate.connection.autocommit mode is needed (at least for DDL in tests).
AFAIU this setting controls Hibernate behavior and also is passed to JDBC driver in the form of autocommit connection property.
The connection property can be safely ignored (Hibernate uses JDBC APIs to control autocommit of a connection), but Presto JDBC driver does not ignore connection properties that it does not understand.

@findepi
Copy link
Contributor Author

findepi commented Aug 11, 2020

We'll need to add Presto support to our continuous integration systems; my preference would be a container, as it helps us to diagnose issues locally - should we need to.
Would you suggest we use https://github.com/prestosql/presto/tree/master/docker ?

@Sanne correct. You can bring up Presto container up with eg

docker run --rm --name presto -it -p 8080:8080 prestosql/presto:340

@findepi
Copy link
Contributor Author

findepi commented Aug 21, 2020

From tavis log:

org.hibernate.osgi.test.OsgiIntegrationTest > classMethod FAILED
    java.lang.RuntimeException at RemoteBundleContextClientImpl.java:261
        Caused by: java.rmi.NotBoundException at RegistryImpl.java:227

org.hibernate.osgi.test.OsgiIntegrationTest > executionError FAILED
    java.lang.RuntimeException at KarafTestContainer.java:628

2 tests completed, 2 failed

Can I safely assume these are not related?

@findepi
Copy link
Contributor Author

findepi commented Sep 25, 2020

Rebased.

@findepi
Copy link
Contributor Author

findepi commented Oct 3, 2020

The CI build is green.

@findepi
Copy link
Contributor Author

findepi commented Oct 29, 2020

@Sanne can i do anything to help move this forward?

@findepi
Copy link
Contributor Author

findepi commented Dec 11, 2020

@Sanne should i rebase?

@Sanne
Copy link
Member

Sanne commented Dec 11, 2020

hi @findepi ! Apologies, I've been overwhelmed by notifications and missed this completely.

Yes could you rebase it once again please? I'll see to find someone to setup the CI task on CI.

@findepi findepi force-pushed the presto branch 2 times, most recently from 93b8803 to 55c5f7a Compare December 11, 2020 16:26
@findepi
Copy link
Contributor Author

findepi commented Dec 11, 2020

Rebased.

There are some build failures, like

2020-12-11T16:19:18.4064992Z > Configure project :hibernate-agroal
2020-12-11T16:19:18.4133623Z Unable to decrypt Maven password using PlexusCipher
2020-12-11T16:19:18.4136325Z org.sonatype.plexus.components.cipher.PlexusCipherException: java.lang.ArrayIndexOutOfBoundsException
2020-12-11T16:19:18.4144129Z 	at org.sonatype.plexus.components.cipher.PBECipher.decrypt64(PBECipher.java:193)
2020-12-11T16:19:18.4147647Z 	at org.sonatype.plexus.components.cipher.DefaultPlexusCipher.decrypt(DefaultPlexusCipher.java:72)
2020-12-11T16:19:18.4151391Z 	at org.sonatype.plexus.components.cipher.DefaultPlexusCipher.decryptDecorated(DefaultPlexusCipher.java:86)
2020-12-11T16:19:18.4158323Z 	at org.hibernate.build.publish.auth.maven.pwd.DecryptionPasswordStrategy.decrypt(DecryptionPasswordStrategy.java:78)

@Sanne please help me understand what I am doing wrong.

@Sanne
Copy link
Member

Sanne commented Dec 11, 2020

Thanks! Don't worry for the CI job, these are new jobs which have just been added and we still need to sort out some details - sorry about that.

@Sanne
Copy link
Member

Sanne commented Dec 14, 2020

Hi @findepi , with CI having issues I tried to run tests locally - but it failed.

I used:

podman run --rm --name presto -it -p 8080:8080 prestosql/presto:340
./gradlew matrix_presto

Did you test it differently, or perhaps some more changes are needed?

@findepi
Copy link
Contributor Author

findepi commented Dec 14, 2020

I didn't run tests recently, only rebased, let me take a look.

@findepi
Copy link
Contributor Author

findepi commented Dec 14, 2020

@Sanne i remember now & sorry for the trouble.

Presto is not capable of housing a typical application, as it still lacks some features commonly seen in relational databases.
For example, if you run PaginationTest these are the limitations you would run into:

  • Presto allows declaring column to be NULL or NOT NULL, but the memory connector used for testing does not support that yet
  • Presto does not support defining indexes (primary keys, unique keys)

For these reasons the preparation part of the test (PaginationTest#prepareTestData) won't pass.

As such, you should not expect a typical Hibernate-based app to ever dream of moving to Presto, which is an analytical database.
Yet, some Presto users were asking about Hibernate support for Presto, supposedly to benefit from power of Presto in Java applications without need to write SQL by hand.

See PrestoDialectTest for some tests that i added to ensure the dialect actually works.

I also removed the hibernate-orm/databases/presto/matrix.gradle file, as i did not find a way to alter test data setup.

@bradhill99
Copy link

May I know the status of this PR? So there won't be Hibernate support for Presto?
Thanks.

@beikov
Copy link
Contributor

beikov commented Jul 19, 2021

As per https://hibernate.atlassian.net/browse/HHH-14693 and #3783 we decided not to include any dialects in 5.5 anymore for now and focus on 6.0.

IMO it would be fine to add it to 5.5 though if the Dialect for 6 qualifies for hibernate-core according to the requirements document: https://github.com/hibernate/hibernate-orm/blob/wip/6.0/dialects.adoc

@findepi
Copy link
Contributor Author

findepi commented Jul 19, 2021

@bradhill99 if i were to continue here, i would create a Trino dialect, as per https://trino.io/blog/2020/12/27/announcing-trino.html

@beikov i can reopen the PR (with new target module) if needed.
i closed this, because there was seemingly low interest from potential reviewers, so didn't want to waste your time.

@beikov
Copy link
Contributor

beikov commented Jul 19, 2021

You can reopen this PR against the main branch after a Dialect for 6.0 is merged according to the requirements for the hibernate-core inclusion.

@bradhill99
Copy link

@findepi Thanks for the reply. It will be great to have presto dialect for Hibernate.

@findepi
Copy link
Contributor Author

findepi commented Jul 20, 2021

after a Dialect for 6.0 is merged according to the requirements for the hibernate-core inclusion.

@beikov is there a PR i should follow?

@beikov
Copy link
Contributor

beikov commented Jul 20, 2021

What do you mean by follow? Adding new dialects is a community or vendor driven effort. We as Hibernate team explicitly do not want to bother with any new dialects anymore unless someone steps up and provides full support for that. Read the document about the process: https://github.com/hibernate/hibernate-orm/blob/wip/6.0/dialects.adoc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants