[ https://issues.apache.org/jira/browse/SPARK-24148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16461064#comment-16461064 ]
Apache Spark commented on SPARK-24148: -------------------------------------- User 'mn-mikke' has created a pull request for this issue: https://github.com/apache/spark/pull/21215 > Adding Ability to Specify SQL Type of Empty Arrays > -------------------------------------------------- > > Key: SPARK-24148 > URL: https://issues.apache.org/jira/browse/SPARK-24148 > Project: Spark > Issue Type: Improvement > Components: SQL > Affects Versions: 2.4.0 > Reporter: Marek Novotny > Priority: Major > > The function array(...) doesn't let user specify the element type and uses > string as default. > This is a shortcoming in the API as the developer either needs a scala case > class and let catalyst infer the schema or by using the Java UDF API. > This Jira suggests ehnancement of the array function, which will produce an > empty array of a given element type. > A perfect example of the use case is {{when(cond, > trueExp).otherwise(falseExp)}}, which expects {{trueExp}} and {{falseExp}} of > being the same type. In scenario where we want to produce an empty array, in > one of these cases, there's no other way than creating an UDF. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org