gyfora commented on code in PR #23490:
URL: https://github.com/apache/flink/pull/23490#discussion_r1368558467


##########
flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/JavaRecordHelper.java:
##########
@@ -0,0 +1,162 @@
+/*
+ * 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.api.java.typeutils.runtime;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.util.Preconditions;
+
+import org.apache.flink.shaded.guava31.com.google.common.base.Defaults;
+
+import javax.annotation.Nullable;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/** Utilities for handling Java records nicely in the {@link PojoSerializer}. 
*/
+@Internal
+final class JavaRecordHelper<T> {
+
+    /** Record canonical constructor. */
+    private final Constructor<T> recordConstructor;
+
+    /**
+     * Record constructor parameter in case the new constructor has a 
different parameter order then
+     * the serialized data. Used for schema evolution. Null when not needed.
+     */
+    @Nullable private final int[] paramIndexMapping;
+    /**
+     * Default record args used for newly introduced primitive fields during 
schema evolution. Null
+     * when not needed.
+     */
+    @Nullable private final Object[] defaultConstructorArgs;
+
+    private JavaRecordHelper(Constructor<T> recordConstructor) {
+        this(recordConstructor, null, null);

Review Comment:
   I would prefer to avoid the unnecessary copy in case of null, the null check 
is faster



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to