[
https://issues.apache.org/jira/browse/FLINK-5187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15741998#comment-15741998
]
ASF GitHub Bot commented on FLINK-5187:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/2968#discussion_r91761526
--- Diff:
flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/NullMaskUtils.java
---
@@ -0,0 +1,104 @@
+/*
+ * 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.api.java.typeutils.runtime;
+
+import org.apache.flink.core.memory.DataInputView;
+import org.apache.flink.core.memory.DataOutputView;
+import org.apache.flink.types.Row;
+
+import java.io.IOException;
+
+public class NullMaskUtils {
+
+ public static void writeNullMask(int len, Row value, DataOutputView
target) throws IOException {
+ int b = 0x00;
+ int bytePos = 0;
+
+ int fieldPos = 0;
+ int numPos = 0;
+ while (fieldPos < len) {
+ b = 0x00;
+ // set bits in byte
+ bytePos = 0;
+ numPos = Math.min(8, len - fieldPos);
+ while (bytePos < numPos) {
+ b = b << 1;
+ // set bit if field is null
+ if (value.getField(fieldPos + bytePos) == null)
{
+ b |= 0x01;
+ }
+ bytePos += 1;
+ }
+ fieldPos += numPos;
+ // shift bits if last byte is not completely filled
+ b <<= (8 - bytePos);
+ // write byte
+ target.writeByte(b);
+ }
+ }
+
+ public static void readIntoNullMask(
+ int len,
+ DataInputView source,
+ boolean[] nullMask) throws IOException {
+ int b = 0x00;
--- End diff --
new line
> Create analog of Row in core
> ----------------------------
>
> Key: FLINK-5187
> URL: https://issues.apache.org/jira/browse/FLINK-5187
> Project: Flink
> Issue Type: Sub-task
> Components: Core, Table API & SQL
> Reporter: Anton Solovev
> Assignee: Jark Wu
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)