[ https://issues.apache.org/jira/browse/SPARK-22771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16289539#comment-16289539 ]
Takeshi Yamamuro commented on SPARK-22771: ------------------------------------------ fyi: postgresql has the behaiouvr as you said; {code} postgres=# create table t1(a bytea, b bytea); CREATE TABLE postgres=# create view v1 as select a || b from t1; CREATE VIEW postgres=# \d v1 View "public.v1" Column | Type | Modifiers ----------+-------+----------- ?column? | bytea | postgres=# create table t2 (a varchar, b bytea); CREATE TABLE postgres=# create view v2 as select a || b from t2; CREATE VIEW postgres=# \d v2 View "public.v2" Column | Type | Modifiers ----------+------+----------- ?column? | text | {code} > SQL concat for binary > ---------------------- > > Key: SPARK-22771 > URL: https://issues.apache.org/jira/browse/SPARK-22771 > Project: Spark > Issue Type: Improvement > Components: SQL > Affects Versions: 2.2.1 > Reporter: Fernando Pereira > Priority: Minor > > spark.sql {{concat}} function automatically casts arguments to StringType > and returns a String. > This might be the behavior of traditional databases, however in Spark there's > Binary as a standard type, and concat'ing binary seems reasonable if it > returns another binary sequence. > Taking the example of, e.g. Python where both {{bytes}} and {{unicode}} > represent text, by concat'ing both we end up with the same type as the > arguments, and in case they are intermixed (str + unicode) the most generic > type is returned (unicode). > Following the same principle, I believe that when concat'ing binary it would > make sense to return a binary. > In terms of Spark behavior, it would affect only the case when all arguments > are binary. All other cases should remain unchanged. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org