Questions tagged [lateral]
66 questions
0
votes
1 answer
left join speed issue
can anyone explain why the first query is bit faster than the second?
explain analyze select count(*) from view_recurrence_service_plan_description a
left join (select * from vehicle_roster where cast(schedule_date as date)=current_date) vr on…

Eleven
- 339
- 2
- 6
- 20
0
votes
2 answers
Join on id or null and get first result
I have created the query below:
select * from store str
left join(
select * from schedule sdl
where day = 3
order by
case when sdl.store_id is null then (
case when sdl.strong is true then 0 else 2 end
) else 1 end,…

mallix
- 1,399
- 1
- 21
- 44
0
votes
1 answer
Can I do a LEFT JOIN LATERAL in Hive?
I would like to do a LATERAL JOIN in Hive.
Is there any way to support this? In essence I want to use values in the rows on the LHS as parameters to arbitrary SQL on the RHS.
Here is an example from Postgres: (Forgive my crude example):
create table…

Jeremy
- 682
- 2
- 8
- 17
-1
votes
2 answers
Join with 'conditioned subquery'
I would like to join a 'conditioned subquery'. Let's imagine that we have a table with certain data containing an ID, a created TS and some or one value:
data_table (ID, created_ts, value) .... "652351, 2018-04-03 06:11:31.996, 1" and so on.
…

Air Zrakovic
- 1
- 1
-1
votes
1 answer
Ngrams without words orders in Hive
Creation of name_tab:
CREATE TABLE name_tab (country string,
new_item ARRAY,
estfrequency:double>>);
Insert statement:
INSERT OVERWRITE TABLE name_tab
SELECT country, ngrams(sentences(var2),3,100) as word_map
FROM bdd…

Camel
- 11
- 5
-1
votes
1 answer
ERROR: function expression in form cannot refer to other relations of same query level : How to work around LATERAL
DROP SCHEMA tmp CASCADE;
CREATE SCHEMA tmp ;
SET search_path=tmp;
CREATE TABLE primes
( pos SERIAL NOT NULL PRIMARY KEY
, val INTEGER NOT NULL
, CONSTRAINT primes_alt UNIQUE (val)
);
CREATE FUNCTION is_prime(_val…

wildplasser
- 43,142
- 8
- 66
- 109