Skip to content

Conversation

@marmbrus
Copy link
Contributor

For example, one might expect the following code to work, but it does not. Now you will at least get a warning with a suggestion to use aliases.

val df = sqlContext.load(path, "parquet")
val txns = df.groupBy("cust_id").agg($"cust_id", countDistinct($"day_num").as("txns"))
val spend = df.groupBy("cust_id").agg($"cust_id", sum($"extended_price").as("spend"))
val rmJoin = txns.join(spend, txns("cust_id") === spend("cust_id"), "inner")

@SparkQA
Copy link

SparkQA commented Mar 24, 2015

Test build #29075 has finished for PR 5163 at commit 16c1f0b.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class Column(protected[sql] val expr: Expression) extends Logging

@yhuai
Copy link
Contributor

yhuai commented Mar 24, 2015

LGTM

asfgit pushed a commit that referenced this pull request Mar 24, 2015
For example, one might expect the following code to work, but it does not.  Now you will at least get a warning with a suggestion to use aliases.

```scala
val df = sqlContext.load(path, "parquet")
val txns = df.groupBy("cust_id").agg($"cust_id", countDistinct($"day_num").as("txns"))
val spend = df.groupBy("cust_id").agg($"cust_id", sum($"extended_price").as("spend"))
val rmJoin = txns.join(spend, txns("cust_id") === spend("cust_id"), "inner")
```

Author: Michael Armbrust <[email protected]>

Closes #5163 from marmbrus/selfJoinError and squashes the following commits:

16c1f0b [Michael Armbrust] fix visibility
1b57e8d [Michael Armbrust] Warn when constructing trivially true equals predicate

(cherry picked from commit 32efadd)
Signed-off-by: Michael Armbrust <[email protected]>
@asfgit asfgit closed this in 32efadd Mar 24, 2015
@marmbrus marmbrus deleted the selfJoinError branch August 3, 2015 22:55
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.

3 participants