Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Refine test
  • Loading branch information
maryannxue committed Jun 29, 2018
commit f45a8b8705eb6f7b40141ff528ce9c70a74da136
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ package object dsl {
}
}

def rand(e: Long): Expression = Rand(Literal.create(e, LongType))
Copy link
Member

@viirya viirya Jun 30, 2018

Choose a reason for hiding this comment

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

We can just use Rand(seed: Long). See object Rand in randomExpressions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we already have a bunch of expressions here, I don't think it would hurt to add this one?

Copy link
Member

Choose a reason for hiding this comment

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

I mean: def rand(e: Long): Expression = Rand(e).

Copy link
Member

Choose a reason for hiding this comment

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

I addressed the comment when I merged the code.

def sum(e: Expression): Expression = Sum(e).toAggregateExpression()
def sumDistinct(e: Expression): Expression = Sum(e).toAggregateExpression(isDistinct = true)
def count(e: Expression): Expression = Count(e).toAggregateExpression()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,9 @@ class ColumnPruningSuite extends PlanTest {

test("SPARK-24696 ColumnPruning rule fails to remove extra Project") {
val input = LocalRelation('key.int, 'value.string)
val query = input.select('key).where('key > 1).where('key < 10).analyze
val query = input.select('key).where(rand(0L) > 0.5).where('key < 10).analyze
val optimized = Optimize.execute(query)
val expected = input.where('key > 1).where('key < 10).select('key).analyze
val expected = input.where(rand(0L) > 0.5).where('key < 10).select('key).analyze
comparePlans(optimized, expected)
}

Expand Down