[ https://issues.apache.org/jira/browse/SPARK-27931?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Yuming Wang updated SPARK-27931: -------------------------------- Description: This ticket contains three things: 1. Accept 'on' and 'off' as input for boolean data type {code:sql} SELECT cast('no' as boolean) AS false; SELECT cast('off' as boolean) AS false; {code} 2. Accept unique prefixes thereof: {code:sql} SELECT cast('of' as boolean) AS false; SELECT cast('fal' as boolean) AS false; {code} 3. Trim the string when cast to boolean type {code:sql} SELECT cast(' true ' as boolean) AS true; SELECT cast(' FALSE' as boolean) AS true; {code} More details: [https://www.postgresql.org/docs/devel/datatype-boolean.html] [https://github.com/postgres/postgres/blob/REL_12_BETA1/src/backend/utils/adt/bool.c#L25] [https://github.com/postgres/postgres/commit/05a7db05826c5eb68173b6d7ef1553c19322ef48] Other DBs: http://docs.aws.amazon.com/redshift/latest/dg/r_Boolean_type.html https://my.vertica.com/docs/5.0/HTML/Master/2983.htm https://github.com/prestosql/presto/blob/b845cd66da3eb1fcece50efba83ea12bc40afbaa/presto-main/src/main/java/com/facebook/presto/type/VarcharOperators.java#L108-L138 was: This ticket contains three things: 1. Accept 'on' and 'off' as input for boolean data type Example: {code:sql} SELECT cast('no' as boolean) AS false; SELECT cast('off' as boolean) AS false; {code} 2. Accept unique prefixes thereof: Example: {code:sql} SELECT cast('of' as boolean) AS false; SELECT cast('fal' as boolean) AS false; {code} 3. Trim the string when cast to boolean type {code:sql} SELECT cast(' true ' as boolean) AS true; SELECT cast(' FALSE' as boolean) AS true; {code} More details: [https://www.postgresql.org/docs/devel/datatype-boolean.html] [https://github.com/postgres/postgres/blob/REL_12_BETA1/src/backend/utils/adt/bool.c#L25] [https://github.com/postgres/postgres/commit/05a7db05826c5eb68173b6d7ef1553c19322ef48] Other DBs: http://docs.aws.amazon.com/redshift/latest/dg/r_Boolean_type.html https://my.vertica.com/docs/5.0/HTML/Master/2983.htm https://github.com/prestosql/presto/blob/b845cd66da3eb1fcece50efba83ea12bc40afbaa/presto-main/src/main/java/com/facebook/presto/type/VarcharOperators.java#L108-L138 > Accept 'on' and 'off' as input for boolean data type > ---------------------------------------------------- > > Key: SPARK-27931 > URL: https://issues.apache.org/jira/browse/SPARK-27931 > Project: Spark > Issue Type: Sub-task > Components: SQL > Affects Versions: 3.0.0 > Reporter: Yuming Wang > Priority: Major > > This ticket contains three things: > 1. Accept 'on' and 'off' as input for boolean data type > {code:sql} > SELECT cast('no' as boolean) AS false; > SELECT cast('off' as boolean) AS false; > {code} > 2. Accept unique prefixes thereof: > {code:sql} > SELECT cast('of' as boolean) AS false; > SELECT cast('fal' as boolean) AS false; > {code} > 3. Trim the string when cast to boolean type > {code:sql} > SELECT cast(' true ' as boolean) AS true; > SELECT cast(' FALSE' as boolean) AS true; > {code} > More details: > [https://www.postgresql.org/docs/devel/datatype-boolean.html] > [https://github.com/postgres/postgres/blob/REL_12_BETA1/src/backend/utils/adt/bool.c#L25] > [https://github.com/postgres/postgres/commit/05a7db05826c5eb68173b6d7ef1553c19322ef48] > Other DBs: > http://docs.aws.amazon.com/redshift/latest/dg/r_Boolean_type.html > https://my.vertica.com/docs/5.0/HTML/Master/2983.htm > https://github.com/prestosql/presto/blob/b845cd66da3eb1fcece50efba83ea12bc40afbaa/presto-main/src/main/java/com/facebook/presto/type/VarcharOperators.java#L108-L138 -- 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