paul-rogers commented on a change in pull request #2051: DRILL-7696: EVF v2 
scan schema resolution
URL: https://github.com/apache/drill/pull/2051#discussion_r407251403
 
 

 ##########
 File path: 
exec/vector/src/main/java/org/apache/drill/exec/record/metadata/DynamicColumn.java
 ##########
 @@ -0,0 +1,87 @@
+/*
+ * 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.record.metadata;
+
+import java.util.Objects;
+
+import org.apache.drill.common.types.TypeProtos.DataMode;
+import org.apache.drill.common.types.TypeProtos.MinorType;
+import org.apache.drill.exec.record.MaterializedField;
+
+/**
+ * A dynamic column has a name but not a type. The column may be
+ * a map, array or scalar: we don't yet know. A dynamic column is
+ * the equivalent of an item in a name-only project list. This type
+ * can also represent a wildcard. A dynamic column is not a concrete
+ * data description: it must be resolved to an actual type before
+ * it can be used to create vectors, readers, writers, etc. The
+ * dynamic column allows the tuple metadata to be used to represent
+ * all phases of a schema lifecycle, including Drill's "dynamic"
+ * schema before a reader resolves the column to some actual
+ * type.
+ */
+public class DynamicColumn extends AbstractColumnMetadata {
+
+  // Same as SchemaPath.DYNAMIC_STAR, but SchemaPath is not visible here.
+  public static final String WILDCARD = "**";
+  public static final DynamicColumn WILDCARD_COLUMN = new 
DynamicColumn(WILDCARD);
+
+  public DynamicColumn(String name) {
+    super(name, MinorType.LATE, DataMode.REQUIRED);
+  }
+
+  @Override
+  public StructureType structureType() { return StructureType.DYNAMIC; }
+
+  @Override
+  public boolean isDynamic() { return true; }
+
+  @Override
+  public MaterializedField schema() {
+    return MaterializedField.create(name, majorType());
+  }
+
+  @Override
+  public MaterializedField emptySchema() {
+    return schema();
+  }
+
+  @Override
+  public ColumnMetadata cloneEmpty() {
+    return copy();
+  }
+
+  @Override
+  public ColumnMetadata copy() {
+    return new DynamicColumn(name);
+  }
+
+  @Override
+  public boolean equals(Object o) {
 
 Review comment:
   AFAIK, we only need hash code if the objects will be keys, which these 
should not be. (The name can be a key, but the whole object won't be.)
   
   Your comment pointed out that we don't have an `equals()` methods in these 
classes. The original code punted and used the code from `MaterializedField`. 
(I probably wrote that code.) Fixed that.

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