spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Barry Becker (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SPARK-15230) Back quoted column with dot in it fails when running distinct on dataframe
Date Mon, 16 May 2016 21:14:12 GMT

     [ https://issues.apache.org/jira/browse/SPARK-15230?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Barry Becker updated SPARK-15230:
---------------------------------
    Description: 
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}


  was:
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 describe().

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}



> 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
>
> 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


Mime
View raw message