pvary commented on code in PR #13340: URL: https://github.com/apache/iceberg/pull/13340#discussion_r2160960949
########## flink/v2.0/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/convert/ArrayConverter.java: ########## @@ -0,0 +1,45 @@ +/* + * 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.iceberg.flink.sink.dynamic.convert; + +import org.apache.flink.table.data.ArrayData; +import org.apache.flink.table.data.GenericArrayData; +import org.apache.flink.table.types.logical.ArrayType; + +public class ArrayConverter implements DataConverter { + private final ArrayData.ElementGetter elementGetter; + private final DataConverter elementConverter; + + public ArrayConverter(ArrayType sourceType, ArrayType targetType) { + this.elementGetter = ArrayData.createElementGetter(sourceType.getElementType()); + this.elementConverter = + DataConverter.getNullable(sourceType.getElementType(), targetType.getElementType()); + } + + @Override + public ArrayData convert(Object object) { + ArrayData arrayData = (ArrayData) object; + Object[] convertedArray = new Object[arrayData.size()]; + for (int i = 0; i < convertedArray.length; i++) { + Object element = elementGetter.getElementOrNull(arrayData, i); + convertedArray[i] = elementConverter.convert(element); + } Review Comment: You can initiate the discussion on the dev list, but I think the community would vote against it, and would stick to the current guidelines. What I would suggest instead is to create a PR to enforce it by code if possible. I have my doubts there as well. Most of the guidelines are enforced by checkstyle already, and I guess it is not possible to enforce this. We might want to stick to more pressing issues 😄 -- 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...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org