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
Change SHOW COLUMNS query to display MySQL types in MySQL Compatibility mode #49577
Conversation
…ty mode This updates the SHOW COLUMN SQL query to display MySQL types when this query is issued by a client connected via MySQL Compatibility port
This is an automated comment for commit dbdf77c with description of existing statuses. It's updated for the latest CI running
|
…ty mode This updates the SHOW COLUMN SQL query to display MySQL types when this query is issued by a client connected via MySQL Compatibility port
…ClickHouse into mysql_compatible_types
This changes MySQL compatibility mode to display MySQL compatible types
…patibility mode" This reverts commit ddbad79.
This adjusts specific incompatible ClickHouse types to a format that can be read and interpreted by MySQL (Ex: Int128 -> text)
Refactored to a more scalable method of implementation via the IDataType interface. Added @rschu1ze as an additional reviewer after discussions with him about this change. For incompatible types (eg int64, int128) I chose to default to text for compatibility with BI tools, this may warrant further discussion though. |
Ok. Need to fix the test. Copy-paste the initialization header from similar .sh tests. |
Let's rename |
This changes the function name for MySQL Compatible types from getMySQLName to getSQLCompatibleName and changes the casing of the types to upper
… style for DataTypeNumberBase
This renames the setting for MySQL compatible types from output_format_mysql_types to use_mysql_types_in_show_columns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm (thanks) but the tests still fail in a weird way.
I did not check deeper but there can be a race on database name database_123456789abcde
when the test runs in parallel. You could use tag "no-parallel" at the top of the test file to suppress parallel execution.
|
||
echo "Drop tables if they exist" | ||
${CLICKHOUSE_LOCAL} --query "DROP TABLE IF EXISTS tab" | ||
${CLICKHOUSE_LOCAL} --query "DROP TABLE IF EXISTS database_123456789abcde" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
${CLICKHOUSE_LOCAL} --query "DROP TABLE IF EXISTS database_123456789abcde" | |
${CLICKHOUSE_LOCAL} --query "DROP DATABASE IF EXISTS database_123456789abcde" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
ClickHouse Integration Tests (asan) [6/6]:
ClickHouse Stateless Tests (debug) [2/5]
|
|
||
echo "Drop tables if they exist" | ||
${CLICKHOUSE_CLIENT} --query "DROP TABLE IF EXISTS tab" | ||
${CLICKHOUSE_CLIENT} --query "DROP DATABASE IF EXISTS database_123456789abcdef" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no-parallel
can be removed and ${CLICKHOUSE_DATABASE}
can be used to get the unique generated database for this test.
@tpanetti good job on the first merged PR! Can you modify the |
Checked as it is written in the code. |
This updates the SHOW COLUMN SQL query to display MySQL types when this query is issued by a client connected via MySQL Compatibility port
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Add a new setting named
use_mysql_types_in_show_columns
to alter theSHOW COLUMNS
SQL statement to display MySQL equivalent types when a client is connected via the MySQL compatibility port.Documentation entry for user-facing changes
Motivation: This functionality is useful for ClickHouse users as it allows tools that use standard MySQL connectors to read and parse ClickHouse data as if it were MySQL. This is particularly useful for data analytics tools such as QuickSights and Looker Studio.
Parameters: No arguments or parameters are needed, this type conversion is done when a client is connected via the MySQL port. Specifically, the implementation happens when the client is connected to whatever port the configuration has set for MySQL compatibility.
Example use:
SHOW FULL COLUMNS
I've attached an image of Amazon QuickSight parsing a ClickHouse database with example cell_towers data with this code change.
Closes #49168