我有一个写入Spanner的数据流作业。我的一个列是ARRAY类型,也可以为空。当我尝试从我的Dataflow作业为此列写入空值时,出现以下错误 -
Caused by: java.lang.IllegalStateException: Illegal call to getter of null value.
at com.google.common.base.Preconditions.checkState(Preconditions.java:501)
at com.google.cloud.spanner.Value$AbstractValue.checkNotNull(Value.java:743)
at com.google.cloud.spanner.Value$PrimitiveArrayImpl.getArray(Value.java:981)
at com.google.cloud.spanner.Value$Int64ArrayImpl.getInt64Array(Value.java:1082)
at org.apache.beam.sdk.io.gcp.spanner.MutationSizeEstimator.estimateArrayValue(MutationSizeEstimator.java:79)
at org.apache.beam.sdk.io.gcp.spanner.MutationSizeEstimator.sizeOf(MutationSizeEstimator.java:36)
at org.apache.beam.sdk.io.gcp.spanner.MutationSizeEstimator.sizeOf(MutationSizeEstimator.java:51)
at org.apache.beam.sdk.io.gcp.spanner.SpannerWriteGroupFn.processElement(SpannerWriteGroupFn.java:70)
this line in MutationSizeEstimator.java看起来this line in Value.java调用Value.java是导致错误的原因,如{{3}}的文档中所述。
返回{@code ARRAY} -typed实例的值。而返回的列表本身 永远不会是{@code null},该列表的元素可能为null。 如果{@code isNull()}或者值不是预期类型,则@throws IllegalStateException
为什么会这样?如何将空值写入ARRAY类型的列呢?