-
Notifications
You must be signed in to change notification settings - Fork 3.6k
HHH-19506 Improve FirebirdDialect #10309
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?
Conversation
Wow, Firebird has a lot of features these days! |
hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FunctionTests.java
Show resolved
Hide resolved
Looking at the build failure now. |
Thanks for your pull request! This pull request appears to follow the contribution rules. › This message was automatically generated. |
Including changes to either ignore tests, or get tests running on Firebird
@gavinking I think I fixed the build failures, except the failures in the GraalVM 21 - oracle_atps, as I don't see how that could be related to my changes. |
No, the Oracle ATPS failures are surely unrelated to your change. |
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.
LGTM
Can this be merged, or is more needed (I see the Jenkins pipeline is waiting for some input?) |
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.
@mrotteveel thanks for the contribution, I trust you've tested your changes with Firebird and ensure they work as expected.
Before merging I have one note: usually, we don't make changes to hibernate-core
's test suite to account for community dialects. If we were to do that for all of them, the code would become riddled with custom logic / test skips for dialects that the Hibernate team doesn't know much about.
I see you've changed a lot of the core tests. While e.g. adding / changing skips from specific dialects to a DialectFeatureCheck
is totally fine, I would ask you avoid referencing FirebirdDialect
directly, and also try to avoid changing the test logic to account for specifics of a community dialect.
Not disagreeing with you Marco, but I just want to note that I think we should so some flexibility in this specific case because @mrotteveel really does put in a lot of work to keep the tests running on Firebird, which is not the case for most (all?) of the other community dialects. |
@mbellade I ran the tests, which is why I made those changes to account for differences. Most of the changes I made, I did in a way that makes it not dialect-specific (though in one or two cases I did assume SQL standard syntax for quoted identifiers). Some of the other changes I made, I made because some of the tests were brittle due to unclosed resources on failures (Firebird is unfortunately pretty sensitive when it comes to performing DDL if there is still a prepared statement using a table). I also made changes like this when making previous contributions to the Firebird dialect. The tests in hibernate-core already have references to the following community dialects: Firebird, Derby, Altibase, Informix, TiDB. I think that if you want maintenance of community dialects, you will need to have those things in your tests; otherwise testing is quite hard to do, because either I'd need to maintain my own fork or patches to reapply each and every time I want to work on the dialect, or I need to re-investigate each and every test failure when I do some work. You (as the Hibernate team) don't need to maintain things requiring or ignoring a community dialect: that will be the responsibility of the contributors helping with maintenance of those dialects. In any case, do you want me to remove the changes to the hibernate-core tests directly referencing the dialect? |
If you are generally improving tests, without adding logic for a specific community-dialect, I would ask you to create create a Jira for it (which briefly explains the reason you're proposing such changes) and apply the changes in in a separate PR or, at least, in specific commits unrelated to Firebird.
That's probably an artifact of when (some of) those dialects were not community.
But we do need to maintain the test suite, which might involve changing one of the tests that reference community dialects or which logic was changed to account for that and cause additional complexity on our side.
It is my opinion we should try to avoid that, yes, but if you feel that shouldn't be the case I would leave it up for discussion with the rest of the Hibernate team. Edit: @gavinking just giving my opinion, I don't see anything majorly concerning with these changes but if more and more community dialects were to do this test suite maintenance could become a problem. |
@mbellade Yes I understand the concern, just saying that I think Firebird is in a bit of a category by itself here. |
Well, in this case it's pretty much both: all the changes I made was to address test failures (some intermittent, some cascading to other tests) when running the tests against Firebird. I did try to do it in a non-dialect specific way.
Could be, though Altibase is a recent addition.
I understand that, but Require/Ignore dialect annotations are not involved with that, so referencing dialects there should - in my opinion - not be a problem for your maintenance The only real logic changes I made were in:
I also modified some base tests to put the session cleanup in a finally to ensure it runs, or to catch exceptions when closing multiple resources (sessions/factories) to prevent a failure to close one from closing others.
I think that this could be argued for the seven things I listed above. I did try and keep those changes not dialect specific, but I agree that (at least some of them) increase complexity. Are those specifically the things (or things like that) you have a problem with, or do you also have a problem with adding skips for a community dialect? Because I don't see how that adds to maintenance burden for you (if you're not sure, leave it in place, or just delete it, and the next time a community dialect maintainer works on the dialect, they'll recheck it themselves) |
@mrotteveel as I said, I'm not worried about improving test stability - that's great, it would be nice to be able to track it to a separate pr / commit. Usually, we discourage skips for community dialects, but I agree that's not the main issue. What concerns me most is changes to a tests logic (i.e. assertions, order of operations, sql syntax) that need to account for community dialect specific feature support. It's not like this PR fundamentally changes the core test suite, so I'm not strongly against merging it, I'm just trying to remind everyone of our usual community dialect practices. |
OK, understood. Thanks! |
For context @mrotteveel, we have in the past rejected a PR which wanted to add many skips for a brand-new community dialect. |
hibernate-core/src/test/java/org/hibernate/orm/test/records/MergeRecordEmbeddedIdTest.java
Outdated
Show resolved
Hide resolved
hibernate-core/src/test/java/org/hibernate/orm/test/records/RecordIdClassTest.java
Outdated
Show resolved
Hide resolved
(I committed a fix in Firebird to address this in upcoming releases)
I also removed one of my skips for Firebird, because I actually committed a fix to Firebird yesterday which will address the skip reason in supported Firebird versions. |
This PR improves the Firebird dialect:
TIME
generated astime(p)
insert
function supportrepeat
function supportsha
function (instead of SHA1) (Firebird 4+)hex
function support (Firebird 4+)generate_series
function support (emulated)getForShare
to returnwith lock
instead offor update
visitValuesTableReference
to emulate values tableIncludes changes to either ignore tests for Firebird, or get tests running on Firebird. Also improved robustness of some tests.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.
https://hibernate.atlassian.net/browse/HHH-19506