yunfengzhou-hub commented on code in PR #6027: URL: https://github.com/apache/paimon/pull/6027#discussion_r2272821312
########## pom.xml: ########## Review Comment: Please check the pom of paimon-e2e-tests. Maybe we need to add a new profile for flink-2.0 now. ########## pom.xml: ########## @@ -466,13 +466,15 @@ under the License. <id>flink2</id> <properties> <paimon-flinkx-common>paimon-flink2-common</paimon-flinkx-common> - <paimon-flink-common.flink.version>2.0.0</paimon-flink-common.flink.version> + <paimon-flink-common.flink.version>2.1.0</paimon-flink-common.flink.version> <test.flink.main.version>2.0</test.flink.main.version> Review Comment: Should this property also be changed to 2.1? ########## paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/SchemaChangeITCase.java: ########## @@ -685,7 +684,6 @@ public void testModifyNullability() { "INSERT INTO T VALUES('aaa', 'bbb', 'ccc', 1, CAST(NULL AS FLOAT))")) .satisfies( anyCauseMatches( - TableException.class, Review Comment: Will the introduction of Flink 2.1 break this exception class? ########## paimon-flink/paimon-flink1-common/src/main/java/org/apache/flink/table/data/RowData.java: ########## @@ -0,0 +1,314 @@ +/* + * 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.data; + +import org.apache.flink.annotation.PublicEvolving; +import org.apache.flink.core.memory.MemorySegment; +import org.apache.flink.table.types.logical.DistinctType; +import org.apache.flink.table.types.logical.LogicalType; +import org.apache.flink.table.types.logical.RowType; +import org.apache.flink.table.types.logical.StructuredType; +import org.apache.flink.types.RowKind; +import org.apache.flink.types.variant.Variant; + +import javax.annotation.Nullable; + +import java.io.Serializable; + +import static org.apache.flink.table.types.logical.utils.LogicalTypeChecks.getFieldCount; +import static org.apache.flink.table.types.logical.utils.LogicalTypeChecks.getPrecision; +import static org.apache.flink.table.types.logical.utils.LogicalTypeChecks.getScale; + +/** + * Base interface for an internal data structure representing data of {@link RowType} and other + * (possibly nested) structured types such as {@link StructuredType} in the table ecosystem. + * + * <p>All top-level records that are travelling through Table API or SQL pipelines during runtime + * are instances of this interface. Each {@link RowData} contains a {@link RowKind} which represents + * the kind of change that a row describes in a changelog. The {@link RowKind} is just metadata + * information of row and thus not part of the table's schema, i.e., not a dedicated field. + * + * <p>Note: All fields of this data structure must be internal data structures. + * + * <p>The {@link RowData} interface has different implementations which are designed for different + * scenarios: + * + * <ul> + * <li>The binary-oriented implementation {@code BinaryRowData} is backed by references to {@link + * MemorySegment} instead of using Java objects to reduce the serialization/deserialization + * overhead. + * <li>The object-oriented implementation {@link GenericRowData} is backed by an array of Java + * {@link Object} which is easy to construct and efficient to update. + * </ul> + * + * <p>{@link GenericRowData} is intended for public use and has stable behavior. It is recommended + * to construct instances of {@link RowData} with this class if internal data structures are + * required. + * + * <p>The mappings from Flink's Table API and SQL data types to the internal data structures are + * listed in the following table: + * + * <pre> + * +--------------------------------+-----------------------------------------+ + * | SQL Data Types | Internal Data Structures | + * +--------------------------------+-----------------------------------------+ + * | BOOLEAN | boolean | + * +--------------------------------+-----------------------------------------+ + * | CHAR / VARCHAR / STRING | {@link StringData} | + * +--------------------------------+-----------------------------------------+ + * | BINARY / VARBINARY / BYTES | byte[] | + * +--------------------------------+-----------------------------------------+ + * | DECIMAL | {@link DecimalData} | + * +--------------------------------+-----------------------------------------+ + * | TINYINT | byte | + * +--------------------------------+-----------------------------------------+ + * | SMALLINT | short | + * +--------------------------------+-----------------------------------------+ + * | INT | int | + * +--------------------------------+-----------------------------------------+ + * | BIGINT | long | + * +--------------------------------+-----------------------------------------+ + * | FLOAT | float | + * +--------------------------------+-----------------------------------------+ + * | DOUBLE | double | + * +--------------------------------+-----------------------------------------+ + * | DATE | int (number of days since epoch) | + * +--------------------------------+-----------------------------------------+ + * | TIME | int (number of milliseconds of the day) | + * +--------------------------------+-----------------------------------------+ + * | TIMESTAMP | {@link TimestampData} | + * +--------------------------------+-----------------------------------------+ + * | TIMESTAMP WITH LOCAL TIME ZONE | {@link TimestampData} | + * +--------------------------------+-----------------------------------------+ + * | INTERVAL YEAR TO MONTH | int (number of months) | + * +--------------------------------+-----------------------------------------+ + * | INTERVAL DAY TO MONTH | long (number of milliseconds) | + * +--------------------------------+-----------------------------------------+ + * | ROW / structured types | {@link RowData} | + * +--------------------------------+-----------------------------------------+ + * | ARRAY | {@link ArrayData} | + * +--------------------------------+-----------------------------------------+ + * | MAP / MULTISET | {@link MapData} | + * +--------------------------------+-----------------------------------------+ + * | RAW | {@link RawValueData} | + * +--------------------------------+-----------------------------------------+ + * </pre> + * + * <p>Nullability is always handled by the container data structure. + */ +@PublicEvolving +public interface RowData { + + /** + * Returns the number of fields in this row. + * + * <p>The number does not include {@link RowKind}. It is kept separately. + */ + int getArity(); + + /** + * Returns the kind of change that this row describes in a changelog. + * + * @see RowKind + */ + RowKind getRowKind(); + + /** + * Sets the kind of change that this row describes in a changelog. + * + * @see RowKind + */ + void setRowKind(RowKind kind); + + // ------------------------------------------------------------------------------------------ + // Read-only accessor methods + // ------------------------------------------------------------------------------------------ + + /** Returns true if the field is null at the given position. */ + boolean isNullAt(int pos); + + /** Returns the boolean value at the given position. */ + boolean getBoolean(int pos); + + /** Returns the byte value at the given position. */ + byte getByte(int pos); + + /** Returns the short value at the given position. */ + short getShort(int pos); + + /** Returns the integer value at the given position. */ + int getInt(int pos); + + /** Returns the long value at the given position. */ + long getLong(int pos); + + /** Returns the float value at the given position. */ + float getFloat(int pos); + + /** Returns the double value at the given position. */ + double getDouble(int pos); + + /** Returns the string value at the given position. */ + StringData getString(int pos); + + /** + * Returns the decimal value at the given position. + * + * <p>The precision and scale are required to determine whether the decimal value was stored in + * a compact representation (see {@link DecimalData}). + */ + DecimalData getDecimal(int pos, int precision, int scale); + + /** + * Returns the timestamp value at the given position. + * + * <p>The precision is required to determine whether the timestamp value was stored in a compact + * representation (see {@link TimestampData}). + */ + TimestampData getTimestamp(int pos, int precision); + + /** Returns the raw value at the given position. */ + <T> RawValueData<T> getRawValue(int pos); + + /** Returns the binary value at the given position. */ + byte[] getBinary(int pos); + + /** Returns the array value at the given position. */ + ArrayData getArray(int pos); + + /** Returns the map value at the given position. */ + MapData getMap(int pos); + + /** + * Returns the row value at the given position. + * + * <p>The number of fields is required to correctly extract the row. + */ + RowData getRow(int pos, int numFields); + + /** Returns the variant value at the given position. */ + Variant getVariant(int pos); Review Comment: Do we need to add a RowData interface with getVariant method to paimon-flink-2.0 as well? -- 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...@paimon.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org