davidradl commented on code in PR #26540: URL: https://github.com/apache/flink/pull/26540#discussion_r2084305523
########## flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/sink/constraint/NotNullConstraint.java: ########## @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.table.runtime.operators.sink.constraint; + +import org.apache.flink.annotation.Internal; +import org.apache.flink.table.api.config.ExecutionConfigOptions; +import org.apache.flink.table.data.RowData; + +import javax.annotation.Nullable; + +import static org.apache.flink.table.api.config.ExecutionConfigOptions.TABLE_EXEC_SINK_NOT_NULL_ENFORCER; + +/** Enforces NOT NULL constraints on the input {@link RowData}. */ +@Internal +final class NotNullConstraint implements Constraint { + private final ExecutionConfigOptions.NotNullEnforcer notNullEnforcer; + private final int[] notNullFieldIndices; + private final String[] notNullFieldNames; + + NotNullConstraint( + ExecutionConfigOptions.NotNullEnforcer notNullEnforcer, + int[] notNullFieldIndices, + String[] notNullFieldNames) { + this.notNullEnforcer = notNullEnforcer; + this.notNullFieldIndices = notNullFieldIndices; + this.notNullFieldNames = notNullFieldNames; + } + + @Nullable + @Override + public RowData enforce(RowData input) { + for (int i = 0; i < notNullFieldIndices.length; i++) { + final int index = notNullFieldIndices[i]; + if (input.isNullAt(index)) { Review Comment: In the same spirit, if we have nested arrays of objects with chars / var chars / binary / varbinary, should we be checking those lengths. -- 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]
