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 2022/07/07 13:12:16 UTC

[GitHub] [ignite-3] ademakov commented on a diff in pull request #898: IGNITE-17192 Binary Tuple Implementation

ademakov commented on code in PR #898:
URL: https://github.com/apache/ignite-3/pull/898#discussion_r915856881


##########
modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryTupleSchema.java:
##########
@@ -0,0 +1,346 @@
+/*
+ * 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.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.util.UUID;
+import org.apache.ignite.lang.IgniteInternalException;
+
+/**
+ * Description of a binary tuple.
+ */
+public class BinaryTupleSchema {
+    /** Size of a tuple header, in bytes. */
+    public static int HEADER_SIZE = 1;
+
+    /** Mask for size of entries in variable-length offset table. */
+    public static final int VARSIZE_MASK = 0b011;
+
+    /** Flag that indicates null map presence. */
+    public static final int NULLMAP_FLAG = 0b100;
+
+    /** Default value for UUID elements. */
+    public static final UUID DEFAULT_UUID = new UUID(0, 0);
+
+    /** Default value for Date elements (Jan 1st 1 BC). */
+    public static final LocalDate DEFAULT_DATE = LocalDate.of(0, 1, 1);
+
+    /** Default value for Time elements (00:00:00). */
+    public static final LocalTime DEFAULT_TIME = LocalTime.of(0, 0);
+
+    /** Default value for DateTime elements (Jan 1st 1 BC, 00:00:00). */
+    public static final LocalDateTime DEFAULT_DATE_TIME = LocalDateTime.of(0, 1, 1, 0, 0);
+
+    /** Default value for Timestamp elements. */
+    public static final Instant DEFAULT_TIMESTAMP = Instant.EPOCH;
+
+    /**
+     * Tuple element description used for tuple parsing and building.
+     *
+     * <p>For binary tuples encoding of values is determined by its basic type and the value itself. Parameters
+     * like precision and scale defined for columns in schema are not taken into account. The only exception
+     * is the Decimal type where the scale parameter is required for decoding.
+     *
+     * <p>To keep things simple we have the scale parameter everywhere but really use it only for Decimals.
+     */
+    public static final class Element {
+        final NativeTypeSpec typeSpec;
+
+        final int decimalScale;
+
+        final boolean nullable;
+
+        /**
+         * Constructor.
+         *
+         * @param type Element data type.
+         * @param nullable True for nullable elements, false for non-nullable,

Review Comment:
   Thanks, fixed.



-- 
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: notifications-unsubscribe@ignite.apache.org

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