[
https://issues.apache.org/jira/browse/SPARK-29005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16924777#comment-16924777
]
angerszhu commented on SPARK-29005:
-----------------------------------
Int is not a subclass of trait `Product`
{code:java}
def createDataFrame[A <: Product : TypeTag](data: Seq[A]): DataFrame = {
SparkSession.setActiveSession(this)
val schema = ScalaReflection.schemaFor[A].dataType.asInstanceOf[StructType]
val attributeSeq = schema.toAttributes
Dataset.ofRows(self, LocalRelation.fromProduct(attributeSeq, data))
}
{code}
> build failed: sparkSession.createDataFrame[Int](Seq(1,2))
> ---------------------------------------------------------
>
> Key: SPARK-29005
> URL: https://issues.apache.org/jira/browse/SPARK-29005
> Project: Spark
> Issue Type: Question
> Components: Spark Core
> Affects Versions: 2.3.0
> Reporter: Zhou Zach
> Priority: Trivial
> Labels: build
>
>
> Intellij Idea report:
> Error:(31, 18) type arguments [Int] conform to the bounds of none of the
> overloaded alternatives of
> value createDataFrame: [A <: Product](data: Seq[A])(implicit evidence$3:
> reflect.runtime.universe.TypeTag[A])org.apache.spark.sql.DataFrame <and> [A
> <: Product](rdd: org.apache.spark.rdd.RDD[A])(implicit evidence$2:
> reflect.runtime.universe.TypeTag[A])org.apache.spark.sql.DataFrame
> sparkSession.createDataFrame[Int](Seq(1,2))
>
> Error:(31, 18) wrong number of type parameters for overloaded method value
> createDataFrame with alternatives:
> (data: java.util.List[_],beanClass: Class[_])org.apache.spark.sql.DataFrame
> <and>
> (rdd: org.apache.spark.api.java.JavaRDD[_],beanClass:
> Class[_])org.apache.spark.sql.DataFrame <and>
> (rdd: org.apache.spark.rdd.RDD[_],beanClass:
> Class[_])org.apache.spark.sql.DataFrame <and>
> (rows: java.util.List[org.apache.spark.sql.Row],schema:
> org.apache.spark.sql.types.StructType)org.apache.spark.sql.DataFrame <and>
> (rowRDD: org.apache.spark.api.java.JavaRDD[org.apache.spark.sql.Row],schema:
> org.apache.spark.sql.types.StructType)org.apache.spark.sql.DataFrame <and>
> (rowRDD: org.apache.spark.rdd.RDD[org.apache.spark.sql.Row],schema:
> org.apache.spark.sql.types.StructType)org.apache.spark.sql.DataFrame <and>
> [A <: Product](data: Seq[A])(implicit evidence$3:
> reflect.runtime.universe.TypeTag[A])org.apache.spark.sql.DataFrame <and>
> [A <: Product](rdd: org.apache.spark.rdd.RDD[A])(implicit evidence$2:
> reflect.runtime.universe.TypeTag[A])org.apache.spark.sql.DataFrame
> sparkSession.createDataFrame[Int](Seq(1,2))
--
This message was sent by Atlassian Jira
(v8.3.2#803003)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]