wangyum commented on a change in pull request #24767: [WIP][SPARK-27918][SQL]
Port boolean.sql
URL: https://github.com/apache/spark/pull/24767#discussion_r289646825
##########
File path: sql/core/src/test/resources/sql-tests/results/pgSQL/boolean.sql.out
##########
@@ -0,0 +1,710 @@
+-- Automatically generated by SQLQueryTestSuite
+-- Number of queries: 81
+
+
+-- !query 0
+SELECT 1 AS one
+-- !query 0 schema
+struct<one:int>
+-- !query 0 output
+1
+
+
+-- !query 1
+SELECT true AS true
+-- !query 1 schema
+struct<true:boolean>
+-- !query 1 output
+true
+
+
+-- !query 2
+SELECT false AS false
+-- !query 2 schema
+struct<false:boolean>
+-- !query 2 output
+false
+
+
+-- !query 3
+SELECT cast('t' as boolean) AS true
+-- !query 3 schema
+struct<true:boolean>
+-- !query 3 output
+true
+
+
+-- !query 4
+SELECT cast(' f ' as boolean) AS false
+-- !query 4 schema
+struct<false:boolean>
+-- !query 4 output
+NULL
+
+
+-- !query 5
+SELECT cast('true' as boolean) AS true
+-- !query 5 schema
+struct<true:boolean>
+-- !query 5 output
+true
+
+
+-- !query 6
+SELECT cast('test' as boolean) AS error
+-- !query 6 schema
+struct<error:boolean>
+-- !query 6 output
+NULL
+
+
+-- !query 7
+SELECT cast('false' as boolean) AS false
+-- !query 7 schema
+struct<false:boolean>
+-- !query 7 output
+false
+
+
+-- !query 8
+SELECT cast('foo' as boolean) AS error
+-- !query 8 schema
+struct<error:boolean>
+-- !query 8 output
+NULL
+
+
+-- !query 9
+SELECT cast('y' as boolean) AS true
+-- !query 9 schema
+struct<true:boolean>
+-- !query 9 output
+true
+
+
+-- !query 10
+SELECT cast('yes' as boolean) AS true
+-- !query 10 schema
+struct<true:boolean>
+-- !query 10 output
+true
+
+
+-- !query 11
+SELECT cast('yeah' as boolean) AS error
+-- !query 11 schema
+struct<error:boolean>
+-- !query 11 output
+NULL
+
+
+-- !query 12
+SELECT cast('n' as boolean) AS false
+-- !query 12 schema
+struct<false:boolean>
+-- !query 12 output
+false
+
+
+-- !query 13
+SELECT cast('no' as boolean) AS false
+-- !query 13 schema
+struct<false:boolean>
+-- !query 13 output
+false
+
+
+-- !query 14
+SELECT cast('nay' as boolean) AS error
+-- !query 14 schema
+struct<error:boolean>
+-- !query 14 output
+NULL
+
+
+-- !query 15
+SELECT cast('on' as boolean) AS true
+-- !query 15 schema
+struct<true:boolean>
+-- !query 15 output
+NULL
+
+
+-- !query 16
+SELECT cast('off' as boolean) AS false
+-- !query 16 schema
+struct<false:boolean>
+-- !query 16 output
+NULL
+
+
+-- !query 17
+SELECT cast('of' as boolean) AS false
+-- !query 17 schema
+struct<false:boolean>
+-- !query 17 output
+NULL
+
+
+-- !query 18
+SELECT cast('o' as boolean) AS error
+-- !query 18 schema
+struct<error:boolean>
+-- !query 18 output
+NULL
+
+
+-- !query 19
+SELECT cast('on_' as boolean) AS error
+-- !query 19 schema
+struct<error:boolean>
+-- !query 19 output
+NULL
+
+
+-- !query 20
+SELECT cast('off_' as boolean) AS error
+-- !query 20 schema
+struct<error:boolean>
+-- !query 20 output
+NULL
+
+
+-- !query 21
+SELECT cast('1' as boolean) AS true
+-- !query 21 schema
+struct<true:boolean>
+-- !query 21 output
+true
+
+
+-- !query 22
+SELECT cast('11' as boolean) AS error
+-- !query 22 schema
+struct<error:boolean>
+-- !query 22 output
+NULL
+
+
+-- !query 23
+SELECT cast('0' as boolean) AS false
+-- !query 23 schema
+struct<false:boolean>
+-- !query 23 output
+false
+
+
+-- !query 24
+SELECT cast('000' as boolean) AS error
+-- !query 24 schema
+struct<error:boolean>
+-- !query 24 output
+NULL
+
+
+-- !query 25
+SELECT cast('' as boolean) AS error
+-- !query 25 schema
+struct<error:boolean>
+-- !query 25 output
+NULL
+
+
+-- !query 26
+SELECT cast('t' as boolean) or cast('f' as boolean) AS true
+-- !query 26 schema
+struct<true:boolean>
+-- !query 26 output
+true
+
+
+-- !query 27
+SELECT cast('t' as boolean) and cast('f' as boolean) AS false
+-- !query 27 schema
+struct<false:boolean>
+-- !query 27 output
+false
+
+
+-- !query 28
+SELECT not cast('f' as boolean) AS true
+-- !query 28 schema
+struct<true:boolean>
+-- !query 28 output
+true
+
+
+-- !query 29
+SELECT cast('t' as boolean) = cast('f' as boolean) AS false
+-- !query 29 schema
+struct<false:boolean>
+-- !query 29 output
+false
+
+
+-- !query 30
+SELECT cast('t' as boolean) <> cast('f' as boolean) AS true
+-- !query 30 schema
+struct<true:boolean>
+-- !query 30 output
+true
+
+
+-- !query 31
+SELECT cast('t' as boolean) > cast('f' as boolean) AS true
+-- !query 31 schema
+struct<true:boolean>
+-- !query 31 output
+true
+
+
+-- !query 32
+SELECT cast('t' as boolean) >= cast('f' as boolean) AS true
+-- !query 32 schema
+struct<true:boolean>
+-- !query 32 output
+true
+
+
+-- !query 33
+SELECT cast('f' as boolean) < cast('t' as boolean) AS true
+-- !query 33 schema
+struct<true:boolean>
+-- !query 33 output
+true
+
+
+-- !query 34
+SELECT cast('f' as boolean) <= cast('t' as boolean) AS true
+-- !query 34 schema
+struct<true:boolean>
+-- !query 34 output
+true
+
+
+-- !query 35
+SELECT cast(cast('TrUe' as string) as boolean) AS true, cast(cast('fAlse' as
string) as boolean) AS false
+-- !query 35 schema
+struct<true:boolean,false:boolean>
+-- !query 35 output
+true false
+
+
+-- !query 36
+SELECT cast(cast(' true ' as string) as boolean) AS true,
+ cast(cast(' FALSE' as string) as boolean) AS false
+-- !query 36 schema
+struct<true:boolean,false:boolean>
+-- !query 36 output
+NULL NULL
Review comment:
Behavior different:
https://github.com/postgres/postgres/blob/REL_12_BETA1/src/test/regress/expected/boolean.out#L207-L212
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]