You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Jacek Laskowski (JIRA)" <ji...@apache.org> on 2018/08/30 07:33:00 UTC

[jira] [Created] (SPARK-25278) Number of output rows metric of union of views is multiplied by their occurrences

Jacek Laskowski created SPARK-25278:
---------------------------------------

             Summary: Number of output rows metric of union of views is multiplied by their occurrences
                 Key: SPARK-25278
                 URL: https://issues.apache.org/jira/browse/SPARK-25278
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 2.3.1
            Reporter: Jacek Laskowski
         Attachments: union-2-views.png, union-3-views.png

When you use a view in a union multiple times (self-union), the {{number of output rows}} metric seems to be the correct {{number of output rows}} multiplied by the occurrences of the view, e.g.
{code:java}
scala> spark.version
res0: String = 2.3.1

val name = "demo_view"
sql(s"CREATE OR REPLACE VIEW $name AS VALUES 1,2")
assert(spark.catalog.tableExists(name))

val view = spark.table(name)

assert(view.count == 2)

view.union(view).show // gives 4 for every view, but should be 2
view.union(view).union(view).show // gives 6{code}
I think it's because {{View}} logical operator is a {{MultiInstanceRelation}} (and think other {{MultiInstanceRelation}}s may also be affected).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org