Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Fix for More Than Two Disjunction Predicate #1064

Merged
merged 9 commits into from Aug 11, 2020
Merged

Conversation

wuwenw
Copy link
Contributor

@wuwenw wuwenw commented Aug 7, 2020

Add support for #1058. In the Conjunction Translator constructor, prepare() would recursively create translator for children, so we just need to loop through them.

Sample SQL test:

terrier=# CREATE TABLE xxx1 (id INT, data INT, time INT);
CREATE TABLE
terrier=# INSERT INTO xxx1 VALUES (1, 10, 100),(2, 20, 200),(3, 30, 300),(4, 40, 400);
INSERT 0 4
terrier=# SELECT * FROM xxx1 WHERE id=1 OR id=2 OR id=3 OR id=4;
 id | data | time
----+------+------
  1 |   10 |  100
  2 |   20 |  200
  3 |   30 |  300
  4 |   40 |  400
(4 rows)

terrier=# SELECT * FROM xxx1 WHERE id=1 AND data=10 AND time=100 OR id=2;
 id | data | time
----+------+------
  1 |   10 |  100
  2 |   20 |  200
(2 rows)

terrier=# SELECT * FROM xxx1 WHERE (id=1 OR data=10 AND time=200) AND (time=100 OR id=2);
 id | data | time
----+------+------
  1 |   10 |  100
(1 row)

terrier=# SELECT * FROM xxx1 WHERE (id=2 OR (id=1 AND (time=100 AND data=10))) OR (id=3 AND data=30);
 id | data | time
----+------+------
  1 |   10 |  100
  2 |   20 |  200
  3 |   30 |  300
(3 rows)

terrier=# SELECT * FROM xxx1 WHERE id=1 OR time=300 AND id=3 OR id=4 AND time=200 OR id=2 AND data=20 OR id=5;
 id | data | time
----+------+------
  1 |   10 |  100
  2 |   20 |  200
  3 |   30 |  300
(3 rows)

@wuwenw wuwenw added the ready-for-review This PR passes all checks and is ready to be reviewed. Mark PRs with this. label Aug 7, 2020
@apavlo apavlo self-requested a review August 7, 2020 20:33
@codecov
Copy link

codecov bot commented Aug 8, 2020

Codecov Report

Merging #1064 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1064   +/-   ##
=======================================
  Coverage   80.77%   80.77%           
=======================================
  Files         668      668           
  Lines       42731    42731           
=======================================
  Hits        34516    34516           
  Misses       8215     8215           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9027b0e...765c895. Read the comment docs.

Copy link
Member

@apavlo apavlo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add test SQL from @dniu16

src/execution/compiler/operator/seq_scan_translator.cpp Outdated Show resolved Hide resolved
@wuwenw wuwenw requested a review from apavlo August 10, 2020 17:10
Copy link
Member

@apavlo apavlo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@apavlo apavlo merged commit e24296a into cmu-db:master Aug 11, 2020
stephaniewang100 added a commit to stephaniewang100/terrier-steph that referenced this pull request Aug 14, 2020
* Add Debug Log Timestamps to Python Test Harness (cmu-db#1010)

Co-authored-by: Benliang Wang <benlianw@gmail.com>

* Add SQL Trace Files to Repository (cmu-db#1025)

Co-authored-by: Andy Pavlo <pavlo@cs.brown.edu>

* Add Support for ORDER BY column# (cmu-db#964)

Co-authored-by: wangguangyuan <wangguangyuan@sensetime.com>
Co-authored-by: Matt Butrovich <mbutrovich@users.noreply.github.com>
Co-authored-by: Andy Pavlo <pavlo@cs.brown.edu>

* Re-enable Microbenchmark Regression Checks (cmu-db#1034)

* Fix self joins which use index joins (cmu-db#1022)

* [TPL2] Update of execution engine (cmu-db#994)

Co-authored-by: Tanuj Nayak <tanujnay112@live.com>
Co-authored-by: Matt Butrovich <mbutrovich@users.noreply.github.com>
Co-authored-by: Matt Butrovich <mbutrovich@gmail.com>
Co-authored-by: Wan Shen Lim <wanshenl@cs.cmu.edu>

* Build improvements (cmu-db#1026)

* Add support for compiling shared library

* mac OS build fix

Searches for Brew's clang++ on mac OS, which is required for builds.

* Build with dynamic-linking on non-mac OS platforms

Supports dynamic linking on non-mac OS platforms, but force-disables it on mac OS.

* Make sure that OLTP-Bench results directory names are unique (cmu-db#1015)

* Move Limit/Offset Fields to AbstractScanPlanNode (cmu-db#938)

Co-authored-by: Matt Butrovich <mbutrovich@users.noreply.github.com>
Co-authored-by: Andy Pavlo <pavlo@cs.brown.edu>

* Merge Matt's requested changes

Implements the changes that Matt requested.

* Disable ODR violation detection for asan tests

Address sanitizer checks for one-definition-rule violations. This ruins tests.
This is technically a bandaid solution, but since the violations don't seem to matter, it's probably the best solution.

* Fix ASAN options

Avoids overwriting Mac OS ASAN options.

* Statically link spdlog

An attempt (here goes nothing) at bringing in spdlog as a git submodule and statically linking it.

* Cleaner Clang initialization on MacOS

Sets the location of Clang on MacOS by reusing existing variables.

* Pull submodules from within Jenkinsfile

* Just a test commit to try to coerce a proper build. Will revert.

Ignore me.

* Revert "Explicit instantiation of spdlog template functions (cmu-db#995)"

This reverts commit 686eb69.

* Update spdlog entry in versions.txt

Migrate to remote fetching of spdlog.

* Delete spdlog folder

Entirely manage spdlog through CMake.

* Revert "Just a test commit to try to coerce a proper build. Will revert."

This reverts commit d162eae.

* Revert "Pull submodules from within Jenkinsfile"

This reverts commit ca80090.

* Revert changes to .gitmodules

* Revert src/CMakeLists.txt

* Fetch and (properly) build spdlog

* Literally just adding a file named "a"

Attempting to make this visible to Jenkins.

* Obscure bugfix for Release builds

Fixes Release builds for macOS by slightly changing header order.

May cause obscure AppleClang segfaults. In fact, this will almost certainly cause a segfault on the Jenkins machine during the build, but here's why I'm submitting this anyway:
I've been attempting to debug AppleClang, but after a few hours of debugging, I'm at my wits end.
There's a bug somewhere in this call to getRegClassWeight, which causes getRegClassWeight to dereference a null pointer: https://github.com/llvm/llvm-project-staging/blob/f0fd4f3af0acda5068acc5bbe10b3792c41bdfc4/llvm/lib/CodeGen/MachineLICM.cpp#L912
The really weird thing is that for regular Clang, getRegisterClassWeight should be essentially a no-op here--it's a const getter. There's really not much that should be going on unless a null registerclass is being passed, but even then, it shouldn't be crashing *here*. A null registerclass should cause catastrophic failure way earlier. So I'm thinking Apple's fork of Clang does something special here that Clang doesn't do, and that the Jenkins version of AppleClang might not incorporate this new feature, since it runs an older version of the macOS toolchain.

* Fix FindClangTools.cmake

A long-standing pet peeve of mine is that FindClangTools.cmake doesn't work (at least not on Arch) when clang-{format,tidy} are installed through the system package manager. This fixes that.

* Cleaner ThirdPartyToolchain.cmake

Removes some unneeded code that used to (but no longer) exists in the codebase.

* Suppress clang-format warning

We are actually required to keep the includes in this order (at least, spdlog.h MUST be at the top). clang-format is really bothered by this.

* Remove stray file. Override compiler on macOS in Jenkinsfile.

* Different way to set compiler on macOS.

* Revert "Different way to set compiler on macOS."

This reverts commit 8a06349

* Fix typo.

Co-authored-by: Kevin Geng <khg@andrew.cmu.edu>
Co-authored-by: Jordi Gonzalez <jordig@imac1.db.pdl.local.cmu.edu>
Co-authored-by: Yao Yu <skyfish.jy@gmail.com>
Co-authored-by: Joseph Koshakow <jkosh44@users.noreply.github.com>
Co-authored-by: Matt Butrovich <mbutrovich@users.noreply.github.com>
Co-authored-by: Andy Pavlo <pavlo@cs.brown.edu>
Co-authored-by: Matt Butrovich <mbutrovich@gmail.com>

* Revert "Build improvements (cmu-db#1026)" (cmu-db#1036)

This reverts commit d31d08e

* Fix update counts, run TPCC in end-to-end performance on Jenkins. (cmu-db#1039)

* Add execCtxAddRowsAffected builtin.

* Fix TrafficCopTest.

* Change Jenkinsfile End-to-End Performance to (1) timeout for tatp, (2) run tpcc.

Co-authored-by: Wan Shen Lim <wanshenl@cs.cmu.edu>

* Refactor Python Test Harness to Improve Extensibility (cmu-db#1024)

Co-authored-by: Daniel Biales <bialesdaniel@gmail.com>
Co-authored-by: Andy Pavlo <pavlo@cs.brown.edu>

* Fix pipeline metrics, clean up some stray includes (cmu-db#1044)

* compiled_query_execution command line arg (cmu-db#1057)

* Forward declare (operator and expression) translators, fix TPL AstPrettyPrint for array length. (cmu-db#1051)

* Fix parallel codegen and parallel scan, force insert/update/delete to be serial. (cmu-db#1056)

* Add Support for More than Two Disjunction Predicates (cmu-db#1064)

Co-authored-by: Andy Pavlo <pavlo@cs.brown.edu>
Co-authored-by: Matt Butrovich <mbutrovich@users.noreply.github.com>

* VarlenEntry microbenchmark (cmu-db#1055)

* Mini-Runners Update for TPLv2 Engine (cmu-db#1060)

* Hyperbolic Trig SQL Functions (cmu-db#1078)

Co-authored-by: rohanaggarwal <aggarwal.rohan@yahoo.co.in>
Co-authored-by: gautam20197 <gautam20197@gmail.com>
Co-authored-by: Preetansh Goyal <preetjee313@gmail.com>
Co-authored-by: Matt Butrovich <mbutrovich@users.noreply.github.com>

Co-authored-by: benliangw <benliangw@gmail.com>
Co-authored-by: Benliang Wang <benlianw@gmail.com>
Co-authored-by: Jeff Niu <dniu@andrew.cmu.edu>
Co-authored-by: Andy Pavlo <pavlo@cs.brown.edu>
Co-authored-by: coco <coconason@gmail.com>
Co-authored-by: wangguangyuan <wangguangyuan@sensetime.com>
Co-authored-by: Matt Butrovich <mbutrovich@users.noreply.github.com>
Co-authored-by: abalakumar083 <30840848+abalakumar083@users.noreply.github.com>
Co-authored-by: Wan Shen Lim <wanshen.lim@gmail.com>
Co-authored-by: Tanuj Nayak <tanujnay112@live.com>
Co-authored-by: Matt Butrovich <mbutrovich@gmail.com>
Co-authored-by: Wan Shen Lim <wanshenl@cs.cmu.edu>
Co-authored-by: J. Gonzalez <gonzalezjo@users.noreply.github.com>
Co-authored-by: Kevin Geng <khg@andrew.cmu.edu>
Co-authored-by: Jordi Gonzalez <jordig@imac1.db.pdl.local.cmu.edu>
Co-authored-by: Yao Yu <skyfish.jy@gmail.com>
Co-authored-by: Joseph Koshakow <jkosh44@users.noreply.github.com>
Co-authored-by: Daniel Biales <bialesdaniel@gmail.com>
Co-authored-by: wuwenw <55009204+wuwenw@users.noreply.github.com>
Co-authored-by: William Zhang <wz2@andrew.cmu.edu>
Co-authored-by: rohanaggarwal <aggarwal.rohan@yahoo.co.in>
Co-authored-by: gautam20197 <gautam20197@gmail.com>
Co-authored-by: Preetansh Goyal <preetjee313@gmail.com>
stephaniewang100 added a commit to stephaniewang100/terrier-steph that referenced this pull request Aug 14, 2020
* Add Debug Log Timestamps to Python Test Harness (cmu-db#1010)

Co-authored-by: Benliang Wang <benlianw@gmail.com>

* Add SQL Trace Files to Repository (cmu-db#1025)

Co-authored-by: Andy Pavlo <pavlo@cs.brown.edu>

* Add Support for ORDER BY column# (cmu-db#964)

Co-authored-by: wangguangyuan <wangguangyuan@sensetime.com>
Co-authored-by: Matt Butrovich <mbutrovich@users.noreply.github.com>
Co-authored-by: Andy Pavlo <pavlo@cs.brown.edu>

* Re-enable Microbenchmark Regression Checks (cmu-db#1034)

* Fix self joins which use index joins (cmu-db#1022)

* [TPL2] Update of execution engine (cmu-db#994)

Co-authored-by: Tanuj Nayak <tanujnay112@live.com>
Co-authored-by: Matt Butrovich <mbutrovich@users.noreply.github.com>
Co-authored-by: Matt Butrovich <mbutrovich@gmail.com>
Co-authored-by: Wan Shen Lim <wanshenl@cs.cmu.edu>

* Build improvements (cmu-db#1026)

* Add support for compiling shared library

* mac OS build fix

Searches for Brew's clang++ on mac OS, which is required for builds.

* Build with dynamic-linking on non-mac OS platforms

Supports dynamic linking on non-mac OS platforms, but force-disables it on mac OS.

* Make sure that OLTP-Bench results directory names are unique (cmu-db#1015)

* Move Limit/Offset Fields to AbstractScanPlanNode (cmu-db#938)

Co-authored-by: Matt Butrovich <mbutrovich@users.noreply.github.com>
Co-authored-by: Andy Pavlo <pavlo@cs.brown.edu>

* Merge Matt's requested changes

Implements the changes that Matt requested.

* Disable ODR violation detection for asan tests

Address sanitizer checks for one-definition-rule violations. This ruins tests.
This is technically a bandaid solution, but since the violations don't seem to matter, it's probably the best solution.

* Fix ASAN options

Avoids overwriting Mac OS ASAN options.

* Statically link spdlog

An attempt (here goes nothing) at bringing in spdlog as a git submodule and statically linking it.

* Cleaner Clang initialization on MacOS

Sets the location of Clang on MacOS by reusing existing variables.

* Pull submodules from within Jenkinsfile

* Just a test commit to try to coerce a proper build. Will revert.

Ignore me.

* Revert "Explicit instantiation of spdlog template functions (cmu-db#995)"

This reverts commit 686eb69.

* Update spdlog entry in versions.txt

Migrate to remote fetching of spdlog.

* Delete spdlog folder

Entirely manage spdlog through CMake.

* Revert "Just a test commit to try to coerce a proper build. Will revert."

This reverts commit d162eae.

* Revert "Pull submodules from within Jenkinsfile"

This reverts commit ca80090.

* Revert changes to .gitmodules

* Revert src/CMakeLists.txt

* Fetch and (properly) build spdlog

* Literally just adding a file named "a"

Attempting to make this visible to Jenkins.

* Obscure bugfix for Release builds

Fixes Release builds for macOS by slightly changing header order.

May cause obscure AppleClang segfaults. In fact, this will almost certainly cause a segfault on the Jenkins machine during the build, but here's why I'm submitting this anyway:
I've been attempting to debug AppleClang, but after a few hours of debugging, I'm at my wits end.
There's a bug somewhere in this call to getRegClassWeight, which causes getRegClassWeight to dereference a null pointer: https://github.com/llvm/llvm-project-staging/blob/f0fd4f3af0acda5068acc5bbe10b3792c41bdfc4/llvm/lib/CodeGen/MachineLICM.cpp#L912
The really weird thing is that for regular Clang, getRegisterClassWeight should be essentially a no-op here--it's a const getter. There's really not much that should be going on unless a null registerclass is being passed, but even then, it shouldn't be crashing *here*. A null registerclass should cause catastrophic failure way earlier. So I'm thinking Apple's fork of Clang does something special here that Clang doesn't do, and that the Jenkins version of AppleClang might not incorporate this new feature, since it runs an older version of the macOS toolchain.

* Fix FindClangTools.cmake

A long-standing pet peeve of mine is that FindClangTools.cmake doesn't work (at least not on Arch) when clang-{format,tidy} are installed through the system package manager. This fixes that.

* Cleaner ThirdPartyToolchain.cmake

Removes some unneeded code that used to (but no longer) exists in the codebase.

* Suppress clang-format warning

We are actually required to keep the includes in this order (at least, spdlog.h MUST be at the top). clang-format is really bothered by this.

* Remove stray file. Override compiler on macOS in Jenkinsfile.

* Different way to set compiler on macOS.

* Revert "Different way to set compiler on macOS."

This reverts commit 8a06349

* Fix typo.

Co-authored-by: Kevin Geng <khg@andrew.cmu.edu>
Co-authored-by: Jordi Gonzalez <jordig@imac1.db.pdl.local.cmu.edu>
Co-authored-by: Yao Yu <skyfish.jy@gmail.com>
Co-authored-by: Joseph Koshakow <jkosh44@users.noreply.github.com>
Co-authored-by: Matt Butrovich <mbutrovich@users.noreply.github.com>
Co-authored-by: Andy Pavlo <pavlo@cs.brown.edu>
Co-authored-by: Matt Butrovich <mbutrovich@gmail.com>

* Revert "Build improvements (cmu-db#1026)" (cmu-db#1036)

This reverts commit d31d08e

* Fix update counts, run TPCC in end-to-end performance on Jenkins. (cmu-db#1039)

* Add execCtxAddRowsAffected builtin.

* Fix TrafficCopTest.

* Change Jenkinsfile End-to-End Performance to (1) timeout for tatp, (2) run tpcc.

Co-authored-by: Wan Shen Lim <wanshenl@cs.cmu.edu>

* Refactor Python Test Harness to Improve Extensibility (cmu-db#1024)

Co-authored-by: Daniel Biales <bialesdaniel@gmail.com>
Co-authored-by: Andy Pavlo <pavlo@cs.brown.edu>

* Fix pipeline metrics, clean up some stray includes (cmu-db#1044)

* compiled_query_execution command line arg (cmu-db#1057)

* Forward declare (operator and expression) translators, fix TPL AstPrettyPrint for array length. (cmu-db#1051)

* Fix parallel codegen and parallel scan, force insert/update/delete to be serial. (cmu-db#1056)

* Add Support for More than Two Disjunction Predicates (cmu-db#1064)

Co-authored-by: Andy Pavlo <pavlo@cs.brown.edu>
Co-authored-by: Matt Butrovich <mbutrovich@users.noreply.github.com>

* VarlenEntry microbenchmark (cmu-db#1055)

* Mini-Runners Update for TPLv2 Engine (cmu-db#1060)

* Hyperbolic Trig SQL Functions (cmu-db#1078)

Co-authored-by: rohanaggarwal <aggarwal.rohan@yahoo.co.in>
Co-authored-by: gautam20197 <gautam20197@gmail.com>
Co-authored-by: Preetansh Goyal <preetjee313@gmail.com>
Co-authored-by: Matt Butrovich <mbutrovich@users.noreply.github.com>

Co-authored-by: benliangw <benliangw@gmail.com>
Co-authored-by: Benliang Wang <benlianw@gmail.com>
Co-authored-by: Jeff Niu <dniu@andrew.cmu.edu>
Co-authored-by: Andy Pavlo <pavlo@cs.brown.edu>
Co-authored-by: coco <coconason@gmail.com>
Co-authored-by: wangguangyuan <wangguangyuan@sensetime.com>
Co-authored-by: Matt Butrovich <mbutrovich@users.noreply.github.com>
Co-authored-by: abalakumar083 <30840848+abalakumar083@users.noreply.github.com>
Co-authored-by: Wan Shen Lim <wanshen.lim@gmail.com>
Co-authored-by: Tanuj Nayak <tanujnay112@live.com>
Co-authored-by: Matt Butrovich <mbutrovich@gmail.com>
Co-authored-by: Wan Shen Lim <wanshenl@cs.cmu.edu>
Co-authored-by: J. Gonzalez <gonzalezjo@users.noreply.github.com>
Co-authored-by: Kevin Geng <khg@andrew.cmu.edu>
Co-authored-by: Jordi Gonzalez <jordig@imac1.db.pdl.local.cmu.edu>
Co-authored-by: Yao Yu <skyfish.jy@gmail.com>
Co-authored-by: Joseph Koshakow <jkosh44@users.noreply.github.com>
Co-authored-by: Daniel Biales <bialesdaniel@gmail.com>
Co-authored-by: wuwenw <55009204+wuwenw@users.noreply.github.com>
Co-authored-by: William Zhang <wz2@andrew.cmu.edu>
Co-authored-by: rohanaggarwal <aggarwal.rohan@yahoo.co.in>
Co-authored-by: gautam20197 <gautam20197@gmail.com>
Co-authored-by: Preetansh Goyal <preetjee313@gmail.com>

Co-authored-by: benliangw <benliangw@gmail.com>
Co-authored-by: Benliang Wang <benlianw@gmail.com>
Co-authored-by: Jeff Niu <dniu@andrew.cmu.edu>
Co-authored-by: Andy Pavlo <pavlo@cs.brown.edu>
Co-authored-by: coco <coconason@gmail.com>
Co-authored-by: wangguangyuan <wangguangyuan@sensetime.com>
Co-authored-by: Matt Butrovich <mbutrovich@users.noreply.github.com>
Co-authored-by: abalakumar083 <30840848+abalakumar083@users.noreply.github.com>
Co-authored-by: Wan Shen Lim <wanshen.lim@gmail.com>
Co-authored-by: Tanuj Nayak <tanujnay112@live.com>
Co-authored-by: Matt Butrovich <mbutrovich@gmail.com>
Co-authored-by: Wan Shen Lim <wanshenl@cs.cmu.edu>
Co-authored-by: J. Gonzalez <gonzalezjo@users.noreply.github.com>
Co-authored-by: Kevin Geng <khg@andrew.cmu.edu>
Co-authored-by: Jordi Gonzalez <jordig@imac1.db.pdl.local.cmu.edu>
Co-authored-by: Yao Yu <skyfish.jy@gmail.com>
Co-authored-by: Joseph Koshakow <jkosh44@users.noreply.github.com>
Co-authored-by: Daniel Biales <bialesdaniel@gmail.com>
Co-authored-by: wuwenw <55009204+wuwenw@users.noreply.github.com>
Co-authored-by: William Zhang <wz2@andrew.cmu.edu>
Co-authored-by: rohanaggarwal <aggarwal.rohan@yahoo.co.in>
Co-authored-by: gautam20197 <gautam20197@gmail.com>
Co-authored-by: Preetansh Goyal <preetjee313@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ready-for-review This PR passes all checks and is ready to be reviewed. Mark PRs with this.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants