Skip to content

Instantly share code, notes, and snippets.

@kindofblue
Forked from jzhuge/explain_so
Created December 27, 2023 21:50
Show Gist options
  • Save kindofblue/2e1ad5de819abc890a6744542f2a6c6b to your computer and use it in GitHub Desktop.
Save kindofblue/2e1ad5de819abc890a6744542f2a6c6b to your computer and use it in GitHub Desktop.
Writing to iceberg table with sort order after coalesce
== Parsed Logical Plan ==
OverwriteByExpression RelationV2[id#61L] prodhive.jzhuge.wso_244_so_1633558130, true, Map(matchByName -> true), true
+- Repartition 4, false
+- Sort [id#3L ASC NULLS FIRST], true
+- Project [id#0L AS id#3L]
+- Range (0, 100000, step=1, splits=Some(6))
== Analyzed Logical Plan ==
OverwriteByExpression RelationV2[id#61L] prodhive.jzhuge.wso_244_so_1633558130, true, Map(matchByName -> true), true
+- Repartition 4, false
+- Sort [id#3L ASC NULLS FIRST], true
+- Project [id#0L AS id#3L]
+- Range (0, 100000, step=1, splits=Some(6))
== Optimized Logical Plan ==
OverwriteByExpression RelationV2[id#61L] prodhive.jzhuge.wso_244_so_1633558130, true, Map(matchByName -> true), true, IcebergWrite schema=struct<id: bigint not null>, format=parquet
+- Sort [id#0L ASC NULLS FIRST], false
+- RepartitionByExpression [id#0L ASC NULLS FIRST], 500
+- Repartition 4, false
+- Range (0, 100000, step=1, splits=Some(6))
== Physical Plan ==
OverwriteByExpression prodhive.jzhuge.wso_244_so_1633558130, [AlwaysTrue()], org.apache.spark.sql.util.CaseInsensitiveStringMap@7bdc4108, true, IcebergOverwriteByFilter(table=prodhive.jzhuge.wso_244_so_1633558130, format=PARQUET, filter=true)
+- *(2) Sort [id#0L ASC NULLS FIRST], false, 0
+- Exchange rangepartitioning(id#0L ASC NULLS FIRST, 500)
+- Coalesce 4
+- *(1) Range (0, 100000, step=1, splits=6)
== Parsed Logical Plan ==
OverwritePartitionsDynamic RelationV2[id#77L, part#78L] prodhive.jzhuge.wso_244_so_part_1633558130, Map(matchByName -> true), true
+- Repartition 4, false
+- Project [id#3L, (id#3L % cast(2 as bigint)) AS part#65L]
+- Sort [id#3L ASC NULLS FIRST], true
+- Project [id#0L AS id#3L]
+- Range (0, 100000, step=1, splits=Some(6))
== Analyzed Logical Plan ==
OverwritePartitionsDynamic RelationV2[id#77L, part#78L] prodhive.jzhuge.wso_244_so_part_1633558130, Map(matchByName -> true), true
+- Repartition 4, false
+- Project [id#3L, (id#3L % cast(2 as bigint)) AS part#65L]
+- Sort [id#3L ASC NULLS FIRST], true
+- Project [id#0L AS id#3L]
+- Range (0, 100000, step=1, splits=Some(6))
== Optimized Logical Plan ==
OverwritePartitionsDynamic RelationV2[id#77L, part#78L] prodhive.jzhuge.wso_244_so_part_1633558130, Map(matchByName -> true), true, IcebergWrite schema=struct<id: bigint not null,part: bigint>, format=parquet
+- Sort [part#65L ASC NULLS FIRST, id#0L ASC NULLS FIRST], false
+- RepartitionByExpression [part#65L ASC NULLS FIRST, id#0L ASC NULLS FIRST], 500
+- Repartition 4, false
+- Project [id#0L, (id#0L % 2) AS part#65L]
+- Range (0, 100000, step=1, splits=Some(6))
== Physical Plan ==
OverwritePartitionsDynamic prodhive.jzhuge.wso_244_so_part_1633558130, org.apache.spark.sql.util.CaseInsensitiveStringMap@7bdc4108, IcebergDynamicOverwrite(table=prodhive.jzhuge.wso_244_so_part_1633558130, format=PARQUET)
+- *(2) Sort [part#65L ASC NULLS FIRST, id#0L ASC NULLS FIRST], false, 0
+- Exchange rangepartitioning(part#65L ASC NULLS FIRST, id#0L ASC NULLS FIRST, 500)
+- Coalesce 4
+- *(1) Project [id#0L, (id#0L % 2) AS part#65L]
+- *(1) Range (0, 100000, step=1, splits=6)
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
spark-sql> SHOW TBLPROPERTIES jzhuge.wso_244_so_1633558130;
sort-order id ASC NULLS FIRST
format iceberg/parquet
current-snapshot-id 1949824784145854272
provider iceberg
write.distribution-mode none
spark-sql> SHOW TBLPROPERTIES jzhuge.wso_244_so_part_1633558130;
current-snapshot-id 6079782482913875055
format iceberg/parquet
sort-order part ASC NULLS FIRST, id ASC NULLS FIRST
provider iceberg
write.distribution-mode none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment