Skip to content

Commit

Permalink
test(9678): reproducer of alias causing expr elimination to error
Browse files Browse the repository at this point in the history
  • Loading branch information
wiedld committed Mar 18, 2024
1 parent eb13f59 commit 84cac33
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions datafusion/sqllogictest/test_files/common_subexpr_eliminate.slt
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.

#############
## Common Subexpr Eliminate Tests
#############

statement ok
CREATE TABLE doubles (
f64 DOUBLE
) as VALUES
(10.1)
;

# common subexpr with coalesce
query RRR rowsort
select f64, coalesce(1.0 / f64, 0.0), acos(coalesce(1.0 / f64, 0.0)) from doubles;
----
10.1 0.09900990099 1.471623942989

# common subexpr with alias
query RRR rowsort
select f64, round(1.0 / f64) as i64_1, acos(round(1.0 / f64)) from doubles;
----
10.1 0 1.570796326795

# common subexpr with coalesce and alias
query RRR rowsort
select f64, coalesce(1.0 / f64, 0.0) as f64_1, acos(coalesce(1.0 / f64, 0.0)) from doubles;
----
10.1 0.09900990099 1.471623942989

0 comments on commit 84cac33

Please sign in to comment.