Skip to content

Commit e1cad54

Browse files
committed
HHH-19361 Move TiDB to hibernate-community-dialects and stop regular testing
1 parent b7a7555 commit e1cad54

File tree

33 files changed

+72
-58
lines changed

33 files changed

+72
-58
lines changed

Jenkinsfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ stage('Configure') {
4040
// Don't build with HANA by default, but only do it nightly until we receive a 3rd instance
4141
// new BuildEnvironment( dbName: 'hana_cloud', dbLockableResource: 'hana-cloud', dbLockResourceAsHost: true ),
4242
new BuildEnvironment( node: 's390x' ),
43-
new BuildEnvironment( dbName: 'tidb', node: 'tidb',
44-
notificationRecipients: '[email protected]' ),
4543
// We want to enable preview features when testing newer builds of OpenJDK:
4644
// even if we don't use these features, just enabling them can cause side effects
4745
// and it's useful to test that.
@@ -65,6 +63,9 @@ stage('Configure') {
6563
if ( pullRequest.labels.contains( 'sybase' ) ) {
6664
this.environments.add( new BuildEnvironment( dbName: 'sybase_jconn' ) )
6765
}
66+
if ( pullRequest.labels.contains( 'tidb' ) ) {
67+
this.environments.add( new BuildEnvironment( dbName: 'tidb', node: 'tidb', notificationRecipients: '[email protected]' ) )
68+
}
6869
}
6970

7071
helper.configure {

hibernate-agroal/src/test/java/org/hibernate/test/agroal/AgroalTransactionIsolationConfigTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
package org.hibernate.test.agroal;
66

77
import org.hibernate.community.dialect.AltibaseDialect;
8-
import org.hibernate.dialect.TiDBDialect;
8+
import org.hibernate.community.dialect.TiDBDialect;
99
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
1010
import org.hibernate.agroal.internal.AgroalConnectionProvider;
1111

hibernate-c3p0/src/test/java/org/hibernate/test/c3p0/C3p0TransactionIsolationConfigTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import org.hibernate.c3p0.internal.C3P0ConnectionProvider;
1010
import org.hibernate.community.dialect.AltibaseDialect;
1111
import org.hibernate.dialect.SybaseASEDialect;
12-
import org.hibernate.dialect.TiDBDialect;
12+
import org.hibernate.community.dialect.TiDBDialect;
1313
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
1414
import org.hibernate.service.spi.ServiceRegistryImplementor;
1515

hibernate-core/src/main/java/org/hibernate/dialect/TiDBDialect.java renamed to hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TiDBDialect.java

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
22
* SPDX-License-Identifier: Apache-2.0
33
* Copyright Red Hat Inc. and Hibernate Authors
44
*/
5-
package org.hibernate.dialect;
5+
package org.hibernate.community.dialect;
66

77
import org.hibernate.LockOptions;
8+
import org.hibernate.dialect.DatabaseVersion;
9+
import org.hibernate.dialect.Dialect;
10+
import org.hibernate.dialect.FunctionalDependencyAnalysisSupport;
11+
import org.hibernate.dialect.FunctionalDependencyAnalysisSupportImpl;
12+
import org.hibernate.dialect.MySQLDialect;
13+
import org.hibernate.dialect.MySQLServerConfiguration;
814
import org.hibernate.dialect.aggregate.AggregateSupport;
915
import org.hibernate.dialect.aggregate.MySQLAggregateSupport;
1016
import org.hibernate.dialect.sequence.SequenceSupport;
11-
import org.hibernate.dialect.sequence.TiDBSequenceSupport;
17+
import org.hibernate.community.dialect.sequence.TiDBSequenceSupport;
1218
import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
1319
import org.hibernate.engine.spi.SessionFactoryImplementor;
1420
import org.hibernate.query.sqm.IntervalType;
@@ -18,7 +24,7 @@
1824
import org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory;
1925
import org.hibernate.sql.ast.tree.Statement;
2026
import org.hibernate.sql.exec.spi.JdbcOperation;
21-
import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorTiDBDatabaseImpl;
27+
import org.hibernate.community.dialect.sequence.SequenceInformationExtractorTiDBDatabaseImpl;
2228
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
2329

2430
import jakarta.persistence.TemporalType;
@@ -43,7 +49,7 @@ public TiDBDialect(DatabaseVersion version) {
4349
}
4450

4551
public TiDBDialect(DialectResolutionInfo info) {
46-
super( createVersion( info ), MySQLServerConfiguration.fromDialectResolutionInfo( info ) );
52+
super( createVersion( info, MINIMUM_VERSION ), MySQLServerConfiguration.fromDialectResolutionInfo( info ) );
4753
registerKeywords( info );
4854
}
4955

@@ -62,19 +68,19 @@ protected DatabaseVersion getMinimumSupportedVersion() {
6268
protected void registerDefaultKeywords() {
6369
super.registerDefaultKeywords();
6470
// TiDB implemented 'Window Functions' of MySQL 8, so the following keywords are reserved.
65-
registerKeyword("CUME_DIST");
66-
registerKeyword("DENSE_RANK");
67-
registerKeyword("EXCEPT");
68-
registerKeyword("FIRST_VALUE");
69-
registerKeyword("GROUPS");
70-
registerKeyword("LAG");
71-
registerKeyword("LAST_VALUE");
72-
registerKeyword("LEAD");
73-
registerKeyword("NTH_VALUE");
74-
registerKeyword("NTILE");
75-
registerKeyword("PERCENT_RANK");
76-
registerKeyword("RANK");
77-
registerKeyword("ROW_NUMBER");
71+
registerKeyword( "CUME_DIST" );
72+
registerKeyword( "DENSE_RANK" );
73+
registerKeyword( "EXCEPT" );
74+
registerKeyword( "FIRST_VALUE" );
75+
registerKeyword( "GROUPS" );
76+
registerKeyword( "LAG" );
77+
registerKeyword( "LAST_VALUE" );
78+
registerKeyword( "LEAD" );
79+
registerKeyword( "NTH_VALUE" );
80+
registerKeyword( "NTILE" );
81+
registerKeyword( "PERCENT_RANK" );
82+
registerKeyword( "RANK" );
83+
registerKeyword( "ROW_NUMBER" );
7884
}
7985

8086
@Override
@@ -134,12 +140,12 @@ public boolean supportsWait() {
134140
}
135141

136142
@Override
137-
boolean supportsForShare() {
143+
protected boolean supportsForShare() {
138144
return false;
139145
}
140146

141147
@Override
142-
boolean supportsAliasLocks() {
148+
protected boolean supportsAliasLocks() {
143149
return false;
144150
}
145151

@@ -192,12 +198,13 @@ public FunctionalDependencyAnalysisSupport getFunctionalDependencyAnalysisSuppor
192198
return FunctionalDependencyAnalysisSupportImpl.TABLE_REFERENCE;
193199
}
194200

195-
@Override @SuppressWarnings("deprecation")
201+
@Override
202+
@SuppressWarnings("deprecation")
196203
public String timestampaddPattern(TemporalUnit unit, TemporalType temporalType, IntervalType intervalType) {
197204
// TiDB doesn't natively support adding fractional seconds
198205
return unit == TemporalUnit.SECOND && intervalType == null
199206
? "timestampadd(microsecond,?2*1e6,?3)"
200-
: super.timestampaddPattern(unit, temporalType, intervalType);
207+
: super.timestampaddPattern( unit, temporalType, intervalType );
201208
}
202209

203210
@Override

hibernate-core/src/main/java/org/hibernate/dialect/TiDBSqlAstTranslator.java renamed to hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TiDBSqlAstTranslator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
* SPDX-License-Identifier: Apache-2.0
33
* Copyright Red Hat Inc. and Hibernate Authors
44
*/
5-
package org.hibernate.dialect;
5+
package org.hibernate.community.dialect;
66

77
import java.util.ArrayList;
88
import java.util.List;
99

1010
import org.hibernate.LockOptions;
11+
import org.hibernate.dialect.DmlTargetColumnQualifierSupport;
12+
import org.hibernate.dialect.MySQLSqlAstTranslator;
1113
import org.hibernate.engine.spi.SessionFactoryImplementor;
1214
import org.hibernate.internal.util.collections.Stack;
1315
import org.hibernate.query.sqm.ComparisonOperator;
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
* SPDX-License-Identifier: Apache-2.0
33
* Copyright Red Hat Inc. and Hibernate Authors
44
*/
5-
package org.hibernate.tool.schema.extract.internal;
5+
package org.hibernate.community.dialect.sequence;
66

77
import org.hibernate.boot.model.relational.QualifiedSequenceName;
88
import org.hibernate.engine.jdbc.env.spi.IdentifierHelper;
9+
import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorLegacyImpl;
10+
import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorNoOpImpl;
11+
import org.hibernate.tool.schema.extract.internal.SequenceInformationImpl;
912
import org.hibernate.tool.schema.extract.spi.ExtractionContext;
1013
import org.hibernate.tool.schema.extract.spi.SequenceInformation;
1114

hibernate-core/src/main/java/org/hibernate/dialect/sequence/TiDBSequenceSupport.java renamed to hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/sequence/TiDBSequenceSupport.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
* SPDX-License-Identifier: Apache-2.0
33
* Copyright Red Hat Inc. and Hibernate Authors
44
*/
5-
package org.hibernate.dialect.sequence;
5+
package org.hibernate.community.dialect.sequence;
66

77
import org.hibernate.MappingException;
8+
import org.hibernate.community.dialect.TiDBDialect;
9+
import org.hibernate.dialect.sequence.SequenceSupport;
810

911
/**
10-
* Sequence support for {@link org.hibernate.dialect.TiDBDialect}.
12+
* Sequence support for {@link TiDBDialect}.
1113
*
1214
* @author Cong Wang
1315
*/

hibernate-core/src/main/java/org/hibernate/dialect/MariaDBDialect.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,13 @@ public boolean supportsWait() {
286286
}
287287

288288
@Override
289-
boolean supportsForShare() {
289+
protected boolean supportsForShare() {
290290
//only supported on MySQL
291291
return false;
292292
}
293293

294294
@Override
295-
boolean supportsAliasLocks() {
295+
protected boolean supportsAliasLocks() {
296296
//only supported on MySQL
297297
return false;
298298
}

hibernate-core/src/main/java/org/hibernate/dialect/MySQLDialect.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,11 +1550,11 @@ protected void registerDefaultKeywords() {
15501550
registerKeyword( "key" );
15511551
}
15521552

1553-
boolean supportsForShare() {
1553+
protected boolean supportsForShare() {
15541554
return true;
15551555
}
15561556

1557-
boolean supportsAliasLocks() {
1557+
protected boolean supportsAliasLocks() {
15581558
return true;
15591559
}
15601560

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/collate/MySQLCollateTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import jakarta.persistence.Id;
1212
import org.hibernate.annotations.Collate;
1313
import org.hibernate.dialect.MySQLDialect;
14-
import org.hibernate.dialect.TiDBDialect;
14+
import org.hibernate.community.dialect.TiDBDialect;
1515
import org.hibernate.testing.orm.junit.DomainModel;
1616
import org.hibernate.testing.orm.junit.RequiresDialect;
1717
import org.hibernate.testing.orm.junit.SessionFactory;

0 commit comments

Comments
 (0)