Paul Rogers created DRILL-5690:
----------------------------------

             Summary: RepeatedDecimal18Vector does not pass scale, precision to 
data vector
                 Key: DRILL-5690
                 URL: https://issues.apache.org/jira/browse/DRILL-5690
             Project: Apache Drill
          Issue Type: Bug
    Affects Versions: 1.10.0
            Reporter: Paul Rogers
            Assignee: Paul Rogers
             Fix For: 1.12.0


Decimal types require not just the type (Decimal9, Decimal18, etc.) but also a 
precision and scale. The triple of (minor type, precision, scale) appears in 
the {{MaterializedField}} for the nullable or required vectors.

A repeated vector has three parts: the {{RepeatedDecimal18Vector}} which is 
composed of a {{UInt4Vector}} offset vector and a {{Decimal18Vector}} that 
holds values.

When {{RepeatedDecimal18Vector}} creates the {{Decimal18Vector}} to hold the 
values, it clones the {{MaterializedField}}. But, it *does not* clone the scale 
and precision, resulting in the loss of critical information.

{code}
  public RepeatedDecimal18Vector(MaterializedField field, BufferAllocator 
allocator) {
    super(field, allocator);
    
addOrGetVector(VectorDescriptor.create(Types.required(field.getType().getMinorType())));
  }
{code}

This is normally not a problem because most code access the data via the 
repeated vector. But, for code that needs to work with the values, the results 
are wrong given that the types are wrong. (Values stored with one scale, 
123.45, (scale 2) will be retrieved with 0 scale (123, say).




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to