Github user bitblender commented on a diff in the pull request:

    https://github.com/apache/drill/pull/783#discussion_r111289506
  
    --- Diff: exec/vector/src/main/codegen/templates/ColumnAccessors.java ---
    @@ -0,0 +1,333 @@
    +/*
    + * 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.
    + */
    +
    +<@pp.dropOutputFile />
    +<@pp.changeOutputFile 
name="/org/apache/drill/exec/vector/accessor/ColumnAccessors.java" />
    +<#include "/@includes/license.ftl" />
    +<#macro getType label>
    +    @Override
    +    public ValueType valueType() {
    +  <#if label == "Int">
    +      return ValueType.INTEGER;
    +  <#else>
    +      return ValueType.${label?upper_case};
    +  </#if>
    +    }
    +</#macro>
    +<#macro bindReader prefix drillType>
    +  <#if drillType = "Decimal9" || drillType == "Decimal18">
    +    private MaterializedField field;
    +  </#if>
    +    private ${prefix}${drillType}Vector.Accessor accessor;
    +
    +    @Override
    +    public void bind(RowIndex vectorIndex, ValueVector vector) {
    +      bind(vectorIndex);
    +  <#if drillType = "Decimal9" || drillType == "Decimal18">
    +      field = vector.getField();
    +  </#if>
    +      accessor = ((${prefix}${drillType}Vector) vector).getAccessor();
    +    }
    +
    +  <#if drillType = "Decimal9" || drillType == "Decimal18">
    +    @Override
    +    public void bind(RowIndex vectorIndex, MaterializedField field, 
VectorAccessor va) {
    +      bind(vectorIndex, field, va);
    +      this.field = field;
    +    }
    +
    + </#if>
    +   private ${prefix}${drillType}Vector.Accessor accessor() {
    +      if (vectorAccessor == null) {
    +        return accessor;
    +      } else {
    +        return ((${prefix}${drillType}Vector) 
vectorAccessor.vector()).getAccessor();
    +      }
    +    }
    +</#macro>
    +<#macro get drillType accessorType label isArray>
    +    @Override
    +    public ${accessorType} get${label}(<#if isArray>int index</#if>) {
    +  <#if isArray>
    +    <#assign index=", index"/>
    +    <#assign getObject="getSingleObject">
    +  <#else>
    +    <#assign index=""/>
    +    <#assign getObject="getObject">
    +  </#if>
    +  <#if drillType == "VarChar">
    +      return new String(accessor().get(vectorIndex.index()${index}), 
Charsets.UTF_8);
    +  <#elseif drillType == "Var16Char">
    +      return new String(accessor().get(vectorIndex.index()${index}), 
Charsets.UTF_16);
    +  <#elseif drillType == "VarBinary">
    +      return accessor().get(vectorIndex.index()${index});
    +  <#elseif drillType == "Decimal9" || drillType == "Decimal18">
    +      return DecimalUtility.getBigDecimalFromPrimitiveTypes(
    +                accessor().get(vectorIndex.index()${index}),
    +                field.getScale(),
    +                field.getPrecision());
    +  <#elseif accessorType == "Decimal18">
    +      return 
DecimalUtilities.getBigDecimalFromPrimitiveTypes(accessor().${getObject}(vectorIndex.index()${index});
    --- End diff --
    
    As discusses offline, this seems to be deadcode as there is no 
DecimalUtilities class in the Drill source base.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to