You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Takeshi Yamamuro (JIRA)" <ji...@apache.org> on 2017/09/28 02:14:01 UTC
[jira] [Commented] (SPARK-22152) Add Dataset flatten function
[ https://issues.apache.org/jira/browse/SPARK-22152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16183570#comment-16183570 ]
Takeshi Yamamuro commented on SPARK-22152:
------------------------------------------
`Dataset[Option[T]]` is used in a natural usecase? Usually, we can use null instead to represent if it exists or not?
{code}
scala> case class Data(a: Option[Int])
defined class Data
scala> val ds = Seq(Data(Some(1)), Data(None)).toDS
ds: org.apache.spark.sql.Dataset[Data] = [a: int]
scala> ds.show
+----+
| a|
+----+
| 1|
|null|
+----+
{code}
> Add Dataset flatten function
> ----------------------------
>
> Key: SPARK-22152
> URL: https://issues.apache.org/jira/browse/SPARK-22152
> Project: Spark
> Issue Type: New Feature
> Components: SQL
> Affects Versions: 2.2.0
> Reporter: Drew Robb
> Priority: Minor
>
> Currently you can use an identify flatMap to flatten a Dataset, for example to get from a Dataset[Option[T]] to a Dataset[T], but adding flatten directly would allow for a more similar API to scala collections.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org