You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by cloud-fan <gi...@git.apache.org> on 2016/09/15 09:37:29 UTC

[GitHub] spark pull request #14527: [SPARK-16938][SQL] `drop/dropDuplicate` should ha...

Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14527#discussion_r78924274
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala ---
    @@ -1827,7 +1827,7 @@ class Dataset[T] private[sql](
         val resolver = sparkSession.sessionState.analyzer.resolver
         val allColumns = queryExecution.analyzed.output
         val remainingCols = allColumns.filter { attribute =>
    -      colNames.forall(n => !resolver(attribute.name, n))
    +      colNames.forall(n => !(resolver(attribute.name, n) || resolver(attribute.qualifiedName, n)))
    --- End diff --
    
    This is fragile, what if we wanna drop a qualified column with special characters like  "a.\`b c\`"? Users may wanna do ``df.drop("a.`b c`")`` instead of ``df.drop("a.b c")``, and what if we just wanna drop a column named `a.b c`?
    
    The current semantic of `drop` is, if the parameter is string, we treat it as column name literal, without any parsing, which is different from `select`. If users do wanna use a qualified column name to refer to a specific column, they should use the `drop` with `Column` parameter.
    
    I think the same semantic should apply to `dropDuplicates`, i.e. we should add a new version that takes `Seq[Column]` as parameter.
    
     


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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