arina-ielchiieva commented on a change in pull request #1829: DRILL-7096: 
Develop vector for canonical Map<K,V>
URL: https://github.com/apache/drill/pull/1829#discussion_r317078570
 
 

 ##########
 File path: 
exec/vector/src/main/java/org/apache/drill/exec/vector/complex/DictVector.java
 ##########
 @@ -0,0 +1,321 @@
+/*
+ * 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.drill.exec.vector.complex;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.drill.common.exceptions.DrillRuntimeException;
+import org.apache.drill.common.types.TypeProtos.MajorType;
+import org.apache.drill.common.types.TypeProtos.MinorType;
+import org.apache.drill.common.types.Types;
+import org.apache.drill.exec.expr.holders.RepeatedValueHolder;
+import org.apache.drill.exec.expr.holders.DictHolder;
+import org.apache.drill.exec.memory.BufferAllocator;
+import org.apache.drill.exec.record.MaterializedField;
+import org.apache.drill.exec.record.TransferPair;
+import org.apache.drill.exec.util.CallBack;
+import org.apache.drill.exec.util.JsonStringHashMap;
+import org.apache.drill.exec.vector.ValueVector;
+import org.apache.drill.exec.vector.complex.impl.SingleDictReaderImpl;
+
+/**
+ * A {@link ValueVector} holding key-value pairs.
+ * <p>This vector is essentially a {@link RepeatedMapVector} but with 
constraints:
+ * it may have 2 children only, named {@link #FIELD_KEY_NAME} and {@link 
#FIELD_VALUE_NAME}.
+ * The {@link #FIELD_KEY_NAME} can be of primitive type only and its values 
should not be {@code null},
+ * while the other, {@link #FIELD_VALUE_NAME}, field can be either of 
primitive or complex type.
+ *
+ * <p>This vector has it's own {@link 
org.apache.drill.exec.vector.complex.reader.FieldReader} and
+ * {@link org.apache.drill.exec.vector.complex.writer.FieldWriter} to ensure 
data is read and written correctly.
+ * In addition, the reader is responsible for getting a value for a given key.
+ *
+ * <p>Additionally, {@code Object} representation is changed in {@link 
Accessor#getObject(int)}
+ * to represent it as {@link JsonStringHashMap} with appropriate {@code key} 
and {@code value} types.
+ *
+ * <p>(The structure corresponds to Java's notion of {@link Map}).
+ *
+ * @see SingleDictReaderImpl reader corresponding to the vector
+ * @see org.apache.drill.exec.vector.complex.impl.SingleDictWriter writer 
corresponding to the vector
+ */
+public final class DictVector extends AbstractRepeatedMapVector {
+
+  public final static MajorType TYPE = Types.optional(MinorType.DICT);
+
+  public static final String FIELD_KEY_NAME = "key";
+  public static final String FIELD_VALUE_NAME = "value";
+  public static final List<String> fieldNames = 
Collections.unmodifiableList(Arrays.asList(FIELD_KEY_NAME, FIELD_VALUE_NAME));
+
+  private static final org.slf4j.Logger logger = 
org.slf4j.LoggerFactory.getLogger(DictVector.class);
 
 Review comment:
   Imports...

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to