[ 
https://issues.apache.org/jira/browse/DRILL-6114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16366640#comment-16366640
 ] 

ASF GitHub Bot commented on DRILL-6114:
---------------------------------------

Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1112#discussion_r168682152
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/record/metadata/MetadataUtils.java
 ---
    @@ -0,0 +1,165 @@
    +/*
    + * 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.List;
    +
    +import org.apache.drill.common.types.TypeProtos.DataMode;
    +import org.apache.drill.common.types.TypeProtos.MinorType;
    +import org.apache.drill.exec.record.BatchSchema;
    +import org.apache.drill.exec.record.MaterializedField;
    +
    +public class MetadataUtils {
    +
    +  public static TupleSchema fromFields(Iterable<MaterializedField> fields) 
{
    +    TupleSchema tuple = new TupleSchema();
    +    for (MaterializedField field : fields) {
    +      tuple.add(field);
    +    }
    +    return tuple;
    +  }
    +
    +  /**
    +   * Create a column metadata object that holds the given
    +   * {@link MaterializedField}. The type of the object will be either a
    +   * primitive or map column, depending on the field's type. The logic
    +   * here mimics the code as written, which is very messy in some places.
    +   *
    +   * @param field the materialized field to wrap
    +   * @return the column metadata that wraps the field
    +   */
    +
    +  public static AbstractColumnMetadata fromField(MaterializedField field) {
    +    MinorType type = field.getType().getMinorType();
    +    switch (type) {
    +    case MAP:
    +      return MetadataUtils.newMap(field);
    +    case UNION:
    +      if (field.getType().getMode() != DataMode.OPTIONAL) {
    +        throw new UnsupportedOperationException(type.name() + " type must 
be nullable");
    +      }
    +      return new VariantColumnMetadata(field);
    +    case LIST:
    +      switch (field.getType().getMode()) {
    +      case OPTIONAL:
    +
    +        // List of unions (or a degenerate union of a single type.)
    +        // Not supported in Drill.
    --- End diff --
    
    We do. This comment is in the wrong place, should be in default.


> Complete internal metadata layer for improved batch handling
> ------------------------------------------------------------
>
>                 Key: DRILL-6114
>                 URL: https://issues.apache.org/jira/browse/DRILL-6114
>             Project: Apache Drill
>          Issue Type: Improvement
>            Reporter: Paul Rogers
>            Assignee: Paul Rogers
>            Priority: Major
>             Fix For: 1.13.0
>
>
> Slice of the ["batch handling" 
> project.|https://github.com/paul-rogers/drill/wiki/Batch-Handling-Upgrades] 
> that includes enhancements to the internal metadata system.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to