Skip to content

Leverage dictionary-encode when turning a scalar columnar value into an array #11503

@doki23

Description

@doki23

Is your feature request related to a problem or challenge?

We have a into_array function of ColumnarValue which converts it into an arrow array like this:

pub fn into_array(self, num_rows: usize) -> Result<ArrayRef> {
      Ok(match self {
          ColumnarValue::Array(array) => array,
          ColumnarValue::Scalar(scalar) => scalar.to_array_of_size(num_rows)?,
      })
  }

If this column is of an Int32 type, it returns an Int32Array.
Given that the ColumnarValue::Scalar's cardinality is 1, in some special cases, we can turn it into a dictionary array in order to obtain some performance gains.

Describe the solution you'd like

For example, if we want to turn a scalar value of f64 type into an array of size 256, we can return a dictionary f64 array of uint8 key type.

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions