Skip to content

Conversation

@Zouxxyy
Copy link
Contributor

@Zouxxyy Zouxxyy commented Sep 26, 2024

Purpose

to #4209, Support nested col pruning, e.g.

CREATE TABLE students (
    name STRING,
    age INT,
    course STRUCT<course_name: STRING, grade: DOUBLE>
) USING paimon;
SELECT course.grade FROM students;

will only obtain course.grade from colume-storage-format (parquet, orc)

Tests

API and Format

Documentation

@Zouxxyy Zouxxyy force-pushed the dev/spark-nested branch 3 times, most recently from c5711df to c0fdb15 Compare September 26, 2024 17:38
Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there some configuration to disable nested projection? I am concern about bugs in nested projection, at least, we should have option to disable it.

@Zouxxyy
Copy link
Contributor Author

Zouxxyy commented Oct 8, 2024

Are there some configuration to disable nested projection? I am concern about bugs in nested projection, at least, we should have option to disable it.

yes, spark has a conf to enabled nestedSchemaPruning

  val NESTED_SCHEMA_PRUNING_ENABLED =
    buildConf("spark.sql.optimizer.nestedSchemaPruning.enabled")
      .internal()
      .doc("Prune nested fields from a logical relation's output which are unnecessary in " +
        "satisfying a query. This optimization allows columnar file format readers to avoid " +
        "reading unnecessary nested column data. Currently Parquet and ORC are the " +
        "data sources that implement this optimization.")
      .version("2.4.1")
      .booleanConf
      .createWithDefault(true)

String fieldName = field.name();
if (parquetGroup.containsField(fieldName)) {
Type type = parquetGroup.getType(fieldName);
if (type instanceof GroupType && field.type() instanceof RowType) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can Spark push down nested fields for array and map?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It support, update

Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@JingsongLi JingsongLi merged commit 20a3967 into apache:master Oct 9, 2024
@Zouxxyy Zouxxyy deleted the dev/spark-nested branch October 9, 2024 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants