Skip to content

chore: support for UUID type #3572

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

Merged
merged 73 commits into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
f8a5603
feat: Add Metrics host for built in metrics (#3519)
surbhigarg92 Dec 5, 2024
6a429b1
feat: introduce java.time variables and methods (#3495)
diegomarquezp Dec 5, 2024
df03ae6
chore(spanner): support multiplexed session for rw transactions in ex…
harshachinta Dec 6, 2024
27c2068
chore: remove unused code and fix some warnings (#3533)
olavloite Dec 8, 2024
b060dfd
feat(spanner): support multiplexed session for Partitioned operations…
pratickchokhani Dec 9, 2024
ebd326b
test: enable more tests on the Emulator (#3535)
olavloite Dec 9, 2024
7e265ac
ci(spanner): Fix nightly job issues (#3522)
sakthivelmanii Dec 10, 2024
7d2534d
chore: add internal option for statement executor type (#3534)
olavloite Dec 10, 2024
725efa3
feat: support 'set local' for retry_aborts_internally (#3532)
olavloite Dec 10, 2024
9172b0d
feat: add opt-in for using multiplexed sessions for blind writes (#3540)
pratickchokhani Dec 11, 2024
5c30ba2
ci(spanner): clean up unused kokoro configurations (#3542)
sakthivelmanii Dec 11, 2024
41e1495
test(spanner): Enabled multiplexed session for partitioned operations…
pratickchokhani Dec 13, 2024
30c2e59
chore(main): release 6.82.1-SNAPSHOT (#3526)
release-please[bot] Dec 13, 2024
1611c0c
deps: update sdk platform java dependencies (#3549)
renovate-bot Dec 13, 2024
f2e3d20
chore: reset default to platform thread (#3551)
olavloite Dec 13, 2024
9640c9a
chore: Update generation configuration at Fri Dec 13 16:21:35 UTC 202…
cloud-java-bot Dec 13, 2024
41673f2
chore(main): release 6.83.0 (#3547)
release-please[bot] Dec 13, 2024
5c77905
chore: make state field volatile in AsyncResultSetImpl (#3550)
olavloite Dec 13, 2024
6354f35
chore: make valid connection properties public (#3546)
olavloite Dec 13, 2024
5cf957d
deps: update opentelemetry.version to v1.45.0 (#3531)
renovate-bot Dec 14, 2024
2758d40
chore(main): release 6.83.1-SNAPSHOT (#3554)
release-please[bot] Dec 14, 2024
e194954
feat(spanner): add jdbc support for external hosts (#3536)
sagnghos Dec 16, 2024
33d22eb
ci(spanner): improve performance of samples tests (#3558)
sakthivelmanii Dec 16, 2024
488aa8c
test: unflake RetryOnInvalidatedSessionTest (#3561)
olavloite Dec 16, 2024
871cb82
ci(spanner): Create a new Sample Slow tests (#3560)
sakthivelmanii Dec 17, 2024
07ee201
chore: Update generation configuration at Sat Dec 14 02:27:24 UTC 202…
cloud-java-bot Dec 18, 2024
dc392e3
test: enable write tests for PostgreSQL (#3529)
olavloite Dec 18, 2024
ee81eba
chore: include session min/max in error message (#3566)
olavloite Dec 18, 2024
8173e51
fix: retry specific internal errors (#3565)
olavloite Dec 18, 2024
0a4d70a
chore: disable native metrics when there are no credentials (#3567)
olavloite Dec 18, 2024
e5185b1
feat: add support for ARRAY<STRUCT> to CloudCilentExecutor (#3544)
larkee Dec 18, 2024
2f580ce
chore: Update generation configuration at Wed Dec 18 05:50:09 UTC 202…
cloud-java-bot Dec 24, 2024
aa70fb7
feat: support for UUID type
gagangupt16 Dec 26, 2024
c243ed7
feat: support for UUID type
Dec 26, 2024
72b697b
Merge branch 'main' of github.com:googleapis/java-spanner into uuid
gagangupt16 Dec 26, 2024
cde6988
Merge branch 'main' of github.com:googleapis/java-spanner into uuid
Dec 26, 2024
49e8f92
fix: unit tests for UUID type
gagangupt16 Dec 27, 2024
73ee379
Merge branch 'main' of github.com:googleapis/java-spanner into uuid
gagangupt16 Dec 27, 2024
1d9a960
Merge branch 'uuid' of github.com:gagangupt16/java-spanner into uuid
gagangupt16 Dec 27, 2024
4d210d7
fix: ignore uuid methods for clirr plugin
gagangupt16 Dec 27, 2024
7bcc098
style: fix indentation
gagangupt16 Dec 31, 2024
4421dff
Merge branch 'main' of github.com:googleapis/java-spanner into uuid
gagangupt16 Dec 31, 2024
517e5e9
Merge branch 'main' into uuid
sakthivelmanii Jan 2, 2025
42f078a
style: fix formatting issue
gagangupt16 Jan 3, 2025
4bc6217
Merge branch 'uuid' of github.com:gagangupt16/java-spanner into uuid
gagangupt16 Jan 3, 2025
971475a
docs: added TODO for removing env checks for integration tests for UUID
gagangupt16 Jan 3, 2025
0f9e774
Merge branch 'main' of github.com:googleapis/java-spanner into uuid
gagangupt16 Jan 3, 2025
d270a08
fix: add missing return statement
gagangupt16 Jan 3, 2025
ec8a0b2
Merge branch 'main' into uuid
gagangupt16 Jan 8, 2025
b9925d1
Merge branch 'main' into uuid
gagangupt16 Jan 9, 2025
430e7c7
Merge branch 'main' into uuid
gagangupt16 Jan 13, 2025
0b821ee
Merge branch 'main' into uuid
gagangupt16 Jan 21, 2025
db9c5a5
Merge branch 'main' into uuid
sakthivelmanii Feb 27, 2025
9d82713
Merge branch 'main' into uuid
sakthivelmanii Mar 2, 2025
6696cc4
Merge branch 'main' of github.com:googleapis/java-spanner into uuid
gagangupt16 Mar 4, 2025
bfe12eb
refactor: use internal methods and remove unused code
gagangupt16 Mar 4, 2025
71f2175
Merge branch 'uuid' of github.com:gagangupt16/java-spanner into uuid
gagangupt16 Mar 4, 2025
8151916
Merge branch 'main' into uuid
gagangupt16 Mar 5, 2025
2b88eb8
fix: make it binary compatible while adding implementation for UUID m…
gagangupt16 Mar 5, 2025
d8c7e50
Merge branch 'uuid' of github.com:gagangupt16/java-spanner into uuid
gagangupt16 Mar 5, 2025
9159a47
Merge branch 'main' into uuid
gagangupt16 Mar 17, 2025
1028823
Merge branch 'main' into uuid
gagangupt16 Mar 19, 2025
122f4cf
Merge branch 'main' into uuid
gagangupt16 Mar 20, 2025
b5a7be8
Merge branch 'main' into uuid
gagangupt16 Mar 21, 2025
5a0cb9d
Merge branch 'main' into uuid
gagangupt16 Mar 26, 2025
dd3abcd
Merge branch 'main' into uuid
gagangupt16 Mar 27, 2025
509b13e
Merge branch 'main' into uuid
gagangupt16 Mar 28, 2025
980aa8c
merge conflicts resolved
gagangupt16 Apr 1, 2025
df4c6c1
merge conflicts resolved
gagangupt16 Apr 3, 2025
4004fdd
Merge branch 'main' of github.com:googleapis/java-spanner into uuid
gagangupt16 Apr 15, 2025
5fc48f3
tests: added more tests in ValueTest
gagangupt16 Apr 28, 2025
0a46de3
style: formatting fix
gagangupt16 Apr 28, 2025
dbc46bd
Merge branch 'main' into uuid
harshachinta Apr 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions google-cloud-spanner/clirr-ignored-differences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,38 @@
<method>java.util.List getFloat32Array()</method>
</difference>

<!-- UUID -->
<difference>
<differenceType>7012</differenceType>
<className>com/google/cloud/spanner/StructReader</className>
<method>java.util.UUID getUuid(int)</method>
</difference>
<difference>
<differenceType>7012</differenceType>
<className>com/google/cloud/spanner/StructReader</className>
<method>java.util.UUID getUuid(java.lang.String)</method>
</difference>
<difference>
<differenceType>7012</differenceType>
<className>com/google/cloud/spanner/StructReader</className>
<method>java.util.List getUuidList(int)</method>
</difference>
<difference>
<differenceType>7012</differenceType>
<className>com/google/cloud/spanner/StructReader</className>
<method>java.util.List getUuidList(java.lang.String)</method>
</difference>
<difference>
<differenceType>7013</differenceType>
<className>com/google/cloud/spanner/Value</className>
<method>java.util.UUID getUuid()</method>
</difference>
<difference>
<differenceType>7013</differenceType>
<className>com/google/cloud/spanner/Value</className>
<method>java.util.List getUuidArray()</method>
</difference>

<!-- INTERVAL -->
<difference>
<differenceType>7012</differenceType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.function.Function;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -434,6 +435,11 @@ protected Date getDateInternal(int columnIndex) {
return currRow().getDateInternal(columnIndex);
}

@Override
protected UUID getUuidInternal(int columnIndex) {
return currRow().getUuidInternal(columnIndex);
}

@Override
protected Interval getIntervalInternal(int columnIndex) {
return currRow().getIntervalInternal(columnIndex);
Expand Down Expand Up @@ -531,6 +537,11 @@ protected List<Date> getDateListInternal(int columnIndex) {
return currRow().getDateListInternal(columnIndex);
}

@Override
protected List<UUID> getUuidListInternal(int columnIndex) {
return currRow().getUuidListInternal(columnIndex);
}

@Override
protected List<Interval> getIntervalListInternal(int columnIndex) {
return currRow().getIntervalListInternal(columnIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.function.Function;

/**
Expand Down Expand Up @@ -67,6 +68,10 @@ protected String getPgJsonbInternal(int columnIndex) {

protected abstract Date getDateInternal(int columnIndex);

protected UUID getUuidInternal(int columnIndex) {
throw new UnsupportedOperationException("Not implemented");
}

protected Interval getIntervalInternal(int columnIndex) {
throw new UnsupportedOperationException("Not implemented");
}
Expand Down Expand Up @@ -132,6 +137,10 @@ protected List<String> getPgJsonbListInternal(int columnIndex) {

protected abstract List<Date> getDateListInternal(int columnIndex);

protected List<UUID> getUuidListInternal(int columnIndex) {
throw new UnsupportedOperationException("Not implemented");
}

protected List<Interval> getIntervalListInternal(int columnIndex) {
throw new UnsupportedOperationException("Not implemented");
}
Expand Down Expand Up @@ -307,6 +316,19 @@ public Date getDate(String columnName) {
return getDateInternal(columnIndex);
}

@Override
public UUID getUuid(int columnIndex) {
checkNonNullOfType(columnIndex, Type.uuid(), columnIndex);
return getUuidInternal(columnIndex);
}

@Override
public UUID getUuid(String columnName) {
final int columnIndex = getColumnIndex(columnName);
checkNonNullOfType(columnIndex, Type.uuid(), columnName);
return getUuidInternal(columnIndex);
}

@Override
public Interval getInterval(int columnIndex) {
checkNonNullOfType(columnIndex, Type.interval(), columnIndex);
Expand Down Expand Up @@ -604,6 +626,19 @@ public List<Date> getDateList(String columnName) {
return getDateListInternal(columnIndex);
}

@Override
public List<UUID> getUuidList(int columnIndex) {
checkNonNullOfType(columnIndex, Type.array(Type.uuid()), columnIndex);
return getUuidListInternal(columnIndex);
}

@Override
public List<UUID> getUuidList(String columnName) {
final int columnIndex = getColumnIndex(columnName);
checkNonNullOfType(columnIndex, Type.array(Type.uuid()), columnName);
return getUuidListInternal(columnIndex);
}

@Override
public List<Interval> getIntervalList(int columnIndex) {
checkNonNullOfType(columnIndex, Type.array(Type.interval()), columnIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.google.protobuf.ProtocolMessageEnum;
import java.math.BigDecimal;
import java.util.List;
import java.util.UUID;
import java.util.function.Function;

/** Forwarding implements of StructReader */
Expand Down Expand Up @@ -231,6 +232,18 @@ public Date getDate(String columnName) {
return delegate.get().getDate(columnName);
}

@Override
public UUID getUuid(int columnIndex) {
checkValidState();
return delegate.get().getUuid(columnIndex);
}

@Override
public UUID getUuid(String columnName) {
checkValidState();
return delegate.get().getUuid(columnName);
}

@Override
public Interval getInterval(int columnIndex) {
checkValidState();
Expand Down Expand Up @@ -421,6 +434,18 @@ public List<Date> getDateList(String columnName) {
return delegate.get().getDateList(columnName);
}

@Override
public List<UUID> getUuidList(int columnIndex) {
checkValidState();
return delegate.get().getUuidList(columnIndex);
}

@Override
public List<UUID> getUuidList(String columnName) {
checkValidState();
return delegate.get().getUuidList(columnName);
}

@Override
public List<Interval> getIntervalList(int columnIndex) {
checkValidState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -131,6 +132,9 @@ private Object writeReplace() {
case DATE:
builder.set(fieldName).to((Date) value);
break;
case UUID:
builder.set(fieldName).to((UUID) value);
break;
case INTERVAL:
builder.set(fieldName).to((Interval) value);
break;
Expand Down Expand Up @@ -187,6 +191,9 @@ private Object writeReplace() {
case DATE:
builder.set(fieldName).toDateArray((Iterable<Date>) value);
break;
case UUID:
builder.set(fieldName).toUuidArray((Iterable<UUID>) value);
break;
case INTERVAL:
builder.set(fieldName).toIntervalArray((Iterable<Interval>) value);
break;
Expand Down Expand Up @@ -304,6 +311,9 @@ private static Object decodeValue(Type fieldType, com.google.protobuf.Value prot
case DATE:
checkType(fieldType, proto, KindCase.STRING_VALUE);
return Date.parseDate(proto.getStringValue());
case UUID:
checkType(fieldType, proto, KindCase.STRING_VALUE);
return UUID.fromString(proto.getStringValue());
case INTERVAL:
checkType(fieldType, proto, KindCase.STRING_VALUE);
return Interval.parseFromString(proto.getStringValue());
Expand Down Expand Up @@ -356,6 +366,7 @@ static Object decodeArrayValue(Type elementType, ListValue listValue) {
case BYTES:
case TIMESTAMP:
case DATE:
case UUID:
case INTERVAL:
case STRUCT:
case PROTO:
Expand Down Expand Up @@ -513,6 +524,12 @@ protected Date getDateInternal(int columnIndex) {
return (Date) rowData.get(columnIndex);
}

@Override
protected UUID getUuidInternal(int columnIndex) {
ensureDecoded(columnIndex);
return (UUID) rowData.get(columnIndex);
}

@Override
protected Interval getIntervalInternal(int columnIndex) {
ensureDecoded(columnIndex);
Expand Down Expand Up @@ -640,6 +657,8 @@ protected Value getValueInternal(int columnIndex) {
return Value.timestamp(isNull ? null : getTimestampInternal(columnIndex));
case DATE:
return Value.date(isNull ? null : getDateInternal(columnIndex));
case UUID:
return Value.uuid(isNull ? null : getUuidInternal(columnIndex));
case INTERVAL:
return Value.interval(isNull ? null : getIntervalInternal(columnIndex));
case STRUCT:
Expand Down Expand Up @@ -682,6 +701,8 @@ protected Value getValueInternal(int columnIndex) {
return Value.timestampArray(isNull ? null : getTimestampListInternal(columnIndex));
case DATE:
return Value.dateArray(isNull ? null : getDateListInternal(columnIndex));
case UUID:
return Value.uuidArray(isNull ? null : getUuidListInternal(columnIndex));
case INTERVAL:
return Value.intervalArray(isNull ? null : getIntervalListInternal(columnIndex));
case STRUCT:
Expand Down Expand Up @@ -867,6 +888,13 @@ protected List<Date> getDateListInternal(int columnIndex) {
return Collections.unmodifiableList((List<Date>) rowData.get(columnIndex));
}

@Override
@SuppressWarnings("unchecked") // We know ARRAY<UUID> produces a List<UUID>.
protected List<UUID> getUuidListInternal(int columnIndex) {
ensureDecoded(columnIndex);
return Collections.unmodifiableList((List<UUID>) rowData.get(columnIndex));
}

@Override
@SuppressWarnings("unchecked") // We know ARRAY<Interval> produces a List<Interval>.
protected List<Interval> getIntervalListInternal(int columnIndex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.google.spanner.v1.ResultSetStats;
import java.math.BigDecimal;
import java.util.List;
import java.util.UUID;
import java.util.function.Function;

/** Utility methods for working with {@link com.google.cloud.spanner.ResultSet}. */
Expand Down Expand Up @@ -326,6 +327,16 @@ public Date getDate(String columnName) {
return getCurrentRowAsStruct().getDate(columnName);
}

@Override
public UUID getUuid(int columnIndex) {
return getCurrentRowAsStruct().getUuid(columnIndex);
}

@Override
public UUID getUuid(String columnName) {
return getCurrentRowAsStruct().getUuid(columnName);
}

@Override
public Interval getInterval(int columnIndex) {
return getCurrentRowAsStruct().getInterval(columnIndex);
Expand Down Expand Up @@ -518,6 +529,16 @@ public List<Date> getDateList(String columnName) {
return getCurrentRowAsStruct().getDateList(columnName);
}

@Override
public List<UUID> getUuidList(int columnIndex) {
return getCurrentRowAsStruct().getUuidList(columnIndex);
}

@Override
public List<UUID> getUuidList(String columnName) {
return getCurrentRowAsStruct().getUuidList(columnName);
}

@Override
public List<Interval> getIntervalList(int columnIndex) {
return getCurrentRowAsStruct().getIntervalList(columnIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.function.Function;
import javax.annotation.concurrent.Immutable;

Expand Down Expand Up @@ -226,6 +227,11 @@ protected Date getDateInternal(int columnIndex) {
return values.get(columnIndex).getDate();
}

@Override
protected UUID getUuidInternal(int columnIndex) {
return values.get(columnIndex).getUuid();
}

@Override
protected Interval getIntervalInternal(int columnIndex) {
return values.get(columnIndex).getInterval();
Expand Down Expand Up @@ -339,6 +345,11 @@ protected List<Date> getDateListInternal(int columnIndex) {
return values.get(columnIndex).getDateArray();
}

@Override
protected List<UUID> getUuidListInternal(int columnIndex) {
return values.get(columnIndex).getUuidArray();
}

@Override
protected List<Interval> getIntervalListInternal(int columnIndex) {
return values.get(columnIndex).getIntervalArray();
Expand Down Expand Up @@ -430,6 +441,8 @@ private Object getAsObject(int columnIndex) {
return getTimestampInternal(columnIndex);
case DATE:
return getDateInternal(columnIndex);
case UUID:
return getUuidInternal(columnIndex);
case INTERVAL:
return getIntervalInternal(columnIndex);
case STRUCT:
Expand Down Expand Up @@ -463,6 +476,8 @@ private Object getAsObject(int columnIndex) {
return getTimestampListInternal(columnIndex);
case DATE:
return getDateListInternal(columnIndex);
case UUID:
return getUuidListInternal(columnIndex);
case INTERVAL:
return getIntervalListInternal(columnIndex);
case STRUCT:
Expand Down
Loading
Loading