Comments (3)
That's a bigger topic then as subqueries are generally treated in a special way, independent of the evaluation logic of an expression.
from crate.
Only evaluate "the arguments that are needed to determine the result" as in
This is actually kinda the case, except that we also have a constant-folding/normalization step to reduce operations like 1 + 1
to 2
, to avoid having to repeat the step per row.
In your example the sleep
parameter is literal, so this logic kicks in.
How does the expensive lookup in your actual use-case look like?
from crate.
How does the expensive lookup in your actual use-case look like?
It is along the lines of something like this:
CREATE TABLE invoices (
some_data TEXT
,customer_id INT
,invoice_specific_payment_terms TEXT
);
INSERT INTO invoices
SELECT 'abc',1,'60 days from receipt of invoice';
REFRESH TABLE invoices;
--> NB in this example invoice_specific_payment_terms is never NULL
CREATE TABLE customers (
customer_id INT
,customer_default_payment_terms TEXT
);
INSERT INTO customers
SELECT 1,'30 days from receipt of invoice';
REFRESH TABLE customers;
CREATE TABLE distributed_summits AS
SELECT * FROM sys.summits;
ANALYZE;
SELECT some_data,
CASE
WHEN invoice_specific_payment_terms IS NOT NULL
THEN invoice_specific_payment_terms
ELSE ( SELECT customer_default_payment_terms
FROM customers
CROSS JOIN distributed_summits s1
CROSS JOIN distributed_summits s2
CROSS JOIN distributed_summits s3
WHERE customers.customer_id=invoices.customer_id
ORDER BY s3.height DESC
LIMIT 1
)
END
FROM invoices;
from crate.
Related Issues (20)
- Invalid results when filtering with `ARRAY_LENGTH` on an array in array of objects HOT 2
- IndexOutOfBoundsException on query with ORDER BY in 3 nodes cluster HOT 3
- ShardInfo in NodeInfo MXBean is missing the schema name leading to duplicates HOT 4
- Table with dynamic column policy is silently failing first insert if it includes an empty array HOT 5
- Unexpected result when using empty `OBJECT` literal HOT 2
- Behaviour of numeric scale and casting inconsistent / unspecified HOT 2
- PostgreSQL wire protocol: type OID for text responses in prepared statements is invalid HOT 4
- PostgreSQL compatibility: SQL statement containing only comment not accepted HOT 3
- io.crate.integrationtests.LuceneQueryBuilderIntegrationTest#testNullOperators HOT 5
- Cannot add new column to a partitioned table after changing the number of shards HOT 2
- optimize lucene query generation for distinct from
- Avoid utf8->utf16 conversations (for grouping operations)
- UDFs with parameters incorrectly looked up with names all lowercase when used in GENERATED column HOT 1
- ClassCastException on selecting join field from table with objects HOT 2
- Unexpected results when using `OBJECT` nulls HOT 1
- Add CLI tool to recover a corrupted shard HOT 1
- Inconsistent type mapping when trying to insert scalar and array value for sub-column in `VALUES` statement. HOT 1
- Unexpected results when matching empty string with indexing disabled HOT 2
- Unexpected result when querying partitioned table with null values HOT 2
- Filtering by `= ALL` on float types does not work HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crate.