Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple join emulation (very experimental - developers only) #3946

Merged
merged 11 commits into from
Dec 28, 2018

Conversation

4ertus2
Copy link
Contributor

@4ertus2 4ertus2 commented Dec 27, 2018

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Category (leave one):

  • New Feature

Short description (up to few sentences):
multiple joins emulation (very experimental)

Detailed description (optional):
Allow some queries with multiple INNER JOINs.

@sartor
Copy link

sartor commented Jan 31, 2019

First of all, thank you for your work!
I've already check this feature and it is working!
But:

  1. Are you planning to allow multiple left joins?
  2. There is problem now with aliases: If all table has alias - we must use prefix for column that are ambiguous in query and we do not allow to use column name with alias prefix for unique names.
    Example:
CREATE TABLE dispatches
(
  id                Int64,
  rule_id           Int32,
  segment_id        Int32
);

CREATE TABLE rules
(
  id            Int32,
  title         String
);

CREATE TABLE segments
(
  id            Int32,
  name         String
);

I must write query (working now):

SELECT 
    name, 
    COUNT(*)
FROM dispatches AS d 
ALL INNER JOIN segments AS s ON s.id = segment_id
ALL INNER JOIN rules AS r ON r.id = rule_id
GROUP BY name

But I want to specify table aliases for all columns (not working now):

SELECT 
    s.name, 
    COUNT(*)
FROM dispatches AS d 
ALL INNER JOIN segments AS s ON s.id = d.segment_id
ALL INNER JOIN rules AS r ON r.id = d.rule_id
GROUP BY s.name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants