Skip to content

Conversation

@xiangfu0
Copy link
Contributor

@xiangfu0 xiangfu0 commented Jul 22, 2020

Description

Adding column name rewrite for the format of [table].[column].

This is required as many external integrations like Tableau uses [table].[column] as identifier, and send them through JDBC client.

E.g.
SELECT myTable.colA FROM myTable LIMIT 10 will be rewrite to
SELECT colA FROM myTable LIMIT 10.

Release Notes

Adding column name rewrite for the format of [table].[column]

Copy link
Contributor

@Jackie-Jiang Jackie-Jiang left a comment

Choose a reason for hiding this comment

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

LGTM otherwise

@xiangfu0 xiangfu0 force-pushed the enable_table_cache_and_check_on_alias_table_column_name branch from 2c1102e to 7310a1c Compare July 23, 2020 02:21
@xiangfu0 xiangfu0 force-pushed the enable_table_cache_and_check_on_alias_table_column_name branch from 7310a1c to 1acea4b Compare July 23, 2020 09:55
if (tableNameSplits.length != 2) {
return;
}
String[] tableNameSplits = StringUtils.split(tableName, ".", 2);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the calcite parser not support getting columns names from [table].[column] format? If so, we should just use that, instead of post processing here? We have been adding small string manipulations per query incrementally, and I fear it will add up to have performance significance soon.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Calcite doesn't support parse it as [table].[column], we will get the whole as identifier.
Then we need to handle that.

Copy link
Contributor

Choose a reason for hiding this comment

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

If Calcite doesn't support, then should we support it? The logic seems brittle anyways.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should. The usage is for other system integrations like tableau

@mayankshriv mayankshriv self-requested a review July 23, 2020 14:24
@xiangfu0 xiangfu0 linked an issue Jul 23, 2020 that may be closed by this pull request
@xiangfu0
Copy link
Contributor Author

@mayankshriv Any more comments here? The extra overhead for existing queries is the string split on dot for table and column names.

@xiangfu0 xiangfu0 merged commit 9f22322 into master Jul 25, 2020
@xiangfu0 xiangfu0 deleted the enable_table_cache_and_check_on_alias_table_column_name branch July 25, 2020 18:51
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.

Disallow dot in table name and column name.

3 participants