You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/06/07 15:24:11 UTC

[GitHub] [ignite-3] ygerzhedovich commented on a change in pull request #152: IGNITE-14746: Improve row layout. Omit offset for the first varlen.

ygerzhedovich commented on a change in pull request #152:
URL: https://github.com/apache/ignite-3/pull/152#discussion_r646698370



##########
File path: modules/schema/src/test/java/org/apache/ignite/internal/schema/RowAssemblerAdvancedSchemaTest.java
##########
@@ -0,0 +1,307 @@
+/*
+ * 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.ignite.internal.schema;
+
+import java.util.Arrays;
+import java.util.UUID;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.ignite.internal.schema.NativeTypes.BYTE;
+import static org.apache.ignite.internal.schema.NativeTypes.BYTES;
+import static org.apache.ignite.internal.schema.NativeTypes.INTEGER;
+import static org.apache.ignite.internal.schema.NativeTypes.SHORT;
+import static org.apache.ignite.internal.schema.NativeTypes.STRING;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+
+/**
+ * Validate row layout for different schema configurations.
+ */
+public class RowAssemblerAdvancedSchemaTest {
+    /** Table ID test value. */
+    public final UUID tableId = UUID.randomUUID();
+
+    /**
+     * Validate row layout for schema of fix-len nullable key and fix-len nullable value.
+     */
+    @Test
+    public void fixedNullableColumns() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {
+                new Column("keyCol2", BYTE, true),
+                new Column("keyCol1", SHORT, true),
+                new Column("keyCol3", INTEGER, true)
+            },
+            new Column[] {
+                new Column("valCol2", BYTE, true),
+                new Column("valCol1", INTEGER, true),
+                new Column("valCol3", SHORT, true)
+            });
+
+        // Last col null
+        assertRowBytesEquals(
+            new byte[] {42, 0, 24, 0, -11, 43, 0, 0, 8, 0, 0, 0, 4, 11, 22, 0, 8, 0, 0, 0, 4, -44, -66, -1},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendByte((byte)11)
+                .appendShort((short)22)
+                .appendNull()
+                .appendByte((byte)-44)
+                .appendShort((short)-66)
+                .appendNull()
+                .build());
+
+        // Fist col null.

Review comment:
       ```suggestion
           // First col null.
   ```




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

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