Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.

-- MinSparkVersion: 4.0
-- Config: spark.comet.exec.scalaUDF.codegen.enabled=false
-- Config: spark.comet.expression.ArrayJoin.allowIncompatible=false
-- Config: spark.comet.expression.StringToMap.allowIncompatible=false

statement
CREATE TABLE routing_collection_collation(s STRING, a ARRAY<STRING>) USING parquet

statement
INSERT INTO routing_collection_collation VALUES ('a:1,b:2', array('a', 'B')), ('', array()), (NULL, NULL)

query expect_fallback(array_join: spark.comet.exec.scalaUDF.codegen.enabled=false)
SELECT array_join(transform(a, x -> x COLLATE UTF8_LCASE), ',') FROM routing_collection_collation

query expect_fallback(str_to_map: spark.comet.exec.scalaUDF.codegen.enabled=false)
SELECT str_to_map(s COLLATE UTF8_LCASE) FROM routing_collection_collation
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.

-- MinSparkVersion: 4.0
-- Config: spark.comet.exec.scalaUDF.codegen.enabled=true
-- Config: spark.comet.expression.ArrayJoin.allowIncompatible=false
-- Config: spark.comet.expression.StringToMap.allowIncompatible=false

statement
CREATE TABLE routing_collection_collation(s STRING, a ARRAY<STRING>) USING parquet

statement
INSERT INTO routing_collection_collation VALUES ('a:1,b:2', array('a', 'B')), ('', array()), (NULL, NULL)

query expect_dispatch(array_join)
SELECT array_join(transform(a, x -> x COLLATE UTF8_LCASE), ',') FROM routing_collection_collation

query expect_dispatch(str_to_map)
SELECT str_to_map(s COLLATE UTF8_LCASE) FROM routing_collection_collation
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.

-- MinSparkVersion: 4.0
-- Config: spark.comet.exec.scalaUDF.codegen.enabled=false
-- Config: spark.sql.optimizer.inSetConversionThreshold=0

statement
CREATE TABLE routing_predicates(s STRING, t STRING, a STRING, b STRING) USING parquet

statement
INSERT INTO routing_predicates VALUES ('Hello', 'HELLO', 'Hello', 'HELLO'), ('', '', '', ''), (NULL, NULL, NULL, NULL)

query expect_native(equalto)
SELECT a = b FROM routing_predicates

query expect_native(equalnullsafe)
SELECT a <=> b FROM routing_predicates

query expect_native(lessthan)
SELECT a < b FROM routing_predicates

query expect_native(lessthanorequal)
SELECT a <= b FROM routing_predicates

query expect_native(greaterthan)
SELECT a > b FROM routing_predicates

query expect_native(greaterthanorequal)
SELECT a >= b FROM routing_predicates

query expect_native(contains)
SELECT contains(a, b) FROM routing_predicates

query expect_native(startswith)
SELECT startswith(a, b) FROM routing_predicates

query expect_native(endswith)
SELECT endswith(a, b) FROM routing_predicates

query expect_native(in)
SELECT a IN (b, 'other') FROM routing_predicates

query expect_native(inset)
SELECT a IN ('HELLO', 'a', 'b') FROM routing_predicates

query expect_fallback(equalto: spark.comet.exec.scalaUDF.codegen.enabled=false)
SELECT (s COLLATE UTF8_LCASE) = (t COLLATE UTF8_LCASE) FROM routing_predicates

query expect_fallback(equalnullsafe: spark.comet.exec.scalaUDF.codegen.enabled=false)
SELECT (s COLLATE UTF8_LCASE) <=> (t COLLATE UTF8_LCASE) FROM routing_predicates

query expect_fallback(lessthan: spark.comet.exec.scalaUDF.codegen.enabled=false)
SELECT (s COLLATE UTF8_LCASE) < (t COLLATE UTF8_LCASE) FROM routing_predicates

query expect_fallback(lessthanorequal: spark.comet.exec.scalaUDF.codegen.enabled=false)
SELECT (s COLLATE UTF8_LCASE) <= (t COLLATE UTF8_LCASE) FROM routing_predicates

query expect_fallback(greaterthan: spark.comet.exec.scalaUDF.codegen.enabled=false)
SELECT (s COLLATE UTF8_LCASE) > (t COLLATE UTF8_LCASE) FROM routing_predicates

query expect_fallback(greaterthanorequal: spark.comet.exec.scalaUDF.codegen.enabled=false)
SELECT (s COLLATE UTF8_LCASE) >= (t COLLATE UTF8_LCASE) FROM routing_predicates

query expect_fallback(contains: spark.comet.exec.scalaUDF.codegen.enabled=false)
SELECT contains((s COLLATE UTF8_LCASE), (t COLLATE UTF8_LCASE)) FROM routing_predicates

query expect_fallback(startswith: spark.comet.exec.scalaUDF.codegen.enabled=false)
SELECT startswith((s COLLATE UTF8_LCASE), (t COLLATE UTF8_LCASE)) FROM routing_predicates

query expect_fallback(endswith: spark.comet.exec.scalaUDF.codegen.enabled=false)
SELECT endswith((s COLLATE UTF8_LCASE), (t COLLATE UTF8_LCASE)) FROM routing_predicates

query expect_fallback(in: spark.comet.exec.scalaUDF.codegen.enabled=false)
SELECT (s COLLATE UTF8_LCASE) IN ((t COLLATE UTF8_LCASE), 'other') FROM routing_predicates

query expect_fallback(inset: spark.comet.exec.scalaUDF.codegen.enabled=false)
SELECT (s COLLATE UTF8_LCASE) IN ('HELLO', 'a', 'b') FROM routing_predicates
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.

-- MinSparkVersion: 4.0
-- Config: spark.comet.exec.scalaUDF.codegen.enabled=true
-- Config: spark.sql.optimizer.inSetConversionThreshold=0

statement
CREATE TABLE routing_predicates(s STRING, t STRING, a STRING, b STRING) USING parquet

statement
INSERT INTO routing_predicates VALUES ('Hello', 'HELLO', 'Hello', 'HELLO'), ('', '', '', ''), (NULL, NULL, NULL, NULL)

query expect_native(equalto)
SELECT a = b FROM routing_predicates

query expect_native(equalnullsafe)
SELECT a <=> b FROM routing_predicates

query expect_native(lessthan)
SELECT a < b FROM routing_predicates

query expect_native(lessthanorequal)
SELECT a <= b FROM routing_predicates

query expect_native(greaterthan)
SELECT a > b FROM routing_predicates

query expect_native(greaterthanorequal)
SELECT a >= b FROM routing_predicates

query expect_native(contains)
SELECT contains(a, b) FROM routing_predicates

query expect_native(startswith)
SELECT startswith(a, b) FROM routing_predicates

query expect_native(endswith)
SELECT endswith(a, b) FROM routing_predicates

query expect_native(in)
SELECT a IN (b, 'other') FROM routing_predicates

query expect_native(inset)
SELECT a IN ('HELLO', 'a', 'b') FROM routing_predicates

query expect_dispatch(equalto)
SELECT (s COLLATE UTF8_LCASE) = (t COLLATE UTF8_LCASE) FROM routing_predicates

query expect_dispatch(equalnullsafe)
SELECT (s COLLATE UTF8_LCASE) <=> (t COLLATE UTF8_LCASE) FROM routing_predicates

query expect_dispatch(lessthan)
SELECT (s COLLATE UTF8_LCASE) < (t COLLATE UTF8_LCASE) FROM routing_predicates

query expect_dispatch(lessthanorequal)
SELECT (s COLLATE UTF8_LCASE) <= (t COLLATE UTF8_LCASE) FROM routing_predicates

query expect_dispatch(greaterthan)
SELECT (s COLLATE UTF8_LCASE) > (t COLLATE UTF8_LCASE) FROM routing_predicates

query expect_dispatch(greaterthanorequal)
SELECT (s COLLATE UTF8_LCASE) >= (t COLLATE UTF8_LCASE) FROM routing_predicates

query expect_dispatch(contains)
SELECT contains((s COLLATE UTF8_LCASE), (t COLLATE UTF8_LCASE)) FROM routing_predicates

query expect_dispatch(startswith)
SELECT startswith((s COLLATE UTF8_LCASE), (t COLLATE UTF8_LCASE)) FROM routing_predicates

query expect_dispatch(endswith)
SELECT endswith((s COLLATE UTF8_LCASE), (t COLLATE UTF8_LCASE)) FROM routing_predicates

query expect_dispatch(in)
SELECT (s COLLATE UTF8_LCASE) IN ((t COLLATE UTF8_LCASE), 'other') FROM routing_predicates

query expect_dispatch(inset)
SELECT (s COLLATE UTF8_LCASE) IN ('HELLO', 'a', 'b') FROM routing_predicates
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.

-- MinSparkVersion: 4.0
-- Config: spark.comet.exec.scalaUDF.codegen.enabled=false
-- Config: spark.comet.expression.Concat.allowIncompatible=false
-- Config: spark.comet.expression.Reverse.allowIncompatible=false

statement
CREATE TABLE routing_string_collation(s STRING, plain STRING) USING parquet

statement
INSERT INTO routing_string_collation VALUES ('Hello', 'hello'), ('', ''), (NULL, NULL)

query expect_native(reverse)
SELECT reverse(plain) FROM routing_string_collation

query expect_native(levenshtein)
SELECT levenshtein(plain, 'hello') FROM routing_string_collation

query expect_fallback(concat: spark.comet.exec.scalaUDF.codegen.enabled=false)
SELECT concat(s COLLATE UTF8_LCASE, '!') FROM routing_string_collation

query expect_fallback(reverse: spark.comet.exec.scalaUDF.codegen.enabled=false)
SELECT reverse(s COLLATE UTF8_LCASE) FROM routing_string_collation

query expect_fallback(like: spark.comet.exec.scalaUDF.codegen.enabled=false)
SELECT (s COLLATE UTF8_LCASE) LIKE 'H_llo' FROM routing_string_collation

query expect_fallback(levenshtein: spark.comet.exec.scalaUDF.codegen.enabled=false)
SELECT levenshtein(s COLLATE UTF8_LCASE, 'HELLO') FROM routing_string_collation
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.

-- MinSparkVersion: 4.0
-- Config: spark.comet.exec.scalaUDF.codegen.enabled=true
-- Config: spark.comet.expression.Concat.allowIncompatible=false
-- Config: spark.comet.expression.Reverse.allowIncompatible=false

statement
CREATE TABLE routing_string_collation(s STRING, plain STRING) USING parquet

statement
INSERT INTO routing_string_collation VALUES ('Hello', 'hello'), ('', ''), (NULL, NULL)

query expect_native(reverse)
SELECT reverse(plain) FROM routing_string_collation

query expect_native(levenshtein)
SELECT levenshtein(plain, 'hello') FROM routing_string_collation

query expect_dispatch(concat)
SELECT concat(s COLLATE UTF8_LCASE, '!') FROM routing_string_collation

query expect_dispatch(reverse)
SELECT reverse(s COLLATE UTF8_LCASE) FROM routing_string_collation

query expect_dispatch(like)
SELECT (s COLLATE UTF8_LCASE) LIKE 'H_llo' FROM routing_string_collation

query expect_dispatch(levenshtein)
SELECT levenshtein(s COLLATE UTF8_LCASE, 'HELLO') FROM routing_string_collation
Loading
Loading