drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vvysotskyi <...@git.apache.org>
Subject [GitHub] drill pull request #570: DRILL-4834 decimal implementation is vulnerable to ...
Date Tue, 09 Jan 2018 18:52:03 GMT
Github user vvysotskyi commented on a diff in the pull request:

    https://github.com/apache/drill/pull/570#discussion_r160476071
  
    --- Diff: exec/java-exec/src/main/codegen/templates/Decimal/DecimalFunctions.java ---
    @@ -102,7 +111,578 @@
     <#-- For each DECIMAL... type (in DecimalTypes.tdd) ... -->
     <#list comparisonTypesDecimal.decimalTypes as type>
     
    -<#if type.name.endsWith("Sparse")>
    +<#if type.name.endsWith("VarDecimal")>
    +
    +<@pp.changeOutputFile name="/org/apache/drill/exec/expr/fn/impl/${type.name}Functions.java"
/>
    +
    +<#include "/@includes/license.ftl" />
    +
    +package org.apache.drill.exec.expr.fn.impl;
    +
    +<#include "/@includes/vv_imports.ftl" />
    +
    +import org.apache.drill.exec.expr.DrillSimpleFunc;
    +import org.apache.drill.exec.expr.annotations.FunctionTemplate;
    +import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling;
    +import org.apache.drill.exec.expr.annotations.Output;
    +import org.apache.drill.exec.expr.annotations.Param;
    +import org.apache.drill.exec.expr.annotations.Workspace;
    +import org.apache.drill.exec.expr.fn.FunctionGenerationHelper;
    +import org.apache.drill.exec.expr.holders.*;
    +import org.apache.drill.exec.record.RecordBatch;
    +
    +import io.netty.buffer.ByteBuf;
    +import io.netty.buffer.DrillBuf;
    +
    +import java.nio.ByteBuffer;
    +
    +@SuppressWarnings("unused")
    +public class ${type.name}Functions {
    +    private static void initBuffer(DrillBuf buffer) {
    +        // for VarDecimal, this method of setting initial size is actually only a very
rough heuristic.
    +        int size = (${type.storage} * (org.apache.drill.exec.util.DecimalUtility.INTEGER_SIZE));
    +        buffer = buffer.reallocIfNeeded(size);
    +     }
    +
    +    @FunctionTemplate(name = "subtract", scope = FunctionTemplate.FunctionScope.DECIMAL_ADD_SCALE,
nulls = NullHandling.NULL_IF_NULL)
    --- End diff --
    
    Please specify `FunctionTemplate` correct scope, returnType and checkPrecisionRange for
all functions in this class.
      


---

Mime
View raw message