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

Provide a value vector method to convert a vector to nullable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.12.0
    • Component/s: None
    • Labels:

      Description

      The hash agg spill work has need to convert a non-null scalar vector to the nullable equivalent. For efficiency, the code wishes to simply transfer the underlying data buffer(s), and create the required "bits" vector, rather than generating code that does the transfer row-by-row.

      The solution is to add a toNullable(ValueVector nullableVector) method to the ValueVector class, then implement it where needed.

      Since the target code only works with scalars (that is, no arrays, no maps, no lists), the code only handles these cases, throwing an UnsupportedOperationException in other cases.

      Usage:

      ValueVector nonNullableVector = // your non-nullable vector
      MajorType type = MajorType.newBuilder(nonNullableVector.getType)
          .setMode(DataMode.OPTIONAL)
          .build();
      MaterializedField field = MaterializedField.create(name, type);
      ValueVector nullableVector = TypeHelper.getNewVector(field, oContext.getAllocator());
      nonNullableVector.toNullable(nullableVector);
      // Data is now in nullableVector
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Paul.Rogers Paul Rogers
                Reporter:
                Paul.Rogers Paul Rogers
                Reviewer:
                Boaz Ben-Zvi
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: