Skip to content

Conversation

@clockfly
Copy link
Contributor

@clockfly clockfly commented May 25, 2016

What changes were proposed in this pull request?

Fixes "Can't drop top level columns that contain dots".

This work is based on @dilipbiswal's #10943.
This PR fixes problems like:

scala> Seq((1, 2)).toDF("a.b", "a.c").drop("a.b")
org.apache.spark.sql.AnalysisException: cannot resolve '`a.c`' given input columns: [a.b, a.c];

drop(columnName) can only be used to drop top level column, so, we should parse the column name literally WITHOUT interpreting dot "."

We should also NOT interpret back tick "`", otherwise it is hard to understand what

​```aaa```bbb``

actually means.

How was this patch tested?

Unit tests.

@clockfly clockfly force-pushed the fix_drop_column branch 2 times, most recently from f74800f to 7966bb7 Compare May 25, 2016 22:26
@clockfly clockfly changed the title [SPARK-12988][SQL] Can't drop top level columns that contain dots [SPARK-12988][SQL][WIP] Can't drop top level columns that contain dots May 25, 2016
@clockfly clockfly changed the title [SPARK-12988][SQL][WIP] Can't drop top level columns that contain dots [SPARK-12988][SQL]Can't drop top level columns that contain dots May 25, 2016
@SparkQA
Copy link

SparkQA commented May 25, 2016

Test build #59303 has finished for PR 13306 at commit 7966bb7.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented May 26, 2016

Test build #59304 has finished for PR 13306 at commit 4c2fae2.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@yhuai
Copy link
Contributor

yhuai commented Jun 1, 2016

LGTM merging to master and branch 2.0.

@asfgit asfgit closed this in 06514d6 Jun 1, 2016
asfgit pushed a commit that referenced this pull request Jun 1, 2016
## What changes were proposed in this pull request?

Fixes "Can't drop top level columns that contain dots".

This work is based on dilipbiswal's #10943.
This PR fixes problems like:

```
scala> Seq((1, 2)).toDF("a.b", "a.c").drop("a.b")
org.apache.spark.sql.AnalysisException: cannot resolve '`a.c`' given input columns: [a.b, a.c];
```

`drop(columnName)` can only be used to drop top level column, so, we should parse the column name literally WITHOUT interpreting dot "."

We should also NOT interpret back tick "`", otherwise it is hard to understand what

```
​```aaa```bbb``
```

actually means.

## How was this patch tested?

Unit tests.

Author: Sean Zhong <seanzhong@databricks.com>

Closes #13306 from clockfly/fix_drop_column.

(cherry picked from commit 06514d6)
Signed-off-by: Yin Huai <yhuai@databricks.com>
@yhuai
Copy link
Contributor

yhuai commented Jun 1, 2016

This PR makes the behavior of drop and withColumn consistent. Let's decide what we do for backticks in a separate JIRA.

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