You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu> on 2024/11/29 15:06:34 UTC

Change in asterixdb[goldfish]: wip: add noOpColumnValueWriter

From Ritik Raj <ra...@gmail.com>:

Ritik Raj has uploaded this change for review. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19146 )


Change subject: wip: add noOpColumnValueWriter
......................................................................

wip: add noOpColumnValueWriter

Change-Id: I8b8634e5d901a45985d5d9a88f65fc551f6dd2e0
---
M asterixdb/asterix-column/src/main/java/org/apache/asterix/column/operation/lsm/flush/FlushColumnMetadata.java
A asterixdb/asterix-column/src/main/java/org/apache/asterix/column/values/writer/NoOpColumnValuesWriter.java
M asterixdb/asterix-column/src/main/java/org/apache/asterix/column/operation/lsm/flush/NoWriteFlushColumnMetadata.java
3 files changed, 137 insertions(+), 1 deletion(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/46/19146/1

diff --git a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/operation/lsm/flush/FlushColumnMetadata.java b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/operation/lsm/flush/FlushColumnMetadata.java
index 5251508..77d3d7c 100644
--- a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/operation/lsm/flush/FlushColumnMetadata.java
+++ b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/operation/lsm/flush/FlushColumnMetadata.java
@@ -563,7 +563,7 @@
         }
     }
 
-    private void addColumn(int index, IColumnValuesWriter writer) {
+    protected void addColumn(int index, IColumnValuesWriter writer) {
         if (index == columnWriters.size()) {
             columnWriters.add(writer);
         } else {
diff --git a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/operation/lsm/flush/NoWriteFlushColumnMetadata.java b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/operation/lsm/flush/NoWriteFlushColumnMetadata.java
index 70dcf34..bf46bfc 100644
--- a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/operation/lsm/flush/NoWriteFlushColumnMetadata.java
+++ b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/operation/lsm/flush/NoWriteFlushColumnMetadata.java
@@ -40,6 +40,7 @@
 import org.apache.asterix.column.util.RunLengthIntArray;
 import org.apache.asterix.column.values.IColumnValuesWriter;
 import org.apache.asterix.column.values.IColumnValuesWriterFactory;
+import org.apache.asterix.column.values.writer.NoOpColumnValuesWriter;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.commons.lang3.mutable.Mutable;
@@ -131,6 +132,8 @@
                 if (columnIndex == numColumns) {
                     numColumns++;
                 }
+                IColumnValuesWriter writer = NoOpColumnValuesWriter.INSTANCE;
+                addColumn(columnIndex, writer);
                 return new PrimitiveSchemaNode(columnIndex, normalizedTypeTag, primaryKey);
             default:
                 throw new IllegalStateException("Unsupported type " + childTypeTag);
diff --git a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/values/writer/NoOpColumnValuesWriter.java b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/values/writer/NoOpColumnValuesWriter.java
new file mode 100644
index 0000000..e774e9c
--- /dev/null
+++ b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/values/writer/NoOpColumnValuesWriter.java
@@ -0,0 +1,124 @@
+/*
+ * 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.asterix.column.values.writer;
+
+import java.io.DataOutput;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.asterix.column.util.RunLengthIntArray;
+import org.apache.asterix.column.values.IColumnValuesReader;
+import org.apache.asterix.column.values.IColumnValuesWriter;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IValueReference;
+
+public class NoOpColumnValuesWriter implements IColumnValuesWriter {
+    public static NoOpColumnValuesWriter INSTANCE = new NoOpColumnValuesWriter();
+
+    @Override
+    public void reset() throws HyracksDataException {
+
+    }
+
+    @Override
+    public int getColumnIndex() {
+        return 0;
+    }
+
+    @Override
+    public void writeValue(ATypeTag tag, IValueReference value) throws HyracksDataException {
+
+    }
+
+    @Override
+    public void writeAntiMatter(ATypeTag tag, IValueReference value) throws HyracksDataException {
+
+    }
+
+    @Override
+    public void writeLevel(int level) throws HyracksDataException {
+
+    }
+
+    @Override
+    public void writeLevels(int level, int count) throws HyracksDataException {
+
+    }
+
+    @Override
+    public RunLengthIntArray getDefinitionLevelsIntArray() {
+        return null;
+    }
+
+    @Override
+    public void writeNull(int level) throws HyracksDataException {
+
+    }
+
+    @Override
+    public void writeValue(IColumnValuesReader reader) throws HyracksDataException {
+
+    }
+
+    @Override
+    public int getEstimatedSize() {
+        return 0;
+    }
+
+    @Override
+    public int getEstimatedSize(int length) {
+        return 0;
+    }
+
+    @Override
+    public int getAllocatedSpace() {
+        return 0;
+    }
+
+    @Override
+    public int getCount() {
+        return 0;
+    }
+
+    @Override
+    public long getNormalizedMinValue() {
+        return 0;
+    }
+
+    @Override
+    public long getNormalizedMaxValue() {
+        return 0;
+    }
+
+    @Override
+    public void flush(OutputStream out) throws HyracksDataException {
+
+    }
+
+    @Override
+    public void close() {
+
+    }
+
+    @Override
+    public void serialize(DataOutput output) throws IOException {
+
+    }
+}

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19146
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: goldfish
Gerrit-Change-Id: I8b8634e5d901a45985d5d9a88f65fc551f6dd2e0
Gerrit-Change-Number: 19146
Gerrit-PatchSet: 1
Gerrit-Owner: Ritik Raj <ra...@gmail.com>
Gerrit-MessageType: newchange