Skip to content

Do't throw the error when projected columns are not in the table schema #3492

Open

Description

@liukun4515

In the case where the table has projected columns (like in parquet_multiple_partitions where we project columns from the hive partition directory structure) then the projected columns are not in the table schema.

If the predicate contains any such projected columns then we ignore it anyway. So I think this change is fine but with the one adjustment that we don't return an error. So maybe

if let Ok(field) self.table_schema.field_with_name(name) {
    // return the null value corresponding to the data type
    let null_value = ScalarValue::try_from(field.data_type())?;
    return Ok(Expr::Literal(null_value));
}

In this case we just won't rewrite the expression but also FilterCandidateBuilder.projected_columns will be true so we won't crate a row filter predicate for the Expr.

Originally posted by @thinkharderdev in #3470 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions