forked from apache/datafusion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Optimize CASE expression for "column or null" use case (apache#…
- Loading branch information
Showing
5 changed files
with
242 additions
and
14 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,7 +133,7 @@ In order to run the sqllogictests running against a previously running Postgres | |
PG_COMPAT=true PG_URI="postgresql://[email protected]/postgres" cargo test --features=postgres --test sqllogictests | ||
``` | ||
|
||
The environemnt variables: | ||
The environment variables: | ||
|
||
1. `PG_COMPAT` instructs sqllogictest to run against Postgres (not DataFusion) | ||
2. `PG_URI` contains a `libpq` style connection string, whose format is described in | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# 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. | ||
|
||
# create test data | ||
statement ok | ||
create table foo (a int, b int) as values (1, 2), (3, 4), (5, 6); | ||
|
||
# CASE WHEN with condition | ||
query T | ||
SELECT CASE a WHEN 1 THEN 'one' WHEN 3 THEN 'three' ELSE '?' END FROM foo | ||
---- | ||
one | ||
three | ||
? | ||
|
||
# CASE WHEN with no condition | ||
query I | ||
SELECT CASE WHEN a > 2 THEN a ELSE b END FROM foo | ||
---- | ||
2 | ||
3 | ||
5 | ||
|
||
# column or explicit null | ||
query I | ||
SELECT CASE WHEN a > 2 THEN b ELSE null END FROM foo | ||
---- | ||
NULL | ||
4 | ||
6 | ||
|
||
# column or implicit null | ||
query I | ||
SELECT CASE WHEN a > 2 THEN b END FROM foo | ||
---- | ||
NULL | ||
4 | ||
6 |