danny0405 commented on a change in pull request #13763:
URL: https://github.com/apache/flink/pull/13763#discussion_r513264987
##########
File path:
flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSchemaConverter.java
##########
@@ -297,17 +299,22 @@ private static DataType convertToDataType(Schema schema) {
* @return Avro's {@link Schema} matching this logical type.
*/
public static Schema convertToSchema(LogicalType logicalType) {
- return convertToSchema(logicalType, "record");
+ return convertToSchema(logicalType, "record", true);
}
/**
* Converts Flink SQL {@link LogicalType} (can be nested) into an Avro
schema.
*
* @param logicalType logical type
* @param rowName the record name
+ * @param top whether it is parsing the root record,
+ * if it is, the logical type nullability would be
ignored
* @return Avro's {@link Schema} matching this logical type.
*/
- public static Schema convertToSchema(LogicalType logicalType, String
rowName) {
+ public static Schema convertToSchema(
+ LogicalType logicalType,
+ String rowName,
+ boolean top) {
Review comment:
>Excuse me, but I wholeheartedly disagree with your statement. null =/=
(null, null). (null, null) is still NOT NULL. A whole row in a Table can not be
null. Only particular columns can be null. Therefore the top level row of a
Table is always NOT NULL.
You can test it in PostgreSQL with the following SQL:
```sql
create type my_type as (a int, b varchar(20));
create table t1(
f0 my_type,
f1 varchar(20)
);
insert into t1 values((null, null), 'def');
select f0 is null from t1; -- it returns true
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]