Return-Path: X-Original-To: apmail-spark-issues-archive@minotaur.apache.org Delivered-To: apmail-spark-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 622A0180BE for ; Mon, 8 Feb 2016 20:06:40 +0000 (UTC) Received: (qmail 2199 invoked by uid 500); 8 Feb 2016 20:06:40 -0000 Delivered-To: apmail-spark-issues-archive@spark.apache.org Received: (qmail 2162 invoked by uid 500); 8 Feb 2016 20:06:40 -0000 Mailing-List: contact issues-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@spark.apache.org Received: (qmail 2137 invoked by uid 99); 8 Feb 2016 20:06:40 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Feb 2016 20:06:40 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 164362C14F4 for ; Mon, 8 Feb 2016 20:06:40 +0000 (UTC) Date: Mon, 8 Feb 2016 20:06:40 +0000 (UTC) From: "Michael Armbrust (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (SPARK-13101) Dataset complex types mapping to DataFrame (element nullability) mismatch MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/SPARK-13101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Michael Armbrust resolved SPARK-13101. -------------------------------------- Resolution: Fixed Fix Version/s: (was: 1.6.1) 2.0.0 Issue resolved by pull request 11035 [https://github.com/apache/spark/pull/11035] > Dataset complex types mapping to DataFrame (element nullability) mismatch > -------------------------------------------------------------------------- > > Key: SPARK-13101 > URL: https://issues.apache.org/jira/browse/SPARK-13101 > Project: Spark > Issue Type: Bug > Components: SQL > Affects Versions: 1.6.1 > Reporter: Deenar Toraskar > Assignee: Wenchen Fan > Priority: Blocker > Fix For: 2.0.0 > > > There seems to be a regression between 1.6.0 and 1.6.1 (snapshot build). By default a scala {{Seq\[Double\]}} is mapped by Spark as an ArrayType with nullable element > {noformat} > |-- valuations: array (nullable = true) > | |-- element: double (containsNull = true) > {noformat} > This could be read back to as a Dataset in Spark 1.6.0 > {code} > val df = sqlContext.table("valuations").as[Valuation] > {code} > But with Spark 1.6.1 the same fails with > {code} > val df = sqlContext.table("valuations").as[Valuation] > org.apache.spark.sql.AnalysisException: cannot resolve 'cast(valuations as array)' due to data type mismatch: cannot cast ArrayType(DoubleType,true) to ArrayType(DoubleType,false); > {code} > Here's the classes I am using > {code} > case class Valuation(tradeId : String, > counterparty: String, > nettingAgreement: String, > wrongWay: Boolean, > valuations : Seq[Double], /* one per scenario */ > timeInterval: Int, > jobId: String) /* used for hdfs partitioning */ > val vals : Seq[Valuation] = Seq() > val valsDF = sqlContext.sparkContext.parallelize(vals).toDF > valsDF.write.partitionBy("jobId").mode(SaveMode.Overwrite).saveAsTable("valuations") > {code} > even the following gives the same result > {code} > val valsDF = vals.toDS.toDF > {code} -- 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