Giter Site home page Giter Site logo

Comments (6)

rapoth avatar rapoth commented on May 22, 2024

CC: @sezruby

from hyperspace.

rapoth avatar rapoth commented on May 22, 2024

CC: @imback82

from hyperspace.

imback82 avatar imback82 commented on May 22, 2024

I think this should have been fixed by apache/spark#26943 in Spark 3.0, and I don't think it's worthwhile to update the rule to support this scenario for Spark 2.4.

For the following:

spark.conf.set("spark.sql.autoBroadcastJoinThreshold", "-1")
val df1 = (0 until 100).map(i => (i % 5, i % 11)).toDF("i1", "j1")
val df2 = (0 until 100).map(i => (i % 7, i % 11)).toDF("i2", "j2")
df1.write.format("parquet").bucketBy(8, "i1").saveAsTable("t1")
df2.write.format("parquet").bucketBy(8, "i2").saveAsTable("t2")
sql("SELECT t1.i1, t2Temp.aliasC FROM t1 INNER JOIN (SELECT i2 as aliasC from t2) as t2Temp WHERE t1.i1 = t2Temp.aliasC").explain

Spark 2.4.5 outputs:

== Physical Plan ==
*(5) SortMergeJoin [i1#31], [aliasC#37], Inner
:- *(2) Sort [i1#31 ASC NULLS FIRST], false, 0
:  +- Exchange hashpartitioning(i1#31, 200)
:     +- *(1) Project [i1#31]
:        +- *(1) Filter isnotnull(i1#31)
:           +- *(1) FileScan parquet default.t1[i1#31] Batched: true, Format: Parquet, Location: InMemoryFileIndex[file:...], PartitionFilters: [], PushedFilters: [IsNotNull(i1)], ReadSchema: struct<i1:int>, SelectedBucketsCount: 8 out of 8
+- *(4) Sort [aliasC#37 ASC NULLS FIRST], false, 0
   +- Exchange hashpartitioning(aliasC#37, 200)
      +- *(3) Project [i2#33 AS aliasC#37]
         +- *(3) Filter isnotnull(i2#33)
            +- *(3) FileScan parquet default.t2[i2#33] Batched: true, Format: Parquet, Location: InMemoryFileIndex[file:...], PartitionFilters: [], PushedFilters: [IsNotNull(i2)], ReadSchema: struct<i2:int>, SelectedBucketsCount: 8 out of 8

whereas Spark 3.0 prints:

== Physical Plan ==
*(3) SortMergeJoin [i1#27], [aliasC#33], Inner
:- *(1) Sort [i1#27 ASC NULLS FIRST], false, 0
:  +- *(1) Project [i1#27]
:     +- *(1) Filter isnotnull(i1#27)
:        +- *(1) ColumnarToRow
:           +- FileScan parquet default.t1[i1#27] Batched: true, DataFilters: [isnotnull(i1#27)], Format: Parquet, Location: InMemoryFileIndex[file:...], PartitionFilters: [], PushedFilters: [IsNotNull(i1)], ReadSchema: struct<i1:int>, SelectedBucketsCount: 8 out of 8
+- *(2) Sort [aliasC#33 ASC NULLS FIRST], false, 0
   +- *(2) Project [i2#29 AS aliasC#33]
      +- *(2) Filter isnotnull(i2#29)
         +- *(2) ColumnarToRow
            +- FileScan parquet default.t2[i2#29] Batched: true, DataFilters: [isnotnull(i2#29)], Format: Parquet, Location: InMemoryFileIndex[file:...], PartitionFilters: [], PushedFilters: [IsNotNull(i2)], ReadSchema: struct<i2:int>, SelectedBucketsCount: 8 out of 8

from hyperspace.

rapoth avatar rapoth commented on May 22, 2024

Great thanks! I'm closing this issue.

from hyperspace.

imback82 avatar imback82 commented on May 22, 2024

@apoorvedave1 Can you confirm if this is not needed in the join rule? I see that we clean up the aliases, so matching should be ok, right?

from hyperspace.

apoorvedave1 avatar apoorvedave1 commented on May 22, 2024

yes this looks like a solved issue now. Thanks for checking @imback82

from hyperspace.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.