@@ -74,6 +74,26 @@ public class TransformSchemaOperatorTest {
74
74
.options (ImmutableMap .of ("key1" , "value1" , "key2" , "value2" ))
75
75
.build ();
76
76
77
+ private static final Schema NULLABILITY_SCHEMA =
78
+ Schema .newBuilder ()
79
+ .physicalColumn ("id" , DataTypes .STRING ().notNull ())
80
+ .physicalColumn ("name" , DataTypes .STRING ())
81
+ .primaryKey ("id" )
82
+ .partitionKey ("id" )
83
+ .options (ImmutableMap .of ("key1" , "value1" , "key2" , "value2" ))
84
+ .build ();
85
+
86
+ private static final Schema EXPECTED_NULLABILITY_SCHEMA =
87
+ Schema .newBuilder ()
88
+ .physicalColumn ("id" , DataTypes .STRING ().notNull ())
89
+ .physicalColumn ("uid" , DataTypes .STRING ())
90
+ .physicalColumn ("name" , DataTypes .STRING ())
91
+ .physicalColumn ("uname" , DataTypes .STRING ())
92
+ .primaryKey ("id" )
93
+ .partitionKey ("id" )
94
+ .options (ImmutableMap .of ("key1" , "value1" , "key2" , "value2" ))
95
+ .build ();
96
+
77
97
@ Test
78
98
void testEventTransform () throws Exception {
79
99
TransformSchemaOperator transform =
@@ -176,4 +196,33 @@ void testEventTransform() throws Exception {
176
196
transformFunctionEventEventOperatorTestHarness .getOutputRecords ().poll ())
177
197
.isEqualTo (new StreamRecord <>(updateEventExpect ));
178
198
}
199
+
200
+ @ Test
201
+ public void testNullabilityColumn () throws Exception {
202
+ TransformSchemaOperator transform =
203
+ TransformSchemaOperator .newBuilder ()
204
+ .addTransform (
205
+ CUSTOMERS_TABLEID .identifier (),
206
+ "id, upper(id) uid, name, upper(name) uname" ,
207
+ "id" ,
208
+ "id" ,
209
+ "key1=value1,key2=value2" )
210
+ .build ();
211
+ EventOperatorTestHarness <TransformSchemaOperator , Event >
212
+ transformFunctionEventEventOperatorTestHarness =
213
+ new EventOperatorTestHarness <>(transform , 1 );
214
+ // Initialization
215
+ transformFunctionEventEventOperatorTestHarness .open ();
216
+ // Create table
217
+ CreateTableEvent createTableEvent =
218
+ new CreateTableEvent (CUSTOMERS_TABLEID , NULLABILITY_SCHEMA );
219
+ transform .processElement (new StreamRecord <>(createTableEvent ));
220
+
221
+ Assertions .assertThat (
222
+ transformFunctionEventEventOperatorTestHarness .getOutputRecords ().poll ())
223
+ .isEqualTo (
224
+ new StreamRecord <>(
225
+ new CreateTableEvent (
226
+ CUSTOMERS_TABLEID , EXPECTED_NULLABILITY_SCHEMA )));
227
+ }
179
228
}
0 commit comments