gustavodemorais commented on code in PR #28278:
URL: https://github.com/apache/flink/pull/28278#discussion_r3333288516


##########
flink-table/flink-table-common/src/test/java/org/apache/flink/table/types/inference/strategies/ToChangelogOutputTypeStrategyTest.java:
##########
@@ -105,6 +106,55 @@ ARG_TABLE, new 
TableSemanticsMock(TABLE_TYPE_NOT_NULL_SCORE))
                                                 DataTypes.FIELD("op", 
DataTypes.STRING()),
                                                 DataTypes.FIELD("name", 
DataTypes.STRING()),
                                                 DataTypes.FIELD("score", 
DataTypes.BIGINT()))
+                                        .notNull()),
+                // Set semantics: PARTITION BY strips the partition column 
from the projected
+                // output (the framework prepends it back outside the 
function), so the strategy
+                // returns only [op, non_partition_input_cols]. With full 
deletes the row is
+                // passed through unchanged so non-partition NOT NULL columns 
stay non-nullable.
+                TestSpec.forStrategy(
+                                "produces_full_deletes=true in set semantics 
preserves NOT NULL on non-partition columns",
+                                TO_CHANGELOG_OUTPUT_TYPE_STRATEGY)
+                        .inputTypes(
+                                TABLE_TYPE_NOT_NULL_SCORE, DESCRIPTOR_TYPE, 
MAP_TYPE, BOOLEAN_TYPE)
+                        .calledWithTableSemanticsAt(
+                                ARG_TABLE,
+                                new TableSemanticsMock(
+                                        TABLE_TYPE_NOT_NULL_SCORE,
+                                        new int[] {0},
+                                        new int[0],
+                                        -1,
+                                        null,
+                                        List.of(new int[] {0})))
+                        .calledWithLiteralAt(ARG_OP, ColumnList.of("op"))
+                        .calledWithLiteralAt(ARG_OP_MAPPING, null)
+                        .calledWithLiteralAt(ARG_PRODUCES_FULL_DELETES, true)
+                        .expectDataType(
+                                DataTypes.ROW(
+                                                DataTypes.FIELD("op", 
DataTypes.STRING()),
+                                                DataTypes.FIELD(
+                                                        "score", 
DataTypes.BIGINT().notNull()))
+                                        .notNull()),
+                TestSpec.forStrategy(
+                                "produces_full_deletes=false in set semantics 
widens non-partition-key columns",
+                                TO_CHANGELOG_OUTPUT_TYPE_STRATEGY)
+                        .inputTypes(
+                                TABLE_TYPE_NOT_NULL_SCORE, DESCRIPTOR_TYPE, 
MAP_TYPE, BOOLEAN_TYPE)
+                        .calledWithTableSemanticsAt(
+                                ARG_TABLE,
+                                new TableSemanticsMock(
+                                        TABLE_TYPE_NOT_NULL_SCORE,
+                                        new int[] {0},
+                                        new int[0],
+                                        -1,
+                                        null,
+                                        List.of(new int[] {0})))
+                        .calledWithLiteralAt(ARG_OP, ColumnList.of("op"))
+                        .calledWithLiteralAt(ARG_OP_MAPPING, null)
+                        .calledWithLiteralAt(ARG_PRODUCES_FULL_DELETES, false)
+                        .expectDataType(
+                                DataTypes.ROW(
+                                                DataTypes.FIELD("op", 
DataTypes.STRING()),

Review Comment:
   name is the partition column and this is set semantics. It's stripped out of 
the schema 



##########
flink-table/flink-table-common/src/test/java/org/apache/flink/table/types/inference/strategies/ToChangelogOutputTypeStrategyTest.java:
##########
@@ -105,6 +106,55 @@ ARG_TABLE, new 
TableSemanticsMock(TABLE_TYPE_NOT_NULL_SCORE))
                                                 DataTypes.FIELD("op", 
DataTypes.STRING()),
                                                 DataTypes.FIELD("name", 
DataTypes.STRING()),
                                                 DataTypes.FIELD("score", 
DataTypes.BIGINT()))
+                                        .notNull()),
+                // Set semantics: PARTITION BY strips the partition column 
from the projected
+                // output (the framework prepends it back outside the 
function), so the strategy
+                // returns only [op, non_partition_input_cols]. With full 
deletes the row is
+                // passed through unchanged so non-partition NOT NULL columns 
stay non-nullable.
+                TestSpec.forStrategy(
+                                "produces_full_deletes=true in set semantics 
preserves NOT NULL on non-partition columns",
+                                TO_CHANGELOG_OUTPUT_TYPE_STRATEGY)
+                        .inputTypes(
+                                TABLE_TYPE_NOT_NULL_SCORE, DESCRIPTOR_TYPE, 
MAP_TYPE, BOOLEAN_TYPE)
+                        .calledWithTableSemanticsAt(
+                                ARG_TABLE,
+                                new TableSemanticsMock(
+                                        TABLE_TYPE_NOT_NULL_SCORE,
+                                        new int[] {0},
+                                        new int[0],
+                                        -1,
+                                        null,
+                                        List.of(new int[] {0})))
+                        .calledWithLiteralAt(ARG_OP, ColumnList.of("op"))
+                        .calledWithLiteralAt(ARG_OP_MAPPING, null)
+                        .calledWithLiteralAt(ARG_PRODUCES_FULL_DELETES, true)
+                        .expectDataType(
+                                DataTypes.ROW(
+                                                DataTypes.FIELD("op", 
DataTypes.STRING()),
+                                                DataTypes.FIELD(

Review Comment:
   https://github.com/apache/flink/pull/28278#discussion_r3333288516



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to