Conversation
12d34d5 to
0e7d5b8
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for writing Spark Struct and Array[Struct] types to Google Cloud Spanner. A critical flaw was identified in the handling of struct arrays, where the code incorrectly assumes the first element is non-null when determining the element type. This can lead to a NullPointerException and a potential Denial of Service if the input data contains a null as the first element of such an array. Beyond this, there are critical issues regarding the general handling of null and empty values for structs and struct arrays, which could lead to data correctness problems or runtime exceptions. The tests also contain some hardcoded values and incorrect assertions that should be addressed.
spark-3.1-spanner-lib/src/main/java/com/google/cloud/spark/spanner/SpannerWriterUtils.java
Outdated
Show resolved
Hide resolved
spark-3.1-spanner-lib/src/main/java/com/google/cloud/spark/spanner/SpannerWriterUtils.java
Outdated
Show resolved
Hide resolved
| {"timestamp", DataTypes.TimestampType, Value.timestamp(null)}, | ||
| {"date", DataTypes.DateType, Value.date(null)}, | ||
| {"decimal", new DecimalType(38, 9), Value.numeric(null)}, | ||
| {"struct", new StructType(), Value.struct(Struct.newBuilder().build())}, |
No description provided.