This is an automated email from the ASF dual-hosted git repository. ppa pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/ignite-3.git
commit 8320efc2b9b689774b184236eb098742da74bbb8 Author: Pavel Pereslegin <[email protected]> AuthorDate: Thu Feb 19 11:50:27 2026 +0300 IGNITE-27612 Describe implicit conversion in Tuple public javadoc. --- .../main/java/org/apache/ignite/table/Tuple.java | 34 ++++++++++++++++++++++ .../org/apache/ignite/table/TupleImplTest.java | 10 ++----- .../ignite/table/AbstractImmutableTupleTest.java | 19 +++++++++--- .../apache/ignite/internal/sql/api/SqlRowTest.java | 10 ++----- 4 files changed, 55 insertions(+), 18 deletions(-) diff --git a/modules/api/src/main/java/org/apache/ignite/table/Tuple.java b/modules/api/src/main/java/org/apache/ignite/table/Tuple.java index f11d3550703..a1cd40aed90 100644 --- a/modules/api/src/main/java/org/apache/ignite/table/Tuple.java +++ b/modules/api/src/main/java/org/apache/ignite/table/Tuple.java @@ -280,6 +280,9 @@ public interface Tuple extends Iterable<Object> { /** * Gets a {@code byte} column value. * + * <p>Implicit conversions: column values of {@link Short}, {@link Integer} or {@link Long} type are converted to + * value of {@code byte} type, if the value fits {@code byte} range, otherwise {@link ArithmeticException} is thrown. + * * @param columnName Column name in SQL-parser style notation; e.g., <br> * "myColumn" - "MYCOLUMN", returns the index of the column ignores case sensitivity, <br> * "\"MyColumn\"" - "MyColumn", returns the index of the column with respect to case sensitivity. @@ -291,6 +294,9 @@ public interface Tuple extends Iterable<Object> { /** * Gets {@code byte} column value. * + * <p>Implicit conversions: column values of {@link Short}, {@link Integer} or {@link Long} type are converted to + * value of {@code byte} type, if the value fits {@code byte} range, otherwise {@link ArithmeticException} is thrown. + * * @param columnIndex Column index. * @return Column value. * @throws IndexOutOfBoundsException If no column with the given index exists. @@ -300,6 +306,9 @@ public interface Tuple extends Iterable<Object> { /** * Gets a {@code short} column value. * + * <p>Implicit conversions: column values of {@link Byte}, {@link Integer} or {@link Long} type are converted to + * value of {@code short} type, if the value fits {@code short} range, otherwise {@link ArithmeticException} is thrown. + * * @param columnName Column name in SQL-parser style notation; e.g., <br> * "myColumn" - "MYCOLUMN", returns the index of the column ignores case sensitivity, <br> * "\"MyColumn\"" - "MyColumn", returns the index of the column with respect to case sensitivity. @@ -311,6 +320,9 @@ public interface Tuple extends Iterable<Object> { /** * Gets a {@code short} column value. * + * <p>Implicit conversions: column values of {@link Byte}, {@link Integer} or {@link Long} type are converted to + * value of {@code short} type, if the value fits {@code short} range, otherwise {@link ArithmeticException} is thrown. + * * @param columnIndex Column index. * @return Column value. * @throws IndexOutOfBoundsException If no column with the given index exists. @@ -320,6 +332,9 @@ public interface Tuple extends Iterable<Object> { /** * Gets a {@code int} column value. * + * <p>Implicit conversions: column values of {@link Byte}, {@link Short} or {@link Long} type are converted to + * value of {@code int} type, if the value fits {@code int} range, otherwise {@link ArithmeticException} is thrown. + * * @param columnName Column name in SQL-parser style notation; e.g., <br> * "myColumn" - "MYCOLUMN", returns the index of the column ignores case sensitivity, <br> * "\"MyColumn\"" - "MyColumn", returns the index of the column with respect to case sensitivity. @@ -331,6 +346,9 @@ public interface Tuple extends Iterable<Object> { /** * Gets a {@code int} column value. * + * <p>Implicit conversions: column values of {@link Byte}, {@link Short} or {@link Long} type are converted to + * value of {@code int} type, if the value fits {@code int} range, otherwise {@link ArithmeticException} is thrown. + * * @param columnIndex Column index. * @return Column value. * @throws IndexOutOfBoundsException If no column with the given index exists. @@ -340,6 +358,9 @@ public interface Tuple extends Iterable<Object> { /** * Gets a {@code long} column value. * + * <p>Implicit conversions: column values of {@link Byte}, {@link Short} or {@link Integer} type are converted to + * value of {@code long} type. + * * @param columnName Column name in SQL-parser style notation; e.g., <br> * "myColumn" - "MYCOLUMN", returns the index of the column ignores case sensitivity, <br> * "\"MyColumn\"" - "MyColumn", returns the index of the column with respect to case sensitivity. @@ -351,6 +372,9 @@ public interface Tuple extends Iterable<Object> { /** * Gets a {@code long} column value. * + * <p>Implicit conversions: column values of {@link Byte}, {@link Short} or {@link Integer} type are converted to + * value of {@code long} type. + * * @param columnIndex Column index. * @return Column value. * @throws IndexOutOfBoundsException If no column with the given index exists. @@ -360,6 +384,9 @@ public interface Tuple extends Iterable<Object> { /** * Gets a {@code float} column value. * + * <p>Implicit conversions: column values of {@link Double} type are converted to value + * of {@code float} type, if the value fits {@code float} range, otherwise {@link ArithmeticException} is thrown. + * * @param columnName Column name in SQL-parser style notation; e.g., <br> * "myColumn" - "MYCOLUMN", returns the index of the column ignores case sensitivity, <br> * "\"MyColumn\"" - "MyColumn", returns the index of the column with respect to case sensitivity. @@ -371,6 +398,9 @@ public interface Tuple extends Iterable<Object> { /** * Gets a {@code float} column value. * + * <p>Implicit conversions: column values of {@link Double} type are converted to value + * of {@code float} type, if the value fits {@code float} range, otherwise {@link ArithmeticException} is thrown. + * * @param columnIndex Column index. * @return Column value. * @throws IndexOutOfBoundsException If no column with the given index exists. @@ -380,6 +410,8 @@ public interface Tuple extends Iterable<Object> { /** * Gets a {@code double} column value. * + * <p>Implicit conversions: column values of {@link Float} type are converted to value of {@code double} type. + * * @param columnName Column name in SQL-parser style notation; e.g., <br> * "myColumn" - "MYCOLUMN", returns the index of the column ignores case sensitivity, <br> * "\"MyColumn\"" - "MyColumn", returns the index of the column with respect to case sensitivity. @@ -391,6 +423,8 @@ public interface Tuple extends Iterable<Object> { /** * Gets a {@code double} column value. * + * <p>Implicit conversions: column values of {@link Float} type are converted to value of {@code double} type. + * * @param columnIndex Column index. * @return Column value. * @throws IndexOutOfBoundsException If no column with the given index exists. diff --git a/modules/api/src/test/java/org/apache/ignite/table/TupleImplTest.java b/modules/api/src/test/java/org/apache/ignite/table/TupleImplTest.java index dafaa832fe7..f4722356e35 100644 --- a/modules/api/src/test/java/org/apache/ignite/table/TupleImplTest.java +++ b/modules/api/src/test/java/org/apache/ignite/table/TupleImplTest.java @@ -22,9 +22,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Map; import java.util.function.Function; import org.apache.ignite.sql.ColumnType; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; /** * Tests server tuple builder implementation. @@ -94,11 +92,9 @@ public class TupleImplTest extends AbstractMutableTupleTest { assertEquals("non-normalized", tuple.valueOrDefault("\"Name\"", "default")); } - @Disabled("https://issues.apache.org/jira/browse/IGNITE-27577") - @ParameterizedTest + // TODO https://issues.apache.org/jira/browse/IGNITE-27577 Remove this method @Override - @SuppressWarnings("JUnitMalformedDeclaration") - public void allTypesUnsupportedConversion(ColumnType from, ColumnType to) { - super.allTypesUnsupportedConversion(from, to); + protected boolean enableClassCastMessageVerification() { + return false; } } diff --git a/modules/api/src/testFixtures/java/org/apache/ignite/table/AbstractImmutableTupleTest.java b/modules/api/src/testFixtures/java/org/apache/ignite/table/AbstractImmutableTupleTest.java index 4904d0cba34..b689a2373c4 100644 --- a/modules/api/src/testFixtures/java/org/apache/ignite/table/AbstractImmutableTupleTest.java +++ b/modules/api/src/testFixtures/java/org/apache/ignite/table/AbstractImmutableTupleTest.java @@ -699,17 +699,28 @@ public abstract class AbstractImmutableTupleTest { { ClassCastException ex = assertThrows(ClassCastException.class, () -> readValue(tuple, to, columnName, null)); - String template = "Column with name '%s' has type %s but %s was requested"; - assertThat(ex.getMessage(), containsString(String.format(template, columnName, from.name(), to.name()))); + + if (enableClassCastMessageVerification()) { + String template = "Column with name '%s' has type %s but %s was requested"; + assertThat(ex.getMessage(), containsString(String.format(template, columnName, from.name(), to.name()))); + } } { ClassCastException ex = assertThrows(ClassCastException.class, () -> readValue(tuple, to, null, 0)); - String template = "Column with index %d has type %s but %s was requested"; - assertThat(ex.getMessage(), containsString(String.format(template, 0, from.name(), to.name()))); + + if (enableClassCastMessageVerification()) { + String template = "Column with index %d has type %s but %s was requested"; + assertThat(ex.getMessage(), containsString(String.format(template, 0, from.name(), to.name()))); + } } } + // TODO https://issues.apache.org/jira/browse/IGNITE-27577 Remove this method + protected boolean enableClassCastMessageVerification() { + return true; + } + @ParameterizedTest(name = "{0} -> {1}") @MethodSource("allTypesDowncastOverflowArgs") public void allTypesDowncastOverflow(ColumnType from, ColumnType to) { diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/api/SqlRowTest.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/api/SqlRowTest.java index 3fc28ca75a7..2299899910f 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/api/SqlRowTest.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/api/SqlRowTest.java @@ -63,9 +63,7 @@ import org.apache.ignite.table.AbstractImmutableTupleTest; import org.apache.ignite.table.Tuple; import org.jetbrains.annotations.Nullable; import org.junit.jupiter.api.Assumptions; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; /** * Tests {@link SqlRow} tuple implementation. @@ -136,12 +134,10 @@ public class SqlRowTest extends AbstractImmutableTupleTest { Assumptions.abort(SqlRow.class.getSimpleName() + " is not serializable."); } - @Disabled("https://issues.apache.org/jira/browse/IGNITE-27577") - @ParameterizedTest + // TODO https://issues.apache.org/jira/browse/IGNITE-27577 Remove this method @Override - @SuppressWarnings("JUnitMalformedDeclaration") - public void allTypesUnsupportedConversion(ColumnType from, ColumnType to) { - super.allTypesUnsupportedConversion(from, to); + protected boolean enableClassCastMessageVerification() { + return false; } @Override
