Skip to content

Commit 3709178

Browse files
committed
HHH-19705 Add vector support for DB2
1 parent 9a15034 commit 3709178

File tree

71 files changed

+972
-159
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+972
-159
lines changed

docker_db.sh

Lines changed: 80 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ if command -v docker > /dev/null; then
44
CONTAINER_CLI=$(command -v docker)
55
HEALTCHECK_PATH="{{.State.Health.Status}}"
66
PRIVILEGED_CLI=""
7+
IS_PODMAN=false
78
else
89
CONTAINER_CLI=$(command -v podman)
910
HEALTCHECK_PATH="{{.State.Healthcheck.Status}}"
11+
IS_PODMAN=true
1012
# Only use sudo for podman
1113
if command -v sudo > /dev/null; then
1214
PRIVILEGED_CLI="sudo"
@@ -15,6 +17,12 @@ else
1517
fi
1618
fi
1719

20+
if [[ "$(uname -s)" == "Darwin" ]]; then
21+
IS_OSX=true
22+
else
23+
IS_OSX=false
24+
fi
25+
1826
mysql() {
1927
mysql_9_4
2028
}
@@ -292,29 +300,93 @@ db2() {
292300
}
293301

294302
db2_11_5() {
295-
$PRIVILEGED_CLI $CONTAINER_CLI rm -f db2 || true
296-
$PRIVILEGED_CLI $CONTAINER_CLI run --name db2 --privileged -e DB2INSTANCE=orm_test -e DB2INST1_PASSWORD=orm_test -e DBNAME=orm_test -e LICENSE=accept -e AUTOCONFIG=false -e ARCHIVE_LOGS=false -e TO_CREATE_SAMPLEDB=false -e REPODB=false -p 50000:50000 -d ${DB_IMAGE_DB2_11_5:-icr.io/db2_community/db2:11.5.9.0}
303+
CONTAINER_OPTIONS=""
304+
if [[ "$IS_OSX" == "true" ]]; then
305+
# Thanks to Mohamed Asfour https://community.ibm.com/community/user/discussion/db2-luw-115xx-mac-m1-ready#bm017584d2-8d76-42a6-8f76-018dac8e78f2
306+
# This SO post explains what goes wrong on OSX: https://stackoverflow.com/questions/70175677/ibmcom-db2-docker-image-fails-on-m1
307+
# Also, use the $HOME directory as base directory to make volume mounts work on Colima on Mac
308+
db2install=$HOME/db2install.sh
309+
rm -f ${db2install} || true
310+
cat <<'EOF' >${db2install}
311+
#!/bin/bash
312+
find /var/db2_setup -type f -not -path '*/\.*' -exec sed -i "s/su - db2inst1 -c '/su - db2inst1 -c '. .profile \&\& /g" {} +
313+
find /var/db2_setup -type f -not -path '*/\.*' -exec sed -i "s/su - db2inst1 -c \"/su - db2inst1 -c \". .profile \&\& /g" {} +
314+
find /var/db2_setup -type f -not -path '*/\.*' -exec sed -i "s/su - \${DB2INSTANCE?} -c '/su - \${DB2INSTANCE?} -c '. .profile \&\& /g" {} +
315+
find /var/db2_setup -type f -not -path '*/\.*' -exec sed -i "s/su - \${DB2INSTANCE?} -c \"/su - \${DB2INSTANCE?} -c \". .profile \&\& /g" {} +
316+
find /var/db2_setup -type f -not -path '*/\.*' -exec sed -i "s/su - \${instance?} -c '/su - \${instance?} -c '. .profile \&\& /g" {} +
317+
find /var/db2_setup -type f -not -path '*/\.*' -exec sed -i "s/su - \${instance?} -c \"/su - \${instance?} -c \". .profile \&\& /g" {} +
318+
find /var/db2_setup -type f -not -path '*/\.*' -exec sed -i "s/su - \${instance_name?} -c '/su - \${instance_name?} -c '. .profile \&\& /g" {} +
319+
find /var/db2_setup -type f -not -path '*/\.*' -exec sed -i "s/su - \${instance_name?} -c \"/su - \${instance_name?} -c \". .profile \&\& /g" {} +
320+
find /var/db2_setup -type f -not -path '*/\.*' -exec sed -i "s/su - db2inst1 -c \\\\\"/su - db2inst1 -c \\\". .profile \&\& /g" {} +
321+
. /var/db2_setup/lib/setup_db2_instance.sh
322+
EOF
323+
chmod 777 ${db2install}
324+
if [[ "$IS_PODMAN" == "true" ]]; then
325+
CONTAINER_OPTIONS='-e IS_OSXFS=true -v '${db2install}':/db2install.sh --entrypoint=["/bin/bash","-c","/db2install.sh"]'
326+
CONTAINER_ARGS=
327+
else
328+
CONTAINER_OPTIONS='-e IS_OSXFS=true -v '${db2install}':/db2install.sh --entrypoint=/bin/bash'
329+
CONTAINER_ARGS=" -c /db2install.sh"
330+
fi
331+
fi
332+
if [[ "$IS_PODMAN" == "false" ]]; then
333+
export DOCKER_DEFAULT_PLATFORM=linux/amd64
334+
fi
335+
$CONTAINER_CLI rm -f db2 || true
336+
$CONTAINER_CLI run --name db2 --privileged --platform=linux/amd64 -e DB2INSTANCE=orm_test -e DB2INST1_PASSWORD=orm_test -e DBNAME=orm_test -e LICENSE=accept -e AUTOCONFIG=false -e ARCHIVE_LOGS=false -e TO_CREATE_SAMPLEDB=false -e REPODB=false -p 50000:50000 $CONTAINER_OPTIONS -d ${DB_IMAGE_DB2_11_5:-icr.io/db2_community/db2:11.5.9.0} $CONTAINER_ARGS
297337
# Give the container some time to start
298338
OUTPUT=
299339
while [[ $OUTPUT != *"INSTANCE"* ]]; do
300340
echo "Waiting for DB2 to start..."
301341
sleep 10
302-
OUTPUT=$($PRIVILEGED_CLI $CONTAINER_CLI logs db2 2>&1)
342+
OUTPUT=$($CONTAINER_CLI logs db2 2>&1)
303343
done
304-
$PRIVILEGED_CLI $CONTAINER_CLI exec -t db2 su - orm_test bash -c ". /database/config/orm_test/sqllib/db2profile; /database/config/orm_test/sqllib/bin/db2 'connect to orm_test'; /database/config/orm_test/sqllib/bin/db2 'CREATE USER TEMPORARY TABLESPACE usr_tbsp MANAGED BY AUTOMATIC STORAGE'"
344+
$CONTAINER_CLI exec -t db2 su - orm_test bash -c ". /database/config/orm_test/sqllib/db2profile; /database/config/orm_test/sqllib/bin/db2 'connect to orm_test'; /database/config/orm_test/sqllib/bin/db2 'CREATE USER TEMPORARY TABLESPACE usr_tbsp MANAGED BY AUTOMATIC STORAGE'"
305345
}
306346

307347
db2_12_1() {
308-
$PRIVILEGED_CLI $CONTAINER_CLI rm -f db2 || true
309-
$PRIVILEGED_CLI $CONTAINER_CLI run --name db2 --privileged -e DB2INSTANCE=orm_test -e DB2INST1_PASSWORD=orm_test -e DBNAME=orm_test -e LICENSE=accept -e AUTOCONFIG=false -e ARCHIVE_LOGS=false -e TO_CREATE_SAMPLEDB=false -e REPODB=false -p 50000:50000 -d ${DB_IMAGE_DB2_11_5:-icr.io/db2_community/db2:12.1.2.0}
348+
CONTAINER_OPTIONS=""
349+
if [[ "$IS_OSX" == "true" ]]; then
350+
# Thanks to Mohamed Asfour https://community.ibm.com/community/user/discussion/db2-luw-115xx-mac-m1-ready#bm017584d2-8d76-42a6-8f76-018dac8e78f2
351+
# This SO post explains what goes wrong on OSX: https://stackoverflow.com/questions/70175677/ibmcom-db2-docker-image-fails-on-m1
352+
# Also, use the $HOME directory as base directory to make volume mounts work on Colima on Mac
353+
db2install=$HOME/db2install.sh
354+
rm -f ${db2install} || true
355+
cat <<'EOF' >${db2install}
356+
#!/bin/bash
357+
find /var/db2_setup -type f -not -path '*/\.*' -exec sed -i "s/su - db2inst1 -c '/su - db2inst1 -c '. .profile \&\& /g" {} +
358+
find /var/db2_setup -type f -not -path '*/\.*' -exec sed -i "s/su - db2inst1 -c \"/su - db2inst1 -c \". .profile \&\& /g" {} +
359+
find /var/db2_setup -type f -not -path '*/\.*' -exec sed -i "s/su - \${DB2INSTANCE?} -c '/su - \${DB2INSTANCE?} -c '. .profile \&\& /g" {} +
360+
find /var/db2_setup -type f -not -path '*/\.*' -exec sed -i "s/su - \${DB2INSTANCE?} -c \"/su - \${DB2INSTANCE?} -c \". .profile \&\& /g" {} +
361+
find /var/db2_setup -type f -not -path '*/\.*' -exec sed -i "s/su - \${instance?} -c '/su - \${instance?} -c '. .profile \&\& /g" {} +
362+
find /var/db2_setup -type f -not -path '*/\.*' -exec sed -i "s/su - \${instance?} -c \"/su - \${instance?} -c \". .profile \&\& /g" {} +
363+
find /var/db2_setup -type f -not -path '*/\.*' -exec sed -i "s/su - \${instance_name?} -c '/su - \${instance_name?} -c '. .profile \&\& /g" {} +
364+
find /var/db2_setup -type f -not -path '*/\.*' -exec sed -i "s/su - \${instance_name?} -c \"/su - \${instance_name?} -c \". .profile \&\& /g" {} +
365+
find /var/db2_setup -type f -not -path '*/\.*' -exec sed -i "s/su - db2inst1 -c \\\\\"/su - db2inst1 -c \\\". .profile \&\& /g" {} +
366+
. /var/db2_setup/lib/setup_db2_instance.sh
367+
EOF
368+
chmod 777 ${db2install}
369+
if [[ "$IS_PODMAN" == "true" ]]; then
370+
CONTAINER_OPTIONS='-e IS_OSXFS=true -v '${db2install}':/db2install.sh --entrypoint=["/bin/bash","-c","/db2install.sh"]'
371+
CONTAINER_ARGS=
372+
else
373+
CONTAINER_OPTIONS='-e IS_OSXFS=true -v '${db2install}':/db2install.sh --entrypoint=/bin/bash'
374+
CONTAINER_ARGS=" -c /db2install.sh"
375+
fi
376+
fi
377+
if [[ "$IS_PODMAN" == "false" ]]; then
378+
export DOCKER_DEFAULT_PLATFORM=linux/amd64
379+
fi
380+
$CONTAINER_CLI rm -f db2 || true
381+
$CONTAINER_CLI run --name db2 --privileged --platform=linux/amd64 -e DB2INSTANCE=orm_test -e DB2INST1_PASSWORD=orm_test -e DBNAME=orm_test -e LICENSE=accept -e AUTOCONFIG=false -e ARCHIVE_LOGS=false -e TO_CREATE_SAMPLEDB=false -e REPODB=false -e BLU=false -e ENABLE_ORACLE_COMPATIBILITY=false -e UPDATEAVAIL=NO -e PERSISTENT_HOME=false -e HADR_ENABLED=false -p 50000:50000 $CONTAINER_OPTIONS -d ${DB_IMAGE_DB2_12_1:-icr.io/db2_community/db2:12.1.2.0} $CONTAINER_ARGS
310382
# Give the container some time to start
311383
OUTPUT=
312384
while [[ $OUTPUT != *"INSTANCE"* ]]; do
313385
echo "Waiting for DB2 to start..."
314386
sleep 10
315-
OUTPUT=$($PRIVILEGED_CLI $CONTAINER_CLI logs db2 2>&1)
387+
OUTPUT=$($CONTAINER_CLI logs db2 2>&1)
316388
done
317-
$PRIVILEGED_CLI $CONTAINER_CLI exec -t db2 su - orm_test bash -c ". /database/config/orm_test/sqllib/db2profile; /database/config/orm_test/sqllib/bin/db2 'connect to orm_test'; /database/config/orm_test/sqllib/bin/db2 'CREATE USER TEMPORARY TABLESPACE usr_tbsp MANAGED BY AUTOMATIC STORAGE'"
389+
$CONTAINER_CLI exec -t db2 su - orm_test bash -c ". /database/config/orm_test/sqllib/db2profile; /database/config/orm_test/sqllib/bin/db2 'connect to orm_test'; /database/config/orm_test/sqllib/bin/db2 'CREATE USER TEMPORARY TABLESPACE usr_tbsp MANAGED BY AUTOMATIC STORAGE'"
318390
}
319391

320392
db2_spatial() {

documentation/src/main/asciidoc/userguide/chapters/query/extensions/Vector.adoc

Lines changed: 116 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,25 @@ so no further configuration is necessary to make the features available.
5353
[[vector-module-usage]]
5454
==== Usage
5555

56-
Annotate a persistent attribute with `@JdbcTypeCode(SqlTypes.VECTOR)` and specify the vector length with `@Array(length = ...)`.
56+
Annotate a persistent attribute with one of the various vector type codes `@JdbcTypeCode` and specify the vector length with `@Array(length = ...)`.
57+
Possible vector type codes and the compatible Java types are:
58+
59+
* `@JdbcTypeCode(SqlTypes.VECTOR_BINARY)` for `byte[]`
60+
* `@JdbcTypeCode(SqlTypes.VECTOR_INT8)` for `byte[]`
61+
* `@JdbcTypeCode(SqlTypes.VECTOR_FLOAT16)` for `float[]`
62+
* `@JdbcTypeCode(SqlTypes.VECTOR_FLOAT32)` for `float[]`
63+
* `@JdbcTypeCode(SqlTypes.VECTOR_FLOAT64)` for `double[]`
64+
* `@JdbcTypeCode(SqlTypes.VECTOR)` for `float[]`
65+
66+
Hibernate ORM also provides support for sparse vectors through dedicated Java types:
67+
68+
* `@JdbcTypeCode(SqlTypes.SPARSE_VECTOR_INT8)` for `SparseByteVector`
69+
* `@JdbcTypeCode(SqlTypes.SPARSE_VECTOR_FLOAT32)` for `SparseFloatVector`
70+
* `@JdbcTypeCode(SqlTypes.SPARSE_VECTOR_FLOAT64)` for `SparseDoubleVector`
5771

5872
[WARNING]
5973
====
60-
As Oracle AI Vector Search supports different types of elements (to ensure better performance and compatibility with embedding models), you can also use:
61-
62-
- `@JdbcTypeCode(SqlTypes.VECTOR_INT8)` for `byte[]`
63-
- `@JdbcTypeCode(SqlTypes.VECTOR_FLOAT32)` for `float[]`
64-
- `@JdbcTypeCode(SqlTypes.VECTOR_FLOAT64)` for `double[]`.
74+
Vector data type support depends on native support of the underlying database.
6575
====
6676

6777
[[vector-module-usage-example]]
@@ -88,14 +98,21 @@ Expressions of the vector type can be used with various vector functions.
8898
| `euclidean_distance()` | Computes the https://en.wikipedia.org/wiki/Euclidean_distance[euclidean distance] between two vectors. Maps to the `<``-``>` operator for `pgvector` and maps to the
8999
`vector_distance(v1, v2, EUCLIDEAN)` function for `Oracle AI Vector Search`.
90100

101+
| `euclidean_squared_distance()` | Computes the https://en.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance[squared euclidean distance] between two vectors.
102+
91103
| `l2_distance()` | Alias for `euclidean_distance()`
92104

105+
| `l2_squared_distance()` | Alias for `euclidean_squared_distance()`
106+
93107
| `taxicab_distance()` | Computes the https://en.wikipedia.org/wiki/Taxicab_geometry[taxicab distance] between two vectors. Maps to `vector_distance(v1, v2, MANHATTAN)` function for `Oracle AI Vector Search`.
94108

95109
| `l1_distance()` | Alias for `taxicab_distance()`
96110

97111
| `hamming_distance()` | Computes the https://en.wikipedia.org/wiki/Hamming_distance[hamming distance] between two vectors. Maps to `vector_distance(v1, v2, HAMMING)` function for `Oracle AI Vector Search`.
98112

113+
| `jaccard_distance()` | Computes the https://en.wikipedia.org/wiki/Jaccard_index[jaccard distance] between two vectors. Maps to the `<``%``>` operator for `pgvector` and maps to the
114+
`vector_distance(v1, v2, JACCARD)` function for `Oracle AI Vector Search`.
115+
99116
| `inner_product()` | Computes the https://en.wikipedia.org/wiki/Inner_product_space[inner product] between two vectors
100117

101118
| `negative_inner_product()` | Computes the negative inner product. Maps to the `<``#``>` operator for `pgvector` and maps to the
@@ -104,6 +121,14 @@ Expressions of the vector type can be used with various vector functions.
104121
| `vector_dims()` | Determines the dimensions of a vector
105122

106123
| `vector_norm()` | Computes the https://en.wikipedia.org/wiki/Euclidean_space#Euclidean_norm[Euclidean norm] of a vector
124+
125+
| `l2_norm()` | Alias for `vector_norm()`
126+
127+
| `l2_normalize()` | Normalizes each component of a vector by dividing it with the https://en.wikipedia.org/wiki/Euclidean_space#Euclidean_norm[Euclidean norm] of the vector.
128+
129+
| `binary_quantize()` | Reduces a vector of size N to a binary vector with N bits, using 0 for values <= 0 and 1 for values > 0.
130+
131+
| `subvector()` | Creates a subvector from a given vector, a 1-based start index and a count.
107132
|===
108133

109134
In addition to these special vector functions, it is also possible to use vectors with the following builtin `pgvector` operators:
@@ -143,6 +168,21 @@ include::{example-dir-vector}/FloatVectorTest.java[tags=euclidean-distance-examp
143168
----
144169
====
145170

171+
[[vector-module-functions-euclidean-squared-distance]]
172+
===== `euclidean_squared_distance()` and `l2_squared_distance()`
173+
174+
Computes the https://en.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance[squared euclidean distance] between two vectors,
175+
which is `sum( (v1_i - v2_i)^2 )`, just like the regular `euclidean_distance`, but without the `sqrt`.
176+
The `l2_squared_distance()` function is an alias.
177+
178+
[[vector-module-functions-euclidean-squared-distance-example]]
179+
====
180+
[source, java, indent=0]
181+
----
182+
include::{example-dir-vector}/FloatVectorTest.java[tags=euclidean-squared-distance-example]
183+
----
184+
====
185+
146186
[[vector-module-functions-taxicab-distance]]
147187
===== `taxicab_distance()` and `l1_distance()`
148188

@@ -158,6 +198,36 @@ include::{example-dir-vector}/FloatVectorTest.java[tags=taxicab-distance-example
158198
----
159199
====
160200

201+
[[vector-module-functions-hamming-distance]]
202+
===== `hamming_distance()`
203+
204+
Computes the https://en.wikipedia.org/wiki/Hamming_distance[hamming distance] between two binary vectors,
205+
which is `bit_count(v1 ^ v2)` i.e. the amount of bits where two vectors differ.
206+
Maps to the `<``~``>` operator for `pgvector`.
207+
208+
[[vector-module-functions-taxicab-distance-example]]
209+
====
210+
[source, java, indent=0]
211+
----
212+
include::{example-dir-vector}/BinaryVectorTest.java[tags=hamming-distance-example]
213+
----
214+
====
215+
216+
[[vector-module-functions-jaccard-distance]]
217+
===== `jaccard_distance()`
218+
219+
Computes the https://en.wikipedia.org/wiki/Jaccard_index[jaccard distance] between two binary vectors,
220+
which is `1 - bit_count(v1 & v2) / bit_count(v1 | v2)`.
221+
Maps to the `<``%``>` operator for `pgvector`.
222+
223+
[[vector-module-functions-taxicab-distance-example]]
224+
====
225+
[source, java, indent=0]
226+
----
227+
include::{example-dir-vector}/BinaryVectorTest.java[tags=jaccard-distance-example]
228+
----
229+
====
230+
161231
[[vector-module-functions-inner-product]]
162232
===== `inner_product()` and `negative_inner_product()`
163233

@@ -187,10 +257,11 @@ include::{example-dir-vector}/FloatVectorTest.java[tags=vector-dims-example]
187257
====
188258

189259
[[vector-module-functions-vector-norm]]
190-
===== `vector_norm()`
260+
===== `vector_norm()` and `l2_norm()`
191261

192262
Computes the https://en.wikipedia.org/wiki/Euclidean_space#Euclidean_norm[Euclidean norm] of a vector,
193263
which is `sqrt( sum( v_i^2 ) )`.
264+
The `l2_norm()` function is an alias.
194265

195266
[[vector-module-functions-vector-norm-example]]
196267
====
@@ -200,6 +271,44 @@ include::{example-dir-vector}/FloatVectorTest.java[tags=vector-norm-example]
200271
----
201272
====
202273

274+
[[vector-module-functions-l2-normalize]]
275+
===== `l2_normalize()`
276+
277+
Normalizes each component of a vector by dividing it with the https://en.wikipedia.org/wiki/Euclidean_space#Euclidean_norm[Euclidean norm] of the vector.
278+
279+
[[vector-module-functions-l2-normalize-example]]
280+
====
281+
[source, java, indent=0]
282+
----
283+
include::{example-dir-vector}/FloatVectorTest.java[tags=l2-normalize-example]
284+
----
285+
====
286+
287+
[[vector-module-functions-binary-quantize]]
288+
===== `binary_quantize()`
289+
290+
Reduces a vector of size N to a binary vector with N bits, using 0 for values <= 0 and 1 for values > 0.
291+
292+
[[vector-module-functions-binary-quantize-example]]
293+
====
294+
[source, java, indent=0]
295+
----
296+
include::{example-dir-vector}/FloatVectorTest.java[tags=binary-quantize-example]
297+
----
298+
====
299+
300+
[[vector-module-functions-subvector]]
301+
===== `binary_quantize()`
302+
303+
Creates a subvector from a given vector, a 1-based start index and a count.
304+
305+
[[vector-module-functions-subvector-example]]
306+
====
307+
[source, java, indent=0]
308+
----
309+
include::{example-dir-vector}/FloatVectorTest.java[tags=subvector-example]
310+
----
311+
====
203312

204313

205314

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/GaussDBCastingInetJdbcType.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
import java.sql.ResultSet;
1111
import java.sql.SQLException;
1212

13+
import org.checkerframework.checker.nullness.qual.Nullable;
1314
import org.hibernate.dialect.Dialect;
15+
import org.hibernate.engine.jdbc.Size;
1416
import org.hibernate.sql.ast.spi.SqlAppender;
1517
import org.hibernate.type.SqlTypes;
1618
import org.hibernate.type.descriptor.ValueBinder;
@@ -35,6 +37,7 @@ public class GaussDBCastingInetJdbcType implements JdbcType {
3537
@Override
3638
public void appendWriteExpression(
3739
String writeExpression,
40+
@Nullable Size size,
3841
SqlAppender appender,
3942
Dialect dialect) {
4043
appender.append( "cast(" );

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/GaussDBCastingIntervalSecondJdbcType.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
import java.sql.ResultSet;
1111
import java.sql.SQLException;
1212

13+
import org.checkerframework.checker.nullness.qual.Nullable;
1314
import org.hibernate.dialect.Dialect;
15+
import org.hibernate.engine.jdbc.Size;
1416
import org.hibernate.engine.spi.SessionFactoryImplementor;
1517
import org.hibernate.metamodel.mapping.JdbcMappingContainer;
1618
import org.hibernate.sql.ast.SqlAstTranslator;
@@ -77,6 +79,7 @@ public JdbcMappingContainer getExpressionType() {
7779
@Override
7880
public void appendWriteExpression(
7981
String writeExpression,
82+
@Nullable Size size,
8083
SqlAppender appender,
8184
Dialect dialect) {
8285
appender.append( '(' );

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/GaussDBCastingJsonArrayJdbcType.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
*/
55
package org.hibernate.community.dialect;
66

7+
import org.checkerframework.checker.nullness.qual.Nullable;
78
import org.hibernate.dialect.Dialect;
9+
import org.hibernate.engine.jdbc.Size;
810
import org.hibernate.sql.ast.spi.SqlAppender;
911
import org.hibernate.type.descriptor.jdbc.JdbcType;
1012
import org.hibernate.type.descriptor.jdbc.JsonArrayJdbcType;
@@ -27,6 +29,7 @@ public GaussDBCastingJsonArrayJdbcType(JdbcType elementJdbcType, boolean jsonb)
2729
@Override
2830
public void appendWriteExpression(
2931
String writeExpression,
32+
@Nullable Size size,
3033
SqlAppender appender,
3134
Dialect dialect) {
3235
appender.append( "cast(" );

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/GaussDBCastingJsonJdbcType.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
*/
55
package org.hibernate.community.dialect;
66

7+
import org.checkerframework.checker.nullness.qual.Nullable;
78
import org.hibernate.dialect.Dialect;
9+
import org.hibernate.engine.jdbc.Size;
810
import org.hibernate.metamodel.mapping.EmbeddableMappingType;
911
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
1012
import org.hibernate.sql.ast.spi.SqlAppender;
@@ -46,6 +48,7 @@ public AggregateJdbcType resolveAggregateJdbcType(
4648
@Override
4749
public void appendWriteExpression(
4850
String writeExpression,
51+
@Nullable Size size,
4952
SqlAppender appender,
5053
Dialect dialect) {
5154
appender.append( "cast(" );

0 commit comments

Comments
 (0)