Skip to content

DRILL-4682: Allow full schema identifier in SELECT clause#549

Open
vdiravka wants to merge 2 commits intoapache:masterfrom
vdiravka:DRILL-4682
Open

DRILL-4682: Allow full schema identifier in SELECT clause#549
vdiravka wants to merge 2 commits intoapache:masterfrom
vdiravka:DRILL-4682

Conversation

@vdiravka
Copy link
Copy Markdown
Member

  • changed SqlBracketlessSyntax logic in the DrillCompoundIdentifier;
  • added checking of using full schema name in column names;
  • added unit test testColumnNamesWithSchemaName;

} No newline at end of file
@Test // DRILL-4682
public void testColumnNamesWithSchemaName() throws Exception {
test("SELECT cp.`employee.json`.department_id FROM cp.`employee.json` ORDER BY cp.`employee.json`.department_id");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

first comment. Please use TestBuilder to verify some query result. Using test() only verifies query is completed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done in the new commit.

 - changed SqlBracketlessSyntax logic in the DrillCompoundIdentifier;
 - added checking of using full schema name in column names;
 - added unit test testColumnNamesWithSchemaName;
@vdiravka vdiravka force-pushed the DRILL-4682 branch 4 times, most recently from d9cb47e to 2c505a3 Compare July 27, 2016 20:43
@vdiravka
Copy link
Copy Markdown
Member Author

@jinfengni Could you please review the changes


@Test
@Ignore
public void testNestedQueryInWhereStatement() throws Exception {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not fully convinced that the current patch is ready to merge, before we could resolve the case where full-schema qualified names appear in a subquery.

With your patch, looks like we can only allow fully-schema qualified name in a top-level query, which is kind of restricted use case. It's hard to tell Drill user that they only can use one special case, but not for other cases.

I would suggest we look into the Calcite in more detail, to understand the problem more.

@jinfengni
Copy link
Copy Markdown
Contributor

I feel it might be better to work on this issue after Drill rebases Calcite. I debugged a bit in SqlValidator, and seem that the code in Drill's forked Calcite is different from what Calcite master has. It's possible that some of patches (star column) in Drill's forked Calcite changes the behavior, and hence run into problem with the subquery cases. Since star column logic has been merged to Calcite master, it's better to try with this patch after rebasing on top of Calcite master, in stead of coming up with a temporary solution with restrictions.

@vdiravka
Copy link
Copy Markdown
Member Author

vdiravka commented Aug 8, 2016

@jinfengni Agree. It will be better to merge this patch after rebasing to the lastest version of calcite. Because currently I'm not sure how to solve this task in different manner than mine.

@ilooner
Copy link
Copy Markdown
Contributor

ilooner commented Jun 9, 2018

@vdiravka Are you planning to complete this change?

@vdiravka
Copy link
Copy Markdown
Member Author

@ilooner Yes, I am. It is in my backlog. The last status for it in my recent comment for DRILL-4682.

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.

4 participants