@@ -2719,6 +2719,9 @@ private com.google.spanner.executor.v1.ValueList buildRow(
2719
2719
case BOOL :
2720
2720
value .setBoolValue (result .getBoolean (i ));
2721
2721
break ;
2722
+ case FLOAT32 :
2723
+ value .setDoubleValue ((double ) result .getFloat (i ));
2724
+ break ;
2722
2725
case FLOAT64 :
2723
2726
value .setDoubleValue (result .getDouble (i ));
2724
2727
break ;
@@ -2765,6 +2768,25 @@ private com.google.spanner.executor.v1.ValueList buildRow(
2765
2768
com .google .spanner .v1 .Type .newBuilder ().setCode (TypeCode .BOOL ).build ());
2766
2769
}
2767
2770
break ;
2771
+ case FLOAT32 :
2772
+ {
2773
+ com .google .spanner .executor .v1 .ValueList .Builder builder =
2774
+ com .google .spanner .executor .v1 .ValueList .newBuilder ();
2775
+ List <Float > values = result .getFloatList (i );
2776
+ for (Float floatValue : values ) {
2777
+ com .google .spanner .executor .v1 .Value .Builder valueProto =
2778
+ com .google .spanner .executor .v1 .Value .newBuilder ();
2779
+ if (floatValue == null ) {
2780
+ builder .addValue (valueProto .setIsNull (true ).build ());
2781
+ } else {
2782
+ builder .addValue (valueProto .setDoubleValue ((double ) floatValue ).build ());
2783
+ }
2784
+ }
2785
+ value .setArrayValue (builder .build ());
2786
+ value .setArrayType (
2787
+ com .google .spanner .v1 .Type .newBuilder ().setCode (TypeCode .FLOAT32 ).build ());
2788
+ }
2789
+ break ;
2768
2790
case FLOAT64 :
2769
2791
{
2770
2792
com .google .spanner .executor .v1 .ValueList .Builder builder =
@@ -3086,6 +3108,9 @@ private static com.google.cloud.spanner.Value valueProtoToCloudValue(
3086
3108
switch (type .getCode ()) {
3087
3109
case INT64 :
3088
3110
return com .google .cloud .spanner .Value .int64 (value .hasIsNull () ? null : value .getIntValue ());
3111
+ case FLOAT32 :
3112
+ return com .google .cloud .spanner .Value .float32 (
3113
+ value .hasIsNull () ? null : (float ) value .getDoubleValue ());
3089
3114
case FLOAT64 :
3090
3115
return com .google .cloud .spanner .Value .float64 (
3091
3116
value .hasIsNull () ? null : value .getDoubleValue ());
@@ -3142,6 +3167,19 @@ private static com.google.cloud.spanner.Value valueProtoToCloudValue(
3142
3167
.map (com .google .spanner .executor .v1 .Value ::getIntValue )
3143
3168
.collect (Collectors .toList ())));
3144
3169
}
3170
+ case FLOAT32 :
3171
+ if (value .hasIsNull ()) {
3172
+ return com .google .cloud .spanner .Value .float32Array ((Iterable <Float >) null );
3173
+ } else {
3174
+ return com .google .cloud .spanner .Value .float32Array (
3175
+ unmarshallValueList (
3176
+ value .getArrayValue ().getValueList ().stream ()
3177
+ .map (com .google .spanner .executor .v1 .Value ::getIsNull )
3178
+ .collect (Collectors .toList ()),
3179
+ value .getArrayValue ().getValueList ().stream ()
3180
+ .map (v -> (float ) v .getDoubleValue ())
3181
+ .collect (Collectors .toList ())));
3182
+ }
3145
3183
case FLOAT64 :
3146
3184
if (value .hasIsNull ()) {
3147
3185
return com .google .cloud .spanner .Value .float64Array ((Iterable <Double >) null );
@@ -3382,6 +3420,8 @@ private static com.google.cloud.spanner.Type typeProtoToCloudType(
3382
3420
return com .google .cloud .spanner .Type .string ();
3383
3421
case BYTES :
3384
3422
return com .google .cloud .spanner .Type .bytes ();
3423
+ case FLOAT32 :
3424
+ return com .google .cloud .spanner .Type .float32 ();
3385
3425
case FLOAT64 :
3386
3426
return com .google .cloud .spanner .Type .float64 ();
3387
3427
case DATE :
@@ -3430,6 +3470,8 @@ private static com.google.spanner.v1.Type cloudTypeToTypeProto(@Nonnull Type clo
3430
3470
return com .google .spanner .v1 .Type .newBuilder ().setCode (TypeCode .BOOL ).build ();
3431
3471
case INT64 :
3432
3472
return com .google .spanner .v1 .Type .newBuilder ().setCode (TypeCode .INT64 ).build ();
3473
+ case FLOAT32 :
3474
+ return com .google .spanner .v1 .Type .newBuilder ().setCode (TypeCode .FLOAT32 ).build ();
3433
3475
case FLOAT64 :
3434
3476
return com .google .spanner .v1 .Type .newBuilder ().setCode (TypeCode .FLOAT64 ).build ();
3435
3477
case STRING :
0 commit comments