[SPARK-28038][SQL][TEST] Port text.sql#24862
[SPARK-28038][SQL][TEST] Port text.sql#24862wangyum wants to merge 5 commits intoapache:masterfrom wangyum:SPARK-28038
Conversation
|
Test build #106464 has finished for PR 24862 at commit
|
|
Test build #107897 has finished for PR 24862 at commit
|
|
Test build #107899 has finished for PR 24862 at commit
|
|
Retest this please. |
| -- As of 8.3 we have removed most implicit casts to text, so that for example | ||
| -- this no longer works: | ||
| -- Spark SQL implicit cast integer to string | ||
| select length(42); |
There was a problem hiding this comment.
FYI: If we strictly follow ANSI/SQL, we don't allow this implicit cast along with PostgresSQL.
cc: @gengliangwang
There was a problem hiding this comment.
Is this casting an integer to string? If yes, I think it is allowed in ANSI SQL and up-cast.
There was a problem hiding this comment.
Update it to select 'four: ' || 2+2;?
There was a problem hiding this comment.
Why did you comment out this? (I just want to check current output...)
There was a problem hiding this comment.
Because of ANSI mode:
spark-sql> select left('12345', 2);
12
spark-sql> set spark.sql.parser.ansi.enabled=true;
spark.sql.parser.ansi.enabled true
spark-sql> select left('12345', 2);
Error in query:
no viable alternative at input 'left'(line 1, pos 7)
== SQL ==
select left('12345', 2)
-------^^^https://issues.apache.org/jira/browse/SPARK-28479
The output if disable ANSI mode:
Spark SQL:
spark-sql> select i, left('ahoj', i), right('ahoj', i) from range(-5, 6) t(i) order by i;
-5
-4
-3
-2
-1
0
1 a j
2 ah oj
3 aho hoj
4 ahoj ahoj
5 ahoj ahojPostgreSQL:
postgres=# select i, left('ahoj', i), right('ahoj', i) from generate_series(-5, 5) t(i) order by i;
i | left | right
----+------+-------
-5 | |
-4 | |
-3 | a | j
-2 | ah | oj
-1 | aho | hoj
0 | |
1 | a | j
2 | ah | oj
3 | aho | hoj
4 | ahoj | ahoj
5 | ahoj | ahoj
(11 rows)There was a problem hiding this comment.
Ah, I see. Can you turn temporarily off the mode for the query here?
|
Test build #108355 has finished for PR 24862 at commit
|
|
Test build #108382 has finished for PR 24862 at commit
|
|
Merged to master. |
What changes were proposed in this pull request?
This PR is to port text.sql from PostgreSQL regression tests. https://github.com/postgres/postgres/blob/REL_12_BETA2/src/test/regress/sql/text.sql
The expected results can be found in the link: https://github.com/postgres/postgres/blob/REL_12_BETA2/src/test/regress/expected/text.out
When porting the test cases, found a PostgreSQL specific features that do not exist in Spark SQL:
SPARK-28037: Add built-in String Functions: quote_literal
Also, found three inconsistent behavior:
SPARK-27930: Spark SQL's format_string can not fully support PostgreSQL's format
SPARK-28036: Built-in udf left/right has inconsistent behavior
SPARK-28033: String concatenation should low priority than other operators
How was this patch tested?
N/A