1818import java .util .Random ;
1919import java .util .UUID ;
2020
21- public class SamplePOJO {
21+ public class QuerySamplePOJO {
2222 private int int8 ;
2323 private int int8_default ;
2424 private int int16 ;
@@ -35,7 +35,7 @@ public class SamplePOJO {
3535 private int uint8 ;
3636 private int uint16 ;
3737 private long uint32 ;
38- private long uint64 ;
38+ private BigInteger uint64 ;
3939 private BigInteger uint128 ;
4040 private BigInteger uint256 ;
4141
@@ -67,12 +67,15 @@ public class SamplePOJO {
6767 private Inet6Address ipv6 ;
6868
6969 private List <String > array ;
70- private List <Integer > tuple ;
70+ private List <?> tuple ;
71+
72+ private Object [] tupleArray ;
73+
7174 private Map <String , Integer > map ;
7275 private List <Integer > nestedInnerInt ;
7376 private List <String > nestedInnerString ;
7477
75- public SamplePOJO () {
78+ public QuerySamplePOJO () {
7679 final Random random = new Random ();
7780 int8 = random .nextInt (128 );
7881 int16 = random .nextInt (32768 );
@@ -90,11 +93,16 @@ public SamplePOJO() {
9093
9194 int256 = upper1 .or (upper2 ).or (lower1 ).or (lower2 );
9295
96+
9397 uint8 = random .nextInt (255 );
9498 uint16 = random .nextInt (32768 );
9599 uint32 = (long ) (random .nextDouble () * 4294967295L );
96- uint64 = (long ) (random .nextDouble () * 18446744073709615L );
97100
101+ long rndUInt64 = random .nextLong ();
102+ uint64 = BigInteger .valueOf (rndUInt64 );
103+ if (rndUInt64 < 0 ) {
104+ uint64 = uint64 .add (BigInteger .ONE .shiftLeft (64 ));
105+ }
98106
99107 uint128 = upper .or (lower ).abs ();
100108 uint256 = upper1 .or (upper2 ).or (lower1 ).or (lower2 ).abs ();
@@ -137,7 +145,8 @@ public SamplePOJO() {
137145 }
138146
139147 array = Arrays .asList ("a" , "b" , "c" , "d" , "e" , "f" , "g" , "h" , "i" , "j" , "k" , "l" , "m" , "n" , "o" , "p" , "q" , "r" , "s" , "t" , "u" , "v" , "w" , "x" , "y" , "z" );
140- tuple = Arrays .asList (1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 );
148+ tuple = Arrays .asList (random .nextInt (), random .nextDouble (), "a" , "b" );
149+ tupleArray = new Object [] {random .nextInt (), random .nextDouble (), "c" , "d" };
141150 map = new HashMap <>();
142151 for (int i = 0 ; i < 10 ; i ++) {
143152 map .put (String .valueOf ((char ) ('a' + i )), i + 1 );
@@ -248,11 +257,11 @@ public void setUint32(long uint32) {
248257 this .uint32 = uint32 ;
249258 }
250259
251- public long getUint64 () {
260+ public BigInteger getUint64 () {
252261 return uint64 ;
253262 }
254263
255- public void setUint64 (long uint64 ) {
264+ public void setUint64 (BigInteger uint64 ) {
256265 this .uint64 = uint64 ;
257266 }
258267
@@ -424,14 +433,22 @@ public void setArray(List<String> array) {
424433 this .array = array ;
425434 }
426435
427- public List <Integer > getTuple () {
436+ public List <? > getTuple () {
428437 return tuple ;
429438 }
430439
431- public void setTuple (List <Integer > tuple ) {
440+ public void setTuple (List <? > tuple ) {
432441 this .tuple = tuple ;
433442 }
434443
444+ public Object [] getTupleArray () {
445+ return tupleArray ;
446+ }
447+
448+ public void setTupleArray (Object [] tupleArray ) {
449+ this .tupleArray = tupleArray ;
450+ }
451+
435452 public Map <String , Integer > getMap () {
436453 return map ;
437454 }
@@ -460,18 +477,18 @@ public void setNestedInnerString(List<String> nestedInnerString) {
460477 public boolean equals (Object o ) {
461478 if (this == o ) return true ;
462479 if (o == null || getClass () != o .getClass ()) return false ;
463- SamplePOJO that = (SamplePOJO ) o ;
464- return int8 == that .int8 && int16 == that .int16 && int32 == that .int32 && int64 == that .int64 && uint8 == that .uint8 && uint16 == that .uint16 && uint32 == that .uint32 && uint64 == that .uint64 && Float .compare (float32 , that .float32 ) == 0 && Double .compare (float64 , that .float64 ) == 0 && bool == that .bool && enum8 == that .enum8 && enum16 == that .enum16 && Objects .equals (int128 , that .int128 ) && Objects .equals (int256 , that .int256 ) && Objects .equals (uint128 , that .uint128 ) && Objects .equals (uint256 , that .uint256 ) && Objects .equals (decimal32 , that .decimal32 ) && Objects .equals (decimal64 , that .decimal64 ) && Objects .equals (decimal128 , that .decimal128 ) && Objects .equals (decimal256 , that .decimal256 ) && Objects .equals (string , that .string ) && Objects .equals (fixedString , that .fixedString ) && Objects .equals (date , that .date ) && Objects .equals (date32 , that .date32 ) && Objects .equals (dateTime , that .dateTime ) && Objects .equals (dateTime64 , that .dateTime64 ) && Objects .equals (uuid , that .uuid ) && Objects .equals (ipv4 , that .ipv4 ) && Objects .equals (ipv6 , that .ipv6 ) && Objects .equals (array , that .array ) && Objects .equals (tuple , that .tuple ) && Objects .equals (map , that .map ) && Objects .equals (nestedInnerInt , that .nestedInnerInt ) && Objects .equals (nestedInnerString , that .nestedInnerString );
480+ QuerySamplePOJO that = (QuerySamplePOJO ) o ;
481+ return int8 == that .int8 && int8_default == that .int8_default && int16 == that .int16 && int16_default == that .int16_default && int32 == that .int32 && int32_default == that .int32_default && int64 == that .int64 && int64_default == that .int64_default && uint8 == that .uint8 && uint16 == that .uint16 && uint32 == that .uint32 && Float .compare (float32 , that .float32 ) == 0 && Double .compare (float64 , that .float64 ) == 0 && bool == that .bool && enum8 == that .enum8 && enum16 == that .enum16 && Objects .equals (int128 , that .int128 ) && Objects .equals (int128_default , that .int128_default ) && Objects .equals (int256 , that .int256 ) && Objects .equals (int256_default , that .int256_default ) && Objects .equals (uint64 , that .uint64 ) && Objects .equals (uint128 , that .uint128 ) && Objects .equals (uint256 , that .uint256 ) && Objects .equals (decimal32 , that .decimal32 ) && Objects .equals (decimal64 , that .decimal64 ) && Objects .equals (decimal128 , that .decimal128 ) && Objects .equals (decimal256 , that .decimal256 ) && Objects .equals (string , that .string ) && Objects .equals (fixedString , that .fixedString ) && Objects .equals (date , that .date ) && Objects .equals (date32 , that .date32 ) && Objects .equals (dateTime , that .dateTime ) && Objects .equals (dateTime64 , that .dateTime64 ) && Objects .equals (uuid , that .uuid ) && Objects .equals (ipv4 , that .ipv4 ) && Objects .equals (ipv6 , that .ipv6 ) && Objects .equals (array , that .array ) && Objects .equals (map , that .map ) && Objects .equals (nestedInnerInt , that .nestedInnerInt ) && Objects .equals (nestedInnerString , that .nestedInnerString );
465482 }
466483
467484 @ Override
468485 public int hashCode () {
469- return Objects .hash (int8 , int16 , int32 , int64 , int128 , int256 , uint8 , uint16 , uint32 , uint64 , uint128 , uint256 , float32 , float64 , decimal32 , decimal64 , decimal128 , decimal256 , bool , string , fixedString , date , date32 , dateTime , dateTime64 , uuid , enum8 , enum16 , ipv4 , ipv6 , array , tuple , map , nestedInnerInt , nestedInnerString );
486+ return Objects .hash (int8 , int8_default , int16 , int16_default , int32 , int32_default , int64 , int64_default , int128 , int128_default , int256 , int256_default , uint8 , uint16 , uint32 , uint64 , uint128 , uint256 , float32 , float64 , decimal32 , decimal64 , decimal128 , decimal256 , bool , string , fixedString , date , date32 , dateTime , dateTime64 , uuid , enum8 , enum16 , ipv4 , ipv6 , array , map , nestedInnerInt , nestedInnerString );
470487 }
471488
472489 @ Override
473490 public String toString () {
474- return "SamplePOJO {" +
491+ return "QuerySamplePOJO {" +
475492 "int8=" + int8 +
476493 ", int8_default=" + int8_default +
477494 ", int16=" + int16 +
@@ -509,7 +526,6 @@ public String toString() {
509526 ", ipv4=" + ipv4 +
510527 ", ipv6=" + ipv6 +
511528 ", array=" + array +
512- ", tuple=" + tuple +
513529 ", map=" + map +
514530 ", nestedInnerInt=" + nestedInnerInt +
515531 ", nestedInnerString=" + nestedInnerString +
@@ -555,7 +571,8 @@ public static String generateTableCreateSQL(String tableName) {
555571 "ipv4 IPv4, " +
556572 "ipv6 IPv6, " +
557573 "array Array(String), " +
558- "tuple Tuple(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32), " +
574+ "tuple Tuple(Int32, Float64, String, String), " +
575+ "tupleArray Tuple(Int32, Float64, String, String), " +
559576 "map Map(String, Int32), " +
560577 "nested Nested (innerInt Int32, innerString String)" +
561578 ") ENGINE = Memory" ;
0 commit comments