lowka commented on code in PR #5119:
URL: https://github.com/apache/ignite-3/pull/5119#discussion_r1941291455


##########
modules/system-view/src/main/java/org/apache/ignite/internal/systemview/utils/SystemViewUtils.java:
##########
@@ -141,8 +141,10 @@ private static ColumnParams 
systemViewColumnToColumnParams(SystemViewColumn<?, ?
             case STRING:
             case BYTES:
                 assert type instanceof VarlenNativeType : 
type.getClass().getCanonicalName();
+                VarlenNativeType varlenNativeType = (VarlenNativeType) type;
 
-                builder.length(((VarlenNativeType) type).length());
+                int maxLength = 
CatalogUtils.getMaxLength(typeSpec.asColumnType());
+                builder.length(Math.min(varlenNativeType.length(), maxLength));

Review Comment:
   Changed max length for STRING and BYTES.



##########
modules/catalog/src/test/java/org/apache/ignite/internal/catalog/commands/CatalogUtilsTest.java:
##########
@@ -186,6 +196,66 @@ void testClusterWideEnsuredActivationTimestamp() {
         assertEquals(expClusterWideActivationTs, 
clusterWideEnsuredActivationTimestamp(catalog.time(), 
TEST_MAX_CLOCK_SKEW_MILLIS));
     }
 
+    @ParameterizedTest
+    @MethodSource("columnTypesPrecision")
+    void testGetPrecision(ColumnType columnType, int min, int max) {
+        assertEquals(CatalogUtils.getMinPrecision(columnType), min, "min");
+        assertEquals(CatalogUtils.getMaxPrecision(columnType), max, "max");
+    }
+
+    private static Stream<Arguments> columnTypesPrecision() {
+        Stream<Arguments> types = Stream.of(
+                Arguments.of(DECIMAL, 1, 32767),
+                Arguments.of(TIME, 0, 9),
+                Arguments.of(TIMESTAMP, 0, 9)

Review Comment:
   Added those.



-- 
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]

Reply via email to