Skip to content
Snippets Groups Projects
Commit bfcaf8ad authored by Wenchen Fan's avatar Wenchen Fan Committed by Reynold Xin
Browse files

[DataFrame][minor] support column in field accessor

Minor improvement, now we can use `Column` as extraction expression.

Author: Wenchen Fan <cloud0fan@outlook.com>

Closes #6080 from cloud-fan/tmp and squashes the following commits:

0fdefb7 [Wenchen Fan] support column in field accessor
parent 0595b6de
No related branches found
No related tags found
No related merge requests found
......@@ -78,7 +78,7 @@ class Column(protected[sql] val expr: Expression) extends Logging {
*
* @group expr_ops
*/
def apply(field: Any): Column = UnresolvedExtractValue(expr, Literal(field))
def apply(extraction: Any): Column = UnresolvedExtractValue(expr, lit(extraction).expr)
/**
* Unary minus, i.e. negate the expression.
......
......@@ -456,6 +456,7 @@ class DataFrameSuite extends QueryTest {
assert(complexData.filter(complexData("a")(0) === 2).count() == 1)
assert(complexData.filter(complexData("m")("1") === 1).count() == 1)
assert(complexData.filter(complexData("s")("key") === 1).count() == 1)
assert(complexData.filter(complexData("m")(complexData("s")("value")) === 1).count() == 1)
}
test("SPARK-7324 dropDuplicates") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment