You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Bo Meng (JIRA)" <ji...@apache.org> on 2016/06/23 18:56:16 UTC

[jira] [Commented] (SPARK-15230) Back quoted column with dot in it fails when running distinct on dataframe

    [ https://issues.apache.org/jira/browse/SPARK-15230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15346981#comment-15346981 ] 

Bo Meng commented on SPARK-15230:
---------------------------------

Can anyone update the "Component/s" of this JIRA? It should belongs to "SQL" not "Examples". Thanks.

> Back quoted column with dot in it fails when running distinct on dataframe
> --------------------------------------------------------------------------
>
>                 Key: SPARK-15230
>                 URL: https://issues.apache.org/jira/browse/SPARK-15230
>             Project: Spark
>          Issue Type: Bug
>          Components: Examples
>    Affects Versions: 1.6.0
>            Reporter: Barry Becker
>            Assignee: Bo Meng
>             Fix For: 2.0.1
>
>
> When working with a dataframe columns with .'s in them must be backquoted (``) or the column name will not be found. This works for most dataframe methods, but I discovered that it does not work for distinct().
> Suppose you have a dataFrame, testDf, with a DoubleType column named {{pos.NoZero}}.  This statememt:
> {noformat}
> testDf.select(new Column("`pos.NoZero`")).distinct().collect().mkString(", ")
> {noformat}
> will fail with this error:
> {noformat}
> org.apache.spark.sql.AnalysisException: Cannot resolve column name "pos.NoZero" among (pos.NoZero);
> 	at org.apache.spark.sql.DataFrame$$anonfun$resolve$1.apply(DataFrame.scala:152)
> 	at org.apache.spark.sql.DataFrame$$anonfun$resolve$1.apply(DataFrame.scala:152)
> 	at scala.Option.getOrElse(Option.scala:121)
> 	at org.apache.spark.sql.DataFrame.resolve(DataFrame.scala:151)
> 	at org.apache.spark.sql.DataFrame$$anonfun$dropDuplicates$1$$anonfun$40.apply(DataFrame.scala:1329)
> 	at org.apache.spark.sql.DataFrame$$anonfun$dropDuplicates$1$$anonfun$40.apply(DataFrame.scala:1329)
> 	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
> 	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
> 	at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
> 	at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:35)
> 	at scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
> 	at scala.collection.AbstractTraversable.map(Traversable.scala:104)
> 	at org.apache.spark.sql.DataFrame$$anonfun$dropDuplicates$1.apply(DataFrame.scala:1329)
> 	at org.apache.spark.sql.DataFrame$$anonfun$dropDuplicates$1.apply(DataFrame.scala:1328)
> 	at org.apache.spark.sql.DataFrame.org$apache$spark$sql$DataFrame$$withPlan(DataFrame.scala:2165)
> 	at org.apache.spark.sql.DataFrame.dropDuplicates(DataFrame.scala:1328)
> 	at org.apache.spark.sql.DataFrame.dropDuplicates(DataFrame.scala:1348)
> 	at org.apache.spark.sql.DataFrame.dropDuplicates(DataFrame.scala:1319)
> 	at org.apache.spark.sql.DataFrame.distinct(DataFrame.scala:1612)
> 	at com.mineset.spark.vizagg.selection.SelectionExpressionSuite$$anonfun$40.apply$mcV$sp(SelectionExpressionSuite.scala:317)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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