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

Implement SqlTableIdentifierFindVisitor #6

Closed
taewhi opened this issue Mar 3, 2022 · 0 comments · Fixed by #8
Closed

Implement SqlTableIdentifierFindVisitor #6

taewhi opened this issue Mar 3, 2022 · 0 comments · Fixed by #8
Assignees
Labels
bug Something isn't working

Comments

@taewhi
Copy link
Member

taewhi commented Mar 3, 2022

@Override
public SqlNode visit(SqlCall call) {
if (call instanceof SqlSelect) {
int i = 0;
for (SqlNode operand : call.getOperandList()) {
// FROM operand
if (i == 2) {
nodeStack.push(State.FROM);
} else {
nodeStack.push(State.NOT_FROM);
}
i++;
if (operand == null) {
continue;
}
operand.accept(this);
nodeStack.pop();
}
return null;
}
SqlOperator operator = call.getOperator();
if (operator != null && operator.getKind() == SqlKind.AS) {
// AS operator will be probed only if it is in FROM clause
if (nodeStack.peek() == State.FROM) {
call.operand(0).accept(this);
}
return null;
}
return super.visit(call);
}

SqlTableIdentifierFindVisitor finds table identifiers from its input plan to rewrite them to fully qualified names.
In our prototype, this SqlTableIdentifierFindVisitor class was written temporarily.
Now it has to be implemented in a right way.

@taewhi taewhi self-assigned this Mar 3, 2022
@taewhi taewhi added the bug Something isn't working label Mar 3, 2022
@taewhi taewhi linked a pull request Mar 3, 2022 that will close this issue
@taewhi taewhi removed a link to a pull request Mar 3, 2022
@taewhi taewhi linked a pull request Mar 22, 2022 that will close this issue
@taewhi taewhi closed this as completed in #8 Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant