File tree Expand file tree Collapse file tree 4 files changed +1
-34
lines changed
main/java/tech/ydb/table/values Expand file tree Collapse file tree 4 files changed +1
-34
lines changed Original file line number Diff line number Diff line change @@ -132,10 +132,6 @@ public long getUuidLow() {
132132 throw new IllegalStateException ("expected Uuid, but was " + getClass ().getSimpleName ());
133133 }
134134
135- public byte [] getUuidAsBytes () {
136- throw new IllegalStateException ("expected Uuid, but was " + getClass ().getSimpleName ());
137- }
138-
139135 public UUID getUuidJdk () {
140136 throw new IllegalStateException ("expected Uuid, but was " + getClass ().getSimpleName ());
141137 }
Original file line number Diff line number Diff line change 11package tech .ydb .table .values .proto ;
22
3- import java .nio .ByteBuffer ;
4- import java .nio .ByteOrder ;
53import java .nio .charset .Charset ;
64import java .time .Duration ;
75import java .time .Instant ;
@@ -819,10 +817,6 @@ public static PrimitiveValue newUuid(String uuid) {
819817 return new Uuid (uuid );
820818 }
821819
822- public static PrimitiveValue newUuid (byte [] uuid ) {
823- return new Uuid (uuid );
824- }
825-
826820 private static final class Uuid extends PrimitiveValue {
827821 private final long high ;
828822 private final long low ;
@@ -832,12 +826,6 @@ private static final class Uuid extends PrimitiveValue {
832826 this .low = low ;
833827 }
834828
835- Uuid (byte [] value ) {
836- ByteBuffer buf = ByteBuffer .wrap (value ).order (ByteOrder .BIG_ENDIAN );
837- this .high = buf .getLong ();
838- this .low = buf .getLong ();
839- }
840-
841829 Uuid (String value ) {
842830 String [] components = value .split ("-" );
843831 if (components .length != 5 ) {
@@ -915,14 +903,6 @@ public long getUuidLow() {
915903 return low ;
916904 }
917905
918- @ Override
919- public byte [] getUuidAsBytes () {
920- ByteBuffer buf = ByteBuffer .allocate (16 ).order (ByteOrder .BIG_ENDIAN );
921- buf .putLong (high );
922- buf .putLong (low );
923- return buf .array ();
924- }
925-
926906 @ Override
927907 public UUID getUuidJdk () {
928908 long timeLow = (low & 0x00000000ffffffffL ) << 32 ;
Original file line number Diff line number Diff line change 22
33import java .util .UUID ;
44
5- import com .google .common .io .BaseEncoding ;
65import org .junit .Assert ;
76import org .junit .ClassRule ;
87import org .junit .Test ;
@@ -88,7 +87,6 @@ public void uuidReadTest() {
8887 Assert .assertEquals ("123e4567-e89b-12d3-a456-426614174000" , v1 .getUuidString ());
8988 Assert .assertEquals (0x12d3e89b123e4567L , v1 .getUuidLow ());
9089 Assert .assertEquals (0x00401714664256a4L , v1 .getUuidHigh ());
91- Assert .assertArrayEquals (BaseEncoding .base16 ().decode ("00401714664256A412D3E89B123E4567" ), v1 .getUuidAsBytes ());
9290
9391 ValueReader p2 = rs .getColumn ("p2" );
9492 Assert .assertNotNull (p2 );
@@ -102,6 +100,5 @@ public void uuidReadTest() {
102100 Assert .assertEquals ("2d9e498b-b746-9cfb-084d-de4e1cb4736e" , v2 .getUuidString ());
103101 Assert .assertEquals (0x9cfbb7462d9e498bL , v2 .getUuidLow ());
104102 Assert .assertEquals (0x6e73b41c4ede4d08L , v2 .getUuidHigh ());
105- Assert .assertArrayEquals (BaseEncoding .base16 ().decode ("6E73B41C4EDE4D089CFBB7462D9E498B" ), v2 .getUuidAsBytes ());
106103 }
107104}
Original file line number Diff line number Diff line change 66import java .util .UUID ;
77import java .util .concurrent .TimeUnit ;
88
9- import com .google .common .io .BaseEncoding ;
109import org .junit .Assert ;
1110import org .junit .Test ;
1211
@@ -69,22 +68,17 @@ public void tzTimestamp() {
6968 public void uuid () {
7069 String uuid = "123e4567-e89b-12d3-a456-426614174000" ;
7170 long low = 0x12d3e89b123e4567L , high = 0x00401714664256a4L ;
72- byte [] bytes = BaseEncoding .base16 ().decode ("00401714664256A412D3E89B123E4567" );
7371
7472 PrimitiveValue u1 = ProtoValue .newUuid (uuid );
7573 PrimitiveValue u2 = ProtoValue .newUuid (UUID .fromString (uuid ));
76- PrimitiveValue u3 = ProtoValue .newUuid (bytes );
77- PrimitiveValue u4 = ProtoValue .newUuid (high , low );
74+ PrimitiveValue u3 = ProtoValue .newUuid (high , low );
7875
7976 Assert .assertEquals (u1 , u2 );
8077 Assert .assertEquals (u1 , u3 );
81- Assert .assertEquals (u1 , u4 );
8278
8379 Assert .assertEquals (uuid , u1 .getUuidString ());
8480 Assert .assertEquals (UUID .fromString ("123e4567-e89b-12d3-a456-426614174000" ), u1 .getUuidJdk ());
8581 Assert .assertEquals (low , u1 .getUuidLow ());
8682 Assert .assertEquals (high , u1 .getUuidHigh ());
87-
88- Assert .assertArrayEquals (bytes , u1 .getUuidAsBytes ());
8983 }
9084}
You can’t perform that action at this time.
0 commit comments