Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-5690

RepeatedDecimal18Vector does not pass scale, precision to data vector

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.10.0
    • 1.13.0
    • None
    • None

    Description

      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.

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

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

      Attachments

        Issue Links

          Activity

            People

              Paul.Rogers Paul Rogers
              paul-rogers Paul Rogers
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: