This is an automated email from the ASF dual-hosted git repository.

yamamuro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 2656c9d  [SPARK-28071][SQL][TEST] Port strings.sql
2656c9d is described below

commit 2656c9d304b59584c331b923e8536e4093d83f81
Author: Yuming Wang <yumw...@ebay.com>
AuthorDate: Tue Jul 30 18:54:14 2019 +0900

    [SPARK-28071][SQL][TEST] Port strings.sql
    
    ## What changes were proposed in this pull request?
    
    This PR is to port strings.sql from PostgreSQL regression tests. 
https://github.com/postgres/postgres/blob/REL_12_BETA2/src/test/regress/sql/strings.sql
    
    The expected results can be found in the link: 
https://github.com/postgres/postgres/blob/REL_12_BETA2/src/test/regress/expected/strings.out
    
    When porting the test cases, found nine PostgreSQL specific features that 
do not exist in Spark SQL:
    [SPARK-28076](https://issues.apache.org/jira/browse/SPARK-28076): Support 
regular expression substring
    [SPARK-28078](https://issues.apache.org/jira/browse/SPARK-28078):  Add 
support other 4 REGEXP functions
    [SPARK-28412](https://issues.apache.org/jira/browse/SPARK-28412): OVERLAY 
function support byte array
    [SPARK-28083](https://issues.apache.org/jira/browse/SPARK-28083):  ANSI 
SQL: LIKE predicate: ESCAPE clause
    [SPARK-28087](https://issues.apache.org/jira/browse/SPARK-28087):  Add 
support split_part
    [SPARK-28122](https://issues.apache.org/jira/browse/SPARK-28122): Missing 
`sha224`/`sha256 `/`sha384 `/`sha512 ` functions
    [SPARK-28123](https://issues.apache.org/jira/browse/SPARK-28123): Add 
support string functions: btrim
    [SPARK-28448](https://issues.apache.org/jira/browse/SPARK-28448): Implement 
ILIKE operator
    [SPARK-28449](https://issues.apache.org/jira/browse/SPARK-28449): Missing 
escape_string_warning and standard_conforming_strings config
    
    Also, found five inconsistent behavior:
    [SPARK-27952](https://issues.apache.org/jira/browse/SPARK-27952): String 
Functions: regexp_replace is not compatible
    [SPARK-28121](https://issues.apache.org/jira/browse/SPARK-28121): decode 
can not accept 'escape' as charset
    [SPARK-27930](https://issues.apache.org/jira/browse/SPARK-27930): Replace 
`strpos` with `locate` or `position` in Spark SQL
    [SPARK-27930](https://issues.apache.org/jira/browse/SPARK-27930): Replace 
`to_hex` with `hex ` or in Spark SQL
    [SPARK-28451](https://issues.apache.org/jira/browse/SPARK-28451): `substr` 
returns different values
    
    ## How was this patch tested?
    
    N/A
    
    Closes #24923 from wangyum/SPARK-28071.
    
    Authored-by: Yuming Wang <yumw...@ebay.com>
    Signed-off-by: Takeshi Yamamuro <yamam...@apache.org>
---
 .../resources/sql-tests/inputs/pgSQL/strings.sql   | 660 +++++++++++++++++++
 .../sql-tests/results/pgSQL/strings.sql.out        | 718 +++++++++++++++++++++
 2 files changed, 1378 insertions(+)

diff --git a/sql/core/src/test/resources/sql-tests/inputs/pgSQL/strings.sql 
b/sql/core/src/test/resources/sql-tests/inputs/pgSQL/strings.sql
new file mode 100644
index 0000000..a684428
--- /dev/null
+++ b/sql/core/src/test/resources/sql-tests/inputs/pgSQL/strings.sql
@@ -0,0 +1,660 @@
+--
+-- Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
+--
+-- STRINGS
+-- -- 
https://github.com/postgres/postgres/blob/REL_12_BETA2/src/test/regress/sql/strings.sql
+-- Test various data entry syntaxes.
+--
+
+-- SQL string continuation syntax
+-- E021-03 character string literals
+SELECT 'first line'
+' - next line'
+       ' - third line'
+       AS `Three lines to one`;
+
+-- Spark SQL support this string continuation syntax
+-- illegal string continuation syntax
+SELECT 'first line'
+' - next line' /* this comment is not allowed here */
+' - third line'
+       AS `Illegal comment within continuation`;
+
+-- [SPARK-28447] ANSI SQL: Unicode escapes in literals
+-- Unicode escapes
+-- SET standard_conforming_strings TO on;
+
+-- SELECT U&'d\0061t\+000061' AS U&"d\0061t\+000061";
+-- SELECT U&'d!0061t\+000061' UESCAPE '!' AS U&"d*0061t\+000061" UESCAPE '*';
+
+-- SELECT U&' \' UESCAPE '!' AS "tricky";
+-- SELECT 'tricky' AS U&"\" UESCAPE '!';
+
+-- SELECT U&'wrong: \061';
+-- SELECT U&'wrong: \+0061';
+-- SELECT U&'wrong: +0061' UESCAPE '+';
+
+-- SET standard_conforming_strings TO off;
+
+-- SELECT U&'d\0061t\+000061' AS U&"d\0061t\+000061";
+-- SELECT U&'d!0061t\+000061' UESCAPE '!' AS U&"d*0061t\+000061" UESCAPE '*';
+
+-- SELECT U&' \' UESCAPE '!' AS "tricky";
+-- SELECT 'tricky' AS U&"\" UESCAPE '!';
+
+-- SELECT U&'wrong: \061';
+-- SELECT U&'wrong: \+0061';
+-- SELECT U&'wrong: +0061' UESCAPE '+';
+
+-- RESET standard_conforming_strings;
+
+-- Spark SQL only support escape mode
+-- bytea
+-- SET bytea_output TO hex;
+-- SELECT E'\\xDeAdBeEf'::bytea;
+-- SELECT E'\\x De Ad Be Ef '::bytea;
+-- SELECT E'\\xDeAdBeE'::bytea;
+-- SELECT E'\\xDeAdBeEx'::bytea;
+-- SELECT E'\\xDe00BeEf'::bytea;
+-- SELECT E'DeAdBeEf'::bytea;
+-- SELECT E'De\\000dBeEf'::bytea;
+-- SELECT E'De\123dBeEf'::bytea;
+-- SELECT E'De\\123dBeEf'::bytea;
+-- SELECT E'De\\678dBeEf'::bytea;
+
+-- SET bytea_output TO escape;
+SELECT binary('\\xDeAdBeEf');
+SELECT binary('\\x De Ad Be Ef ');
+SELECT binary('\\xDe00BeEf');
+SELECT binary('DeAdBeEf');
+SELECT binary('De\\000dBeEf');
+SELECT binary('De\\123dBeEf');
+
+-- Skip these tests because we do not have char/varchar type
+--
+-- test conversions between various string types
+-- E021-10 implicit casting among the character data types
+--
+
+-- SELECT CAST(f1 AS text) AS "text(char)" FROM CHAR_TBL;
+
+-- SELECT CAST(f1 AS text) AS "text(varchar)" FROM VARCHAR_TBL;
+
+-- SELECT CAST(name 'namefield' AS text) AS "text(name)";
+
+-- since this is an explicit cast, it should truncate w/o error:
+-- SELECT CAST(f1 AS char(10)) AS "char(text)" FROM TEXT_TBL;
+-- note: implicit-cast case is tested in char.sql
+
+-- SELECT CAST(f1 AS char(20)) AS "char(text)" FROM TEXT_TBL;
+
+-- SELECT CAST(f1 AS char(10)) AS "char(varchar)" FROM VARCHAR_TBL;
+
+-- SELECT CAST(name 'namefield' AS char(10)) AS "char(name)";
+
+-- SELECT CAST(f1 AS varchar) AS "varchar(text)" FROM TEXT_TBL;
+
+-- SELECT CAST(f1 AS varchar) AS "varchar(char)" FROM CHAR_TBL;
+
+-- SELECT CAST(name 'namefield' AS varchar) AS "varchar(name)";
+
+--
+-- test SQL string functions
+-- E### and T### are feature reference numbers from SQL99
+--
+
+-- E021-09 trim function
+SELECT TRIM(BOTH FROM '  bunch o blanks  ') = 'bunch o blanks' AS `bunch o 
blanks`;
+
+SELECT TRIM(LEADING FROM '  bunch o blanks  ') = 'bunch o blanks  ' AS `bunch 
o blanks  `;
+
+SELECT TRIM(TRAILING FROM '  bunch o blanks  ') = '  bunch o blanks' AS `  
bunch o blanks`;
+
+SELECT TRIM(BOTH 'x' FROM 'xxxxxsome Xsxxxxx') = 'some Xs' AS `some Xs`;
+
+-- E021-06 substring expression
+SELECT SUBSTRING('1234567890' FROM 3) = '34567890' AS `34567890`;
+
+SELECT SUBSTRING('1234567890' FROM 4 FOR 3) = '456' AS `456`;
+
+-- [SPARK-28076] Support regular expression substring
+-- T581 regular expression substring (with SQL's bizarre regexp syntax)
+-- SELECT SUBSTRING('abcdefg' FROM 'a#"(b_d)#"%' FOR '#') AS "bcd";
+
+-- No match should return NULL
+-- SELECT SUBSTRING('abcdefg' FROM '#"(b_d)#"%' FOR '#') IS NULL AS "True";
+
+-- Null inputs should return NULL
+-- SELECT SUBSTRING('abcdefg' FROM '%' FOR NULL) IS NULL AS "True";
+-- SELECT SUBSTRING(NULL FROM '%' FOR '#') IS NULL AS "True";
+-- SELECT SUBSTRING('abcdefg' FROM NULL FOR '#') IS NULL AS "True";
+
+-- The first and last parts should act non-greedy
+-- SELECT SUBSTRING('abcdefg' FROM 'a#"%#"g' FOR '#') AS "bcdef";
+-- SELECT SUBSTRING('abcdefg' FROM 'a*#"%#"g*' FOR '#') AS "abcdefg";
+
+-- Vertical bar in any part affects only that part
+-- SELECT SUBSTRING('abcdefg' FROM 'a|b#"%#"g' FOR '#') AS "bcdef";
+-- SELECT SUBSTRING('abcdefg' FROM 'a#"%#"x|g' FOR '#') AS "bcdef";
+-- SELECT SUBSTRING('abcdefg' FROM 'a#"%|ab#"g' FOR '#') AS "bcdef";
+
+-- Can't have more than two part separators
+-- SELECT SUBSTRING('abcdefg' FROM 'a*#"%#"g*#"x' FOR '#') AS "error";
+
+-- Postgres extension: with 0 or 1 separator, assume parts 1 and 3 are empty
+-- SELECT SUBSTRING('abcdefg' FROM 'a#"%g' FOR '#') AS "bcdefg";
+-- SELECT SUBSTRING('abcdefg' FROM 'a%g' FOR '#') AS "abcdefg";
+
+-- substring() with just two arguments is not allowed by SQL spec;
+-- we accept it, but we interpret the pattern as a POSIX regexp not SQL
+-- SELECT SUBSTRING('abcdefg' FROM 'c.e') AS "cde";
+
+-- With a parenthesized subexpression, return only what matches the subexpr
+-- SELECT SUBSTRING('abcdefg' FROM 'b(.*)f') AS "cde";
+
+-- [SPARK-27952] String Functions: regexp_replace is not compatible
+-- PostgreSQL extension to allow using back reference in replace string;
+-- SELECT regexp_replace('1112223333', E'(\\d{3})(\\d{3})(\\d{4})', E'(\\1) 
\\2-\\3');
+-- SELECT regexp_replace('AAA   BBB   CCC   ', E'\\s+', ' ', 'g');
+-- SELECT regexp_replace('AAA', '^|$', 'Z', 'g');
+-- SELECT regexp_replace('AAA aaa', 'A+', 'Z', 'gi');
+-- invalid regexp option
+-- SELECT regexp_replace('AAA aaa', 'A+', 'Z', 'z');
+
+-- set so we can tell NULL from empty string
+-- \pset null '\\N'
+
+-- [SPARK-28078] Add support other 4 REGEXP functions
+-- return all matches from regexp
+-- SELECT regexp_matches('foobarbequebaz', $re$(bar)(beque)$re$);
+
+-- test case insensitive
+-- SELECT regexp_matches('foObARbEqUEbAz', $re$(bar)(beque)$re$, 'i');
+
+-- global option - more than one match
+-- SELECT regexp_matches('foobarbequebazilbarfbonk', $re$(b[^b]+)(b[^b]+)$re$, 
'g');
+
+-- empty capture group (matched empty string)
+-- SELECT regexp_matches('foobarbequebaz', $re$(bar)(.*)(beque)$re$);
+-- no match
+-- SELECT regexp_matches('foobarbequebaz', $re$(bar)(.+)(beque)$re$);
+-- optional capture group did not match, null entry in array
+-- SELECT regexp_matches('foobarbequebaz', $re$(bar)(.+)?(beque)$re$);
+
+-- no capture groups
+-- SELECT regexp_matches('foobarbequebaz', $re$barbeque$re$);
+
+-- start/end-of-line matches are of zero length
+-- SELECT regexp_matches('foo' || chr(10) || 'bar' || chr(10) || 'bequq' || 
chr(10) || 'baz', '^', 'mg');
+-- SELECT regexp_matches('foo' || chr(10) || 'bar' || chr(10) || 'bequq' || 
chr(10) || 'baz', '$', 'mg');
+-- SELECT regexp_matches('1' || chr(10) || '2' || chr(10) || '3' || chr(10) || 
'4' || chr(10), '^.?', 'mg');
+-- SELECT regexp_matches(chr(10) || '1' || chr(10) || '2' || chr(10) || '3' || 
chr(10) || '4' || chr(10), '.?$', 'mg');
+-- SELECT regexp_matches(chr(10) || '1' || chr(10) || '2' || chr(10) || '3' || 
chr(10) || '4', '.?$', 'mg');
+
+-- give me errors
+-- SELECT regexp_matches('foobarbequebaz', $re$(bar)(beque)$re$, 'gz');
+-- SELECT regexp_matches('foobarbequebaz', $re$(barbeque$re$);
+-- SELECT regexp_matches('foobarbequebaz', $re$(bar)(beque){2,1}$re$);
+
+-- split string on regexp
+-- SELECT foo, length(foo) FROM regexp_split_to_table('the quick brown fox 
jumps over the lazy dog', $re$\s+$re$) AS foo;
+-- SELECT regexp_split_to_array('the quick brown fox jumps over the lazy dog', 
$re$\s+$re$);
+
+-- SELECT foo, length(foo) FROM regexp_split_to_table('the quick brown fox 
jumps over the lazy dog', $re$\s*$re$) AS foo;
+-- SELECT regexp_split_to_array('the quick brown fox jumps over the lazy dog', 
$re$\s*$re$);
+-- SELECT foo, length(foo) FROM regexp_split_to_table('the quick brown fox 
jumps over the lazy dog', '') AS foo;
+-- SELECT regexp_split_to_array('the quick brown fox jumps over the lazy dog', 
'');
+-- case insensitive
+-- SELECT foo, length(foo) FROM regexp_split_to_table('thE QUick bROWn FOx 
jUMPs ovEr The lazy dOG', 'e', 'i') AS foo;
+-- -- SELECT regexp_split_to_array('thE QUick bROWn FOx jUMPs ovEr The lazy 
dOG', 'e', 'i');
+-- no match of pattern
+-- SELECT foo, length(foo) FROM regexp_split_to_table('the quick brown fox 
jumps over the lazy dog', 'nomatch') AS foo;
+-- SELECT regexp_split_to_array('the quick brown fox jumps over the lazy dog', 
'nomatch');
+-- some corner cases
+-- SELECT regexp_split_to_array('123456','1');
+-- SELECT regexp_split_to_array('123456','6');
+-- SELECT regexp_split_to_array('123456','.');
+-- SELECT regexp_split_to_array('123456','');
+-- SELECT regexp_split_to_array('123456','(?:)');
+-- SELECT regexp_split_to_array('1','');
+-- errors
+-- SELECT foo, length(foo) FROM regexp_split_to_table('thE QUick bROWn FOx 
jUMPs ovEr The lazy dOG', 'e', 'zippy') AS foo;
+-- SELECT regexp_split_to_array('thE QUick bROWn FOx jUMPs ovEr The lazy dOG', 
'e', 'iz');
+-- global option meaningless for regexp_split
+-- SELECT foo, length(foo) FROM regexp_split_to_table('thE QUick bROWn FOx 
jUMPs ovEr The lazy dOG', 'e', 'g') AS foo;
+-- SELECT regexp_split_to_array('thE QUick bROWn FOx jUMPs ovEr The lazy dOG', 
'e', 'g');
+
+-- change NULL-display back
+-- \pset null ''
+
+-- E021-11 position expression
+SELECT POSITION('4' IN '1234567890') = '4' AS `4`;
+
+SELECT POSITION('5' IN '1234567890') = '5' AS `5`;
+
+-- [SPARK-28077] Add support string functions: OVERLAY
+-- T312 character overlay function
+-- SELECT OVERLAY('abcdef' PLACING '45' FROM 4) AS "abc45f";
+
+-- SELECT OVERLAY('yabadoo' PLACING 'daba' FROM 5) AS "yabadaba";
+
+-- SELECT OVERLAY('yabadoo' PLACING 'daba' FROM 5 FOR 0) AS "yabadabadoo";
+
+-- SELECT OVERLAY('babosa' PLACING 'ubb' FROM 2 FOR 4) AS "bubba";
+
+--
+-- test LIKE
+-- Be sure to form every test as a LIKE/NOT LIKE pair.
+--
+
+-- simplest examples
+-- E061-04 like predicate
+SELECT 'hawkeye' LIKE 'h%' AS `true`;
+SELECT 'hawkeye' NOT LIKE 'h%' AS `false`;
+
+SELECT 'hawkeye' LIKE 'H%' AS `false`;
+SELECT 'hawkeye' NOT LIKE 'H%' AS `true`;
+
+SELECT 'hawkeye' LIKE 'indio%' AS `false`;
+SELECT 'hawkeye' NOT LIKE 'indio%' AS `true`;
+
+SELECT 'hawkeye' LIKE 'h%eye' AS `true`;
+SELECT 'hawkeye' NOT LIKE 'h%eye' AS `false`;
+
+SELECT 'indio' LIKE '_ndio' AS `true`;
+SELECT 'indio' NOT LIKE '_ndio' AS `false`;
+
+SELECT 'indio' LIKE 'in__o' AS `true`;
+SELECT 'indio' NOT LIKE 'in__o' AS `false`;
+
+SELECT 'indio' LIKE 'in_o' AS `false`;
+SELECT 'indio' NOT LIKE 'in_o' AS `true`;
+
+-- [SPARK-28083] ANSI SQL: LIKE predicate: ESCAPE clause
+-- unused escape character
+-- SELECT 'hawkeye' LIKE 'h%' ESCAPE '#' AS "true";
+-- SELECT 'hawkeye' NOT LIKE 'h%' ESCAPE '#' AS "false";
+
+-- SELECT 'indio' LIKE 'ind_o' ESCAPE '$' AS "true";
+-- SELECT 'indio' NOT LIKE 'ind_o' ESCAPE '$' AS "false";
+
+-- escape character
+-- E061-05 like predicate with escape clause
+-- SELECT 'h%' LIKE 'h#%' ESCAPE '#' AS "true";
+-- SELECT 'h%' NOT LIKE 'h#%' ESCAPE '#' AS "false";
+
+-- SELECT 'h%wkeye' LIKE 'h#%' ESCAPE '#' AS "false";
+-- SELECT 'h%wkeye' NOT LIKE 'h#%' ESCAPE '#' AS "true";
+
+-- SELECT 'h%wkeye' LIKE 'h#%%' ESCAPE '#' AS "true";
+-- SELECT 'h%wkeye' NOT LIKE 'h#%%' ESCAPE '#' AS "false";
+
+-- SELECT 'h%awkeye' LIKE 'h#%a%k%e' ESCAPE '#' AS "true";
+-- SELECT 'h%awkeye' NOT LIKE 'h#%a%k%e' ESCAPE '#' AS "false";
+
+-- SELECT 'indio' LIKE '_ndio' ESCAPE '$' AS "true";
+-- SELECT 'indio' NOT LIKE '_ndio' ESCAPE '$' AS "false";
+
+-- SELECT 'i_dio' LIKE 'i$_d_o' ESCAPE '$' AS "true";
+-- SELECT 'i_dio' NOT LIKE 'i$_d_o' ESCAPE '$' AS "false";
+
+-- SELECT 'i_dio' LIKE 'i$_nd_o' ESCAPE '$' AS "false";
+-- SELECT 'i_dio' NOT LIKE 'i$_nd_o' ESCAPE '$' AS "true";
+
+-- SELECT 'i_dio' LIKE 'i$_d%o' ESCAPE '$' AS "true";
+-- SELECT 'i_dio' NOT LIKE 'i$_d%o' ESCAPE '$' AS "false";
+
+-- escape character same as pattern character
+-- SELECT 'maca' LIKE 'm%aca' ESCAPE '%' AS "true";
+-- SELECT 'maca' NOT LIKE 'm%aca' ESCAPE '%' AS "false";
+
+-- SELECT 'ma%a' LIKE 'm%a%%a' ESCAPE '%' AS "true";
+-- SELECT 'ma%a' NOT LIKE 'm%a%%a' ESCAPE '%' AS "false";
+
+-- SELECT 'bear' LIKE 'b_ear' ESCAPE '_' AS "true";
+-- SELECT 'bear' NOT LIKE 'b_ear' ESCAPE '_' AS "false";
+
+-- SELECT 'be_r' LIKE 'b_e__r' ESCAPE '_' AS "true";
+-- SELECT 'be_r' NOT LIKE 'b_e__r' ESCAPE '_' AS "false";
+
+-- SELECT 'be_r' LIKE '__e__r' ESCAPE '_' AS "false";
+-- SELECT 'be_r' NOT LIKE '__e__r' ESCAPE '_' AS "true";
+
+-- [SPARK-28448] Implement ILIKE operator
+--
+-- test ILIKE (case-insensitive LIKE)
+-- Be sure to form every test as an ILIKE/NOT ILIKE pair.
+--
+
+-- SELECT 'hawkeye' ILIKE 'h%' AS "true";
+-- SELECT 'hawkeye' NOT ILIKE 'h%' AS "false";
+
+-- SELECT 'hawkeye' ILIKE 'H%' AS "true";
+-- SELECT 'hawkeye' NOT ILIKE 'H%' AS "false";
+
+-- SELECT 'hawkeye' ILIKE 'H%Eye' AS "true";
+-- SELECT 'hawkeye' NOT ILIKE 'H%Eye' AS "false";
+
+-- SELECT 'Hawkeye' ILIKE 'h%' AS "true";
+-- SELECT 'Hawkeye' NOT ILIKE 'h%' AS "false";
+
+--
+-- test %/_ combination cases, cf bugs #4821 and #5478
+--
+
+SELECT 'foo' LIKE '_%' as t, 'f' LIKE '_%' as t, '' LIKE '_%' as f;
+SELECT 'foo' LIKE '%_' as t, 'f' LIKE '%_' as t, '' LIKE '%_' as f;
+
+SELECT 'foo' LIKE '__%' as t, 'foo' LIKE '___%' as t, 'foo' LIKE '____%' as f;
+SELECT 'foo' LIKE '%__' as t, 'foo' LIKE '%___' as t, 'foo' LIKE '%____' as f;
+
+SELECT 'jack' LIKE '%____%' AS t;
+
+
+-- Skip tests of LIKE with indexes
+--
+-- basic tests of LIKE with indexes
+--
+
+-- CREATE TABLE texttest (a text PRIMARY KEY, b int);
+-- SELECT * FROM texttest WHERE a LIKE '%1%';
+
+-- CREATE TABLE byteatest (a bytea PRIMARY KEY, b int);
+-- SELECT * FROM byteatest WHERE a LIKE '%1%';
+
+-- DROP TABLE texttest, byteatest;
+
+
+--
+-- test implicit type conversion
+--
+
+-- E021-07 character concatenation
+SELECT 'unknown' || ' and unknown' AS `Concat unknown types`;
+
+SELECT string('text') || ' and unknown' AS `Concat text to unknown type`;
+
+-- Spark SQL does not have char and varchar type
+-- SELECT char(20) 'characters' || ' and text' AS "Concat char to unknown 
type";
+
+-- SELECT text 'text' || char(20) ' and characters' AS "Concat text to char";
+
+-- SELECT text 'text' || varchar ' and varchar' AS "Concat text to varchar";
+
+--
+-- test substr with toasted text values
+--
+CREATE TABLE toasttest(f1 string) USING parquet;
+
+insert into toasttest values(repeat('1234567890',10000));
+insert into toasttest values(repeat('1234567890',10000));
+
+--
+-- Ensure that some values are uncompressed, to test the faster substring
+-- operation used in that case
+--
+-- alter table toasttest alter column f1 set storage external;
+insert into toasttest values(repeat('1234567890',10000));
+insert into toasttest values(repeat('1234567890',10000));
+
+-- [SPARK-28451] substr returns different values
+-- If the starting position is zero or less, then return from the start of the 
string
+-- adjusting the length to be consistent with the "negative start" per SQL.
+-- SELECT substr(f1, -1, 5) from toasttest;
+
+-- If the length is less than zero, an ERROR is thrown.
+-- SELECT substr(f1, 5, -1) from toasttest;
+
+-- If no third argument (length) is provided, the length to the end of the
+-- string is assumed.
+SELECT substr(f1, 99995) from toasttest;
+
+-- If start plus length is > string length, the result is truncated to
+-- string length
+SELECT substr(f1, 99995, 10) from toasttest;
+
+-- Skip these tests
+-- TRUNCATE TABLE toasttest;
+-- INSERT INTO toasttest values (repeat('1234567890',300));
+-- INSERT INTO toasttest values (repeat('1234567890',300));
+-- INSERT INTO toasttest values (repeat('1234567890',300));
+-- INSERT INTO toasttest values (repeat('1234567890',300));
+-- expect >0 blocks
+-- SELECT pg_relation_size(reltoastrelid) = 0 AS is_empty
+--  FROM pg_class where relname = 'toasttest';
+
+-- TRUNCATE TABLE toasttest;
+-- ALTER TABLE toasttest set (toast_tuple_target = 4080);
+-- INSERT INTO toasttest values (repeat('1234567890',300));
+-- INSERT INTO toasttest values (repeat('1234567890',300));
+-- INSERT INTO toasttest values (repeat('1234567890',300));
+-- INSERT INTO toasttest values (repeat('1234567890',300));
+-- expect 0 blocks
+-- SELECT pg_relation_size(reltoastrelid) = 0 AS is_empty
+--  FROM pg_class where relname = 'toasttest';
+
+-- DROP TABLE toasttest;
+
+-- [SPARK-28121] decode can not accept 'escape' as charset
+--
+--
+-- test substr with toasted bytea values
+--
+-- CREATE TABLE toasttest(f1 binary) USING parquet;
+
+-- insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
+-- insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
+
+--
+-- Ensure that some values are uncompressed, to test the faster substring
+-- operation used in that case
+--
+-- alter table toasttest alter column f1 set storage external;
+-- insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
+-- insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
+
+-- If the starting position is zero or less, then return from the start of the 
string
+-- adjusting the length to be consistent with the "negative start" per SQL.
+-- SELECT substr(f1, -1, 5) from toasttest;
+
+-- If the length is less than zero, an ERROR is thrown.
+-- SELECT substr(f1, 5, -1) from toasttest;
+
+-- If no third argument (length) is provided, the length to the end of the
+-- string is assumed.
+-- SELECT substr(f1, 99995) from toasttest;
+
+-- If start plus length is > string length, the result is truncated to
+-- string length
+-- SELECT substr(f1, 99995, 10) from toasttest;
+
+-- DROP TABLE toasttest;
+
+-- Skip these tests because we do not support char type
+-- test internally compressing datums
+
+-- this tests compressing a datum to a very small size which exercises a
+-- corner case in packed-varlena handling: even though small, the compressed
+-- datum must be given a 4-byte header because there are no bits to indicate
+-- compression in a 1-byte header
+
+-- CREATE TABLE toasttest (c char(4096));
+-- INSERT INTO toasttest VALUES('x');
+-- SELECT length(c), c::text FROM toasttest;
+-- SELECT c FROM toasttest;
+-- DROP TABLE toasttest;
+
+--
+-- test length
+--
+
+SELECT length('abcdef') AS `length_6`;
+
+-- [SPARK-27930] Replace strpos with locate or position in Spark SQL
+--
+-- test strpos
+--
+
+SELECT position('cd', 'abcdef') AS `pos_3`;
+
+SELECT position('xy', 'abcdef') AS `pos_0`;
+
+--
+-- test replace
+--
+SELECT replace('abcdef', 'de', '45') AS `abc45f`;
+
+SELECT replace('yabadabadoo', 'ba', '123') AS `ya123da123doo`;
+
+SELECT replace('yabadoo', 'bad', '') AS `yaoo`;
+
+-- [SPARK-28087] Add support split_part
+--
+-- test split_part
+--
+-- select split_part('joeuser@mydatabase','@',0) AS "an error";
+
+-- select split_part('joeuser@mydatabase','@',1) AS "joeuser";
+
+-- select split_part('joeuser@mydatabase','@',2) AS "mydatabase";
+
+-- select split_part('joeuser@mydatabase','@',3) AS "empty string";
+
+-- select split_part('@joeuser@mydatabase@','@',2) AS "joeuser";
+
+-- [SPARK-27930] Spark SQL use hex
+--
+-- test to_hex
+--
+select hex(256*256*256 - 1) AS `ffffff`;
+
+select hex(bigint(bigint(bigint(bigint(256)*256)*256)*256) - 1) AS `ffffffff`;
+
+--
+-- MD5 test suite - from IETF RFC 1321
+-- (see: ftp://ftp.rfc-editor.org/in-notes/rfc1321.txt)
+--
+select md5('') = 'd41d8cd98f00b204e9800998ecf8427e' AS `TRUE`;
+
+select md5('a') = '0cc175b9c0f1b6a831c399e269772661' AS `TRUE`;
+
+select md5('abc') = '900150983cd24fb0d6963f7d28e17f72' AS `TRUE`;
+
+select md5('message digest') = 'f96b697d7cb7938d525a2f31aaf161d0' AS `TRUE`;
+
+select md5('abcdefghijklmnopqrstuvwxyz') = 'c3fcd3d76192e4007dfb496cca67e13b' 
AS `TRUE`;
+
+select md5('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') = 
'd174ab98d277d9f5a5611c2c9f419d9f' AS `TRUE`;
+
+select 
md5('12345678901234567890123456789012345678901234567890123456789012345678901234567890')
 = '57edf4a22be3c955ac49da2e2107b67a' AS `TRUE`;
+
+select md5(binary('')) = 'd41d8cd98f00b204e9800998ecf8427e' AS `TRUE`;
+
+select md5(binary('a')) = '0cc175b9c0f1b6a831c399e269772661' AS `TRUE`;
+
+select md5(binary('abc')) = '900150983cd24fb0d6963f7d28e17f72' AS `TRUE`;
+
+select md5(binary('message digest')) = 'f96b697d7cb7938d525a2f31aaf161d0' AS 
`TRUE`;
+
+select md5(binary('abcdefghijklmnopqrstuvwxyz')) = 
'c3fcd3d76192e4007dfb496cca67e13b' AS `TRUE`;
+
+select 
md5(binary('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789')) = 
'd174ab98d277d9f5a5611c2c9f419d9f' AS `TRUE`;
+
+select 
md5(binary('12345678901234567890123456789012345678901234567890123456789012345678901234567890'))
 = '57edf4a22be3c955ac49da2e2107b67a' AS `TRUE`;
+
+-- [SPARK-28122] missing SHA functions
+--
+-- SHA-2
+--
+-- SET bytea_output TO hex;
+
+-- SELECT sha224('');
+-- SELECT sha224('The quick brown fox jumps over the lazy dog.');
+
+-- SELECT sha256('');
+-- SELECT sha256('The quick brown fox jumps over the lazy dog.');
+
+-- SELECT sha384('');
+-- SELECT sha384('The quick brown fox jumps over the lazy dog.');
+
+-- SELECT sha512('');
+-- SELECT sha512('The quick brown fox jumps over the lazy dog.');
+
+-- [SPARK-28449] Missing escape_string_warning and standard_conforming_strings 
config
+--
+-- test behavior of escape_string_warning and standard_conforming_strings 
options
+--
+-- set escape_string_warning = off;
+-- set standard_conforming_strings = off;
+
+-- show escape_string_warning;
+-- show standard_conforming_strings;
+
+-- set escape_string_warning = on;
+-- set standard_conforming_strings = on;
+
+-- show escape_string_warning;
+-- show standard_conforming_strings;
+
+-- select 'a\bcd' as f1, 'a\b''cd' as f2, 'a\b''''cd' as f3, 'abcd\'   as f4, 
'ab\''cd' as f5, '\\' as f6;
+
+-- set standard_conforming_strings = off;
+
+-- select 'a\\bcd' as f1, 'a\\b\'cd' as f2, 'a\\b\'''cd' as f3, 'abcd\\'   as 
f4, 'ab\\\'cd' as f5, '\\\\' as f6;
+
+-- set escape_string_warning = off;
+-- set standard_conforming_strings = on;
+
+-- select 'a\bcd' as f1, 'a\b''cd' as f2, 'a\b''''cd' as f3, 'abcd\'   as f4, 
'ab\''cd' as f5, '\\' as f6;
+
+-- set standard_conforming_strings = off;
+
+-- select 'a\\bcd' as f1, 'a\\b\'cd' as f2, 'a\\b\'''cd' as f3, 'abcd\\'   as 
f4, 'ab\\\'cd' as f5, '\\\\' as f6;
+
+
+--
+-- Additional string functions
+--
+-- SET bytea_output TO escape;
+
+SELECT initcap('hi THOMAS');
+
+SELECT lpad('hi', 5, 'xy');
+SELECT lpad('hi', 5);
+SELECT lpad('hi', -5, 'xy');
+SELECT lpad('hello', 2);
+SELECT lpad('hi', 5, '');
+
+SELECT rpad('hi', 5, 'xy');
+SELECT rpad('hi', 5);
+SELECT rpad('hi', -5, 'xy');
+SELECT rpad('hello', 2);
+SELECT rpad('hi', 5, '');
+
+SELECT ltrim('zzzytrim', 'xyz');
+
+SELECT translate('', '14', 'ax');
+SELECT translate('12345', '14', 'ax');
+
+SELECT ascii('x');
+SELECT ascii('');
+
+SELECT chr(65);
+-- PostgreSQL throws: ERROR:  null character not permitted
+SELECT chr(0);
+
+SELECT repeat('Pg', 4);
+SELECT repeat('Pg', -4);
+
+SELECT trim(binary('\\000') from binary('\\000Tom\\000'));
+-- [SPARK-28123] Add support btrim
+-- SELECT btrim(E'\\000trim\\000'::bytea, E'\\000'::bytea);
+-- SELECT btrim(''::bytea, E'\\000'::bytea);
+-- SELECT btrim(E'\\000trim\\000'::bytea, ''::bytea);
+-- [SPARK-28121] decode can not accept 'escape' as charset
+-- [SPARK-28412][SQL] ANSI SQL: OVERLAY function support byte array
+-- SELECT encode(overlay(E'Th\\000omas'::bytea placing E'Th\\001omas'::bytea 
from 2),'escape');
+-- SELECT encode(overlay(E'Th\\000omas'::bytea placing E'\\002\\003'::bytea 
from 8),'escape');
+-- SELECT encode(overlay(E'Th\\000omas'::bytea placing E'\\002\\003'::bytea 
from 5 for 3),'escape');
+
+DROP TABLE toasttest;
diff --git 
a/sql/core/src/test/resources/sql-tests/results/pgSQL/strings.sql.out 
b/sql/core/src/test/resources/sql-tests/results/pgSQL/strings.sql.out
new file mode 100644
index 0000000..06382b0
--- /dev/null
+++ b/sql/core/src/test/resources/sql-tests/results/pgSQL/strings.sql.out
@@ -0,0 +1,718 @@
+-- Automatically generated by SQLQueryTestSuite
+-- Number of queries: 88
+
+
+-- !query 0
+SELECT 'first line'
+' - next line'
+       ' - third line'
+       AS `Three lines to one`
+-- !query 0 schema
+struct<Three lines to one:string>
+-- !query 0 output
+first line - next line - third line
+
+
+-- !query 1
+SELECT 'first line'
+' - next line' /* this comment is not allowed here */
+' - third line'
+       AS `Illegal comment within continuation`
+-- !query 1 schema
+struct<Illegal comment within continuation:string>
+-- !query 1 output
+first line - next line - third line
+
+
+-- !query 2
+SELECT binary('\\xDeAdBeEf')
+-- !query 2 schema
+struct<CAST(\xDeAdBeEf AS BINARY):binary>
+-- !query 2 output
+\xDeAdBeEf
+
+
+-- !query 3
+SELECT binary('\\x De Ad Be Ef ')
+-- !query 3 schema
+struct<CAST(\x De Ad Be Ef  AS BINARY):binary>
+-- !query 3 output
+\x De Ad Be Ef
+
+
+-- !query 4
+SELECT binary('\\xDe00BeEf')
+-- !query 4 schema
+struct<CAST(\xDe00BeEf AS BINARY):binary>
+-- !query 4 output
+\xDe00BeEf
+
+
+-- !query 5
+SELECT binary('DeAdBeEf')
+-- !query 5 schema
+struct<CAST(DeAdBeEf AS BINARY):binary>
+-- !query 5 output
+DeAdBeEf
+
+
+-- !query 6
+SELECT binary('De\\000dBeEf')
+-- !query 6 schema
+struct<CAST(De\000dBeEf AS BINARY):binary>
+-- !query 6 output
+De\000dBeEf
+
+
+-- !query 7
+SELECT binary('De\\123dBeEf')
+-- !query 7 schema
+struct<CAST(De\123dBeEf AS BINARY):binary>
+-- !query 7 output
+De\123dBeEf
+
+
+-- !query 8
+SELECT TRIM(BOTH FROM '  bunch o blanks  ') = 'bunch o blanks' AS `bunch o 
blanks`
+-- !query 8 schema
+struct<bunch o blanks:boolean>
+-- !query 8 output
+true
+
+
+-- !query 9
+SELECT TRIM(LEADING FROM '  bunch o blanks  ') = 'bunch o blanks  ' AS `bunch 
o blanks  `
+-- !query 9 schema
+struct<bunch o blanks  :boolean>
+-- !query 9 output
+true
+
+
+-- !query 10
+SELECT TRIM(TRAILING FROM '  bunch o blanks  ') = '  bunch o blanks' AS `  
bunch o blanks`
+-- !query 10 schema
+struct<  bunch o blanks:boolean>
+-- !query 10 output
+true
+
+
+-- !query 11
+SELECT TRIM(BOTH 'x' FROM 'xxxxxsome Xsxxxxx') = 'some Xs' AS `some Xs`
+-- !query 11 schema
+struct<some Xs:boolean>
+-- !query 11 output
+true
+
+
+-- !query 12
+SELECT SUBSTRING('1234567890' FROM 3) = '34567890' AS `34567890`
+-- !query 12 schema
+struct<34567890:boolean>
+-- !query 12 output
+true
+
+
+-- !query 13
+SELECT SUBSTRING('1234567890' FROM 4 FOR 3) = '456' AS `456`
+-- !query 13 schema
+struct<456:boolean>
+-- !query 13 output
+true
+
+
+-- !query 14
+SELECT POSITION('4' IN '1234567890') = '4' AS `4`
+-- !query 14 schema
+struct<4:boolean>
+-- !query 14 output
+true
+
+
+-- !query 15
+SELECT POSITION('5' IN '1234567890') = '5' AS `5`
+-- !query 15 schema
+struct<5:boolean>
+-- !query 15 output
+true
+
+
+-- !query 16
+SELECT 'hawkeye' LIKE 'h%' AS `true`
+-- !query 16 schema
+struct<true:boolean>
+-- !query 16 output
+true
+
+
+-- !query 17
+SELECT 'hawkeye' NOT LIKE 'h%' AS `false`
+-- !query 17 schema
+struct<false:boolean>
+-- !query 17 output
+false
+
+
+-- !query 18
+SELECT 'hawkeye' LIKE 'H%' AS `false`
+-- !query 18 schema
+struct<false:boolean>
+-- !query 18 output
+false
+
+
+-- !query 19
+SELECT 'hawkeye' NOT LIKE 'H%' AS `true`
+-- !query 19 schema
+struct<true:boolean>
+-- !query 19 output
+true
+
+
+-- !query 20
+SELECT 'hawkeye' LIKE 'indio%' AS `false`
+-- !query 20 schema
+struct<false:boolean>
+-- !query 20 output
+false
+
+
+-- !query 21
+SELECT 'hawkeye' NOT LIKE 'indio%' AS `true`
+-- !query 21 schema
+struct<true:boolean>
+-- !query 21 output
+true
+
+
+-- !query 22
+SELECT 'hawkeye' LIKE 'h%eye' AS `true`
+-- !query 22 schema
+struct<true:boolean>
+-- !query 22 output
+true
+
+
+-- !query 23
+SELECT 'hawkeye' NOT LIKE 'h%eye' AS `false`
+-- !query 23 schema
+struct<false:boolean>
+-- !query 23 output
+false
+
+
+-- !query 24
+SELECT 'indio' LIKE '_ndio' AS `true`
+-- !query 24 schema
+struct<true:boolean>
+-- !query 24 output
+true
+
+
+-- !query 25
+SELECT 'indio' NOT LIKE '_ndio' AS `false`
+-- !query 25 schema
+struct<false:boolean>
+-- !query 25 output
+false
+
+
+-- !query 26
+SELECT 'indio' LIKE 'in__o' AS `true`
+-- !query 26 schema
+struct<true:boolean>
+-- !query 26 output
+true
+
+
+-- !query 27
+SELECT 'indio' NOT LIKE 'in__o' AS `false`
+-- !query 27 schema
+struct<false:boolean>
+-- !query 27 output
+false
+
+
+-- !query 28
+SELECT 'indio' LIKE 'in_o' AS `false`
+-- !query 28 schema
+struct<false:boolean>
+-- !query 28 output
+false
+
+
+-- !query 29
+SELECT 'indio' NOT LIKE 'in_o' AS `true`
+-- !query 29 schema
+struct<true:boolean>
+-- !query 29 output
+true
+
+
+-- !query 30
+SELECT 'foo' LIKE '_%' as t, 'f' LIKE '_%' as t, '' LIKE '_%' as f
+-- !query 30 schema
+struct<t:boolean,t:boolean,f:boolean>
+-- !query 30 output
+true   true    false
+
+
+-- !query 31
+SELECT 'foo' LIKE '%_' as t, 'f' LIKE '%_' as t, '' LIKE '%_' as f
+-- !query 31 schema
+struct<t:boolean,t:boolean,f:boolean>
+-- !query 31 output
+true   true    false
+
+
+-- !query 32
+SELECT 'foo' LIKE '__%' as t, 'foo' LIKE '___%' as t, 'foo' LIKE '____%' as f
+-- !query 32 schema
+struct<t:boolean,t:boolean,f:boolean>
+-- !query 32 output
+true   true    false
+
+
+-- !query 33
+SELECT 'foo' LIKE '%__' as t, 'foo' LIKE '%___' as t, 'foo' LIKE '%____' as f
+-- !query 33 schema
+struct<t:boolean,t:boolean,f:boolean>
+-- !query 33 output
+true   true    false
+
+
+-- !query 34
+SELECT 'jack' LIKE '%____%' AS t
+-- !query 34 schema
+struct<t:boolean>
+-- !query 34 output
+true
+
+
+-- !query 35
+SELECT 'unknown' || ' and unknown' AS `Concat unknown types`
+-- !query 35 schema
+struct<Concat unknown types:string>
+-- !query 35 output
+unknown and unknown
+
+
+-- !query 36
+SELECT string('text') || ' and unknown' AS `Concat text to unknown type`
+-- !query 36 schema
+struct<Concat text to unknown type:string>
+-- !query 36 output
+text and unknown
+
+
+-- !query 37
+CREATE TABLE toasttest(f1 string) USING parquet
+-- !query 37 schema
+struct<>
+-- !query 37 output
+
+
+
+-- !query 38
+insert into toasttest values(repeat('1234567890',10000))
+-- !query 38 schema
+struct<>
+-- !query 38 output
+
+
+
+-- !query 39
+insert into toasttest values(repeat('1234567890',10000))
+-- !query 39 schema
+struct<>
+-- !query 39 output
+
+
+
+-- !query 40
+insert into toasttest values(repeat('1234567890',10000))
+-- !query 40 schema
+struct<>
+-- !query 40 output
+
+
+
+-- !query 41
+insert into toasttest values(repeat('1234567890',10000))
+-- !query 41 schema
+struct<>
+-- !query 41 output
+
+
+
+-- !query 42
+SELECT substr(f1, 99995) from toasttest
+-- !query 42 schema
+struct<substring(f1, 99995, 2147483647):string>
+-- !query 42 output
+567890
+567890
+567890
+567890
+
+
+-- !query 43
+SELECT substr(f1, 99995, 10) from toasttest
+-- !query 43 schema
+struct<substring(f1, 99995, 10):string>
+-- !query 43 output
+567890
+567890
+567890
+567890
+
+
+-- !query 44
+SELECT length('abcdef') AS `length_6`
+-- !query 44 schema
+struct<length_6:int>
+-- !query 44 output
+6
+
+
+-- !query 45
+SELECT position('cd', 'abcdef') AS `pos_3`
+-- !query 45 schema
+struct<pos_3:int>
+-- !query 45 output
+3
+
+
+-- !query 46
+SELECT position('xy', 'abcdef') AS `pos_0`
+-- !query 46 schema
+struct<pos_0:int>
+-- !query 46 output
+0
+
+
+-- !query 47
+SELECT replace('abcdef', 'de', '45') AS `abc45f`
+-- !query 47 schema
+struct<abc45f:string>
+-- !query 47 output
+abc45f
+
+
+-- !query 48
+SELECT replace('yabadabadoo', 'ba', '123') AS `ya123da123doo`
+-- !query 48 schema
+struct<ya123da123doo:string>
+-- !query 48 output
+ya123da123doo
+
+
+-- !query 49
+SELECT replace('yabadoo', 'bad', '') AS `yaoo`
+-- !query 49 schema
+struct<yaoo:string>
+-- !query 49 output
+yaoo
+
+
+-- !query 50
+select hex(256*256*256 - 1) AS `ffffff`
+-- !query 50 schema
+struct<ffffff:string>
+-- !query 50 output
+FFFFFF
+
+
+-- !query 51
+select hex(bigint(bigint(bigint(bigint(256)*256)*256)*256) - 1) AS `ffffffff`
+-- !query 51 schema
+struct<ffffffff:string>
+-- !query 51 output
+FFFFFFFF
+
+
+-- !query 52
+select md5('') = 'd41d8cd98f00b204e9800998ecf8427e' AS `TRUE`
+-- !query 52 schema
+struct<TRUE:boolean>
+-- !query 52 output
+true
+
+
+-- !query 53
+select md5('a') = '0cc175b9c0f1b6a831c399e269772661' AS `TRUE`
+-- !query 53 schema
+struct<TRUE:boolean>
+-- !query 53 output
+true
+
+
+-- !query 54
+select md5('abc') = '900150983cd24fb0d6963f7d28e17f72' AS `TRUE`
+-- !query 54 schema
+struct<TRUE:boolean>
+-- !query 54 output
+true
+
+
+-- !query 55
+select md5('message digest') = 'f96b697d7cb7938d525a2f31aaf161d0' AS `TRUE`
+-- !query 55 schema
+struct<TRUE:boolean>
+-- !query 55 output
+true
+
+
+-- !query 56
+select md5('abcdefghijklmnopqrstuvwxyz') = 'c3fcd3d76192e4007dfb496cca67e13b' 
AS `TRUE`
+-- !query 56 schema
+struct<TRUE:boolean>
+-- !query 56 output
+true
+
+
+-- !query 57
+select md5('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') = 
'd174ab98d277d9f5a5611c2c9f419d9f' AS `TRUE`
+-- !query 57 schema
+struct<TRUE:boolean>
+-- !query 57 output
+true
+
+
+-- !query 58
+select 
md5('12345678901234567890123456789012345678901234567890123456789012345678901234567890')
 = '57edf4a22be3c955ac49da2e2107b67a' AS `TRUE`
+-- !query 58 schema
+struct<TRUE:boolean>
+-- !query 58 output
+true
+
+
+-- !query 59
+select md5(binary('')) = 'd41d8cd98f00b204e9800998ecf8427e' AS `TRUE`
+-- !query 59 schema
+struct<TRUE:boolean>
+-- !query 59 output
+true
+
+
+-- !query 60
+select md5(binary('a')) = '0cc175b9c0f1b6a831c399e269772661' AS `TRUE`
+-- !query 60 schema
+struct<TRUE:boolean>
+-- !query 60 output
+true
+
+
+-- !query 61
+select md5(binary('abc')) = '900150983cd24fb0d6963f7d28e17f72' AS `TRUE`
+-- !query 61 schema
+struct<TRUE:boolean>
+-- !query 61 output
+true
+
+
+-- !query 62
+select md5(binary('message digest')) = 'f96b697d7cb7938d525a2f31aaf161d0' AS 
`TRUE`
+-- !query 62 schema
+struct<TRUE:boolean>
+-- !query 62 output
+true
+
+
+-- !query 63
+select md5(binary('abcdefghijklmnopqrstuvwxyz')) = 
'c3fcd3d76192e4007dfb496cca67e13b' AS `TRUE`
+-- !query 63 schema
+struct<TRUE:boolean>
+-- !query 63 output
+true
+
+
+-- !query 64
+select 
md5(binary('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789')) = 
'd174ab98d277d9f5a5611c2c9f419d9f' AS `TRUE`
+-- !query 64 schema
+struct<TRUE:boolean>
+-- !query 64 output
+true
+
+
+-- !query 65
+select 
md5(binary('12345678901234567890123456789012345678901234567890123456789012345678901234567890'))
 = '57edf4a22be3c955ac49da2e2107b67a' AS `TRUE`
+-- !query 65 schema
+struct<TRUE:boolean>
+-- !query 65 output
+true
+
+
+-- !query 66
+SELECT initcap('hi THOMAS')
+-- !query 66 schema
+struct<initcap(hi THOMAS):string>
+-- !query 66 output
+Hi Thomas
+
+
+-- !query 67
+SELECT lpad('hi', 5, 'xy')
+-- !query 67 schema
+struct<lpad(hi, 5, xy):string>
+-- !query 67 output
+xyxhi
+
+
+-- !query 68
+SELECT lpad('hi', 5)
+-- !query 68 schema
+struct<lpad(hi, 5,  ):string>
+-- !query 68 output
+hi
+
+
+-- !query 69
+SELECT lpad('hi', -5, 'xy')
+-- !query 69 schema
+struct<lpad(hi, -5, xy):string>
+-- !query 69 output
+
+
+
+-- !query 70
+SELECT lpad('hello', 2)
+-- !query 70 schema
+struct<lpad(hello, 2,  ):string>
+-- !query 70 output
+he
+
+
+-- !query 71
+SELECT lpad('hi', 5, '')
+-- !query 71 schema
+struct<lpad(hi, 5, ):string>
+-- !query 71 output
+hi
+
+
+-- !query 72
+SELECT rpad('hi', 5, 'xy')
+-- !query 72 schema
+struct<rpad(hi, 5, xy):string>
+-- !query 72 output
+hixyx
+
+
+-- !query 73
+SELECT rpad('hi', 5)
+-- !query 73 schema
+struct<rpad(hi, 5,  ):string>
+-- !query 73 output
+hi
+
+
+-- !query 74
+SELECT rpad('hi', -5, 'xy')
+-- !query 74 schema
+struct<rpad(hi, -5, xy):string>
+-- !query 74 output
+
+
+
+-- !query 75
+SELECT rpad('hello', 2)
+-- !query 75 schema
+struct<rpad(hello, 2,  ):string>
+-- !query 75 output
+he
+
+
+-- !query 76
+SELECT rpad('hi', 5, '')
+-- !query 76 schema
+struct<rpad(hi, 5, ):string>
+-- !query 76 output
+hi
+
+
+-- !query 77
+SELECT ltrim('zzzytrim', 'xyz')
+-- !query 77 schema
+struct<ltrim(zzzytrim, xyz):string>
+-- !query 77 output
+trim
+
+
+-- !query 78
+SELECT translate('', '14', 'ax')
+-- !query 78 schema
+struct<translate(, 14, ax):string>
+-- !query 78 output
+
+
+
+-- !query 79
+SELECT translate('12345', '14', 'ax')
+-- !query 79 schema
+struct<translate(12345, 14, ax):string>
+-- !query 79 output
+a23x5
+
+
+-- !query 80
+SELECT ascii('x')
+-- !query 80 schema
+struct<ascii(x):int>
+-- !query 80 output
+120
+
+
+-- !query 81
+SELECT ascii('')
+-- !query 81 schema
+struct<ascii():int>
+-- !query 81 output
+0
+
+
+-- !query 82
+SELECT chr(65)
+-- !query 82 schema
+struct<chr(CAST(65 AS BIGINT)):string>
+-- !query 82 output
+A
+
+
+-- !query 83
+SELECT chr(0)
+-- !query 83 schema
+struct<chr(CAST(0 AS BIGINT)):string>
+-- !query 83 output
+
+
+
+-- !query 84
+SELECT repeat('Pg', 4)
+-- !query 84 schema
+struct<repeat(Pg, 4):string>
+-- !query 84 output
+PgPgPgPg
+
+
+-- !query 85
+SELECT repeat('Pg', -4)
+-- !query 85 schema
+struct<repeat(Pg, -4):string>
+-- !query 85 output
+
+
+
+-- !query 86
+SELECT trim(binary('\\000') from binary('\\000Tom\\000'))
+-- !query 86 schema
+struct<trim(CAST(CAST(\000Tom\000 AS BINARY) AS STRING), CAST(CAST(\000 AS 
BINARY) AS STRING)):string>
+-- !query 86 output
+Tom
+
+
+-- !query 87
+DROP TABLE toasttest
+-- !query 87 schema
+struct<>
+-- !query 87 output
+


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to