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

support clickhouse as mysql federated server #7717

Merged

Conversation

MaxFedotov
Copy link
Contributor

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

Changelog category (leave one):

  • Improvement

Changelog entry (up to few sentences, not needed for non-significant PRs):
Support adding Clickhouse as MySQL federated server (see https://dev.mysql.com/doc/refman/5.7/en/federated-create-server.html)

@alexey-milovidov
Copy link
Member

That's very interesting feature!

@yurriy will help with review.

Copy link
Contributor

@yurriy yurriy left a comment

Choose a reason for hiding this comment

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

Nice feature. Thanks. Could you please add a test?
Tests of MySQL protocol are here. MySQL server will be started in mysql_client docker container if this line is removed. dbms/tests/integration/README.md.

dbms/programs/server/MySQLHandler.cpp Outdated Show resolved Hide resolved
dbms/programs/server/MySQLHandler.cpp Outdated Show resolved Hide resolved
@MaxFedotov
Copy link
Contributor Author

Hi, @yurriy. Sorry, was on vacation and only now was able to get back to this commit. I've fixed all issues, that you highlighted and added tests.

Thanks,
Max

Copy link
Contributor

@yurriy yurriy left a comment

Choose a reason for hiding this comment

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

Note that there were few style check errors, they are listed in "Details" link below.

dbms/programs/server/MySQLHandler.cpp Outdated Show resolved Hide resolved
dbms/programs/server/MySQLHandler.cpp Outdated Show resolved Hide resolved
dbms/programs/server/MySQLHandler.cpp Outdated Show resolved Hide resolved
dbms/programs/server/MySQLHandler.cpp Outdated Show resolved Hide resolved
dbms/programs/server/MySQLHandler.cpp Outdated Show resolved Hide resolved
dbms/programs/server/MySQLHandler.cpp Outdated Show resolved Hide resolved
dbms/programs/server/MySQLHandler.cpp Outdated Show resolved Hide resolved
@MaxFedotov
Copy link
Contributor Author

Hi @yurriy, sorry for stupid mistakes - hadn't written on C++ since university :) I've applied all code review notes, can you please take a look?

Thank,
Max

Copy link
Contributor

@yurriy yurriy left a comment

Choose a reason for hiding this comment

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

Hi @yurriy, sorry for stupid mistakes - hadn't written on C++ since university :) I've applied all code review notes, can you please take a look?

Thank,
Max

No worries, you're welcome.

dbms/programs/server/MySQLHandler.h Outdated Show resolved Hide resolved
dbms/programs/server/MySQLHandler.cpp Outdated Show resolved Hide resolved
dbms/programs/server/MySQLHandler.h Outdated Show resolved Hide resolved
if (0 == strncasecmp("SHOW TABLE STATUS LIKE", query.c_str(), 22))
{
should_replace = true;
replacement_query = boost::replace_all_copy(query, "SHOW TABLE STATUS LIKE ", show_table_status_replacement_query);
Copy link
Member

Choose a reason for hiding this comment

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

Here is LIKE. But in replacement query it is just a string equality.

Copy link
Member

Choose a reason for hiding this comment

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

Fixed.

@alexey-milovidov alexey-milovidov merged commit 43c47bd into ClickHouse:master Dec 2, 2019
@nikitamikhaylov nikitamikhaylov added the pr-improvement Pull request with some product improvements label Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-improvement Pull request with some product improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants