-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Enable using column identifiers with special characters when deleting table column statistics. #6149
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
base: master
Are you sure you want to change the base?
Conversation
… table column statistics.
|
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.
Changes LTGM, just optional nits.
|
|
||
| public void lockDbTable(String tableName) throws MetaException { | ||
| if (!ALLOWED_TABLES_TO_LOCK.contains(tableName)) { | ||
| throw new MetaException("Error while locking table " + tableName); |
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.
Let's add a test case for the exception if its easy/possible.
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.
I want a Java comment because I can't deserialize the intention about why we should throw an exception.
|
|
||
| try (QueryWrapper queryParams = new QueryWrapper(pm.newQuery("javax.jdo.query.SQL", deleteSql))) { | ||
| executeWithArray(queryParams.getInnerQuery(), params.toArray(), deleteSql); | ||
| } catch (MetaException e) { |
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.
Catching a MetaException and rethrowing it as a MetaException seems redundant and will make the stacktrace harder to follow. Since the method already throws MetaException can we simply remove the catch block.
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.
Looks good to me! Thank you
| if (engine != null) { | ||
| deleteSql += " and \"ENGINE\" = '" + engine + "'"; | ||
| deleteSql += " and \"ENGINE\" = ?"; | ||
| params.add(engine); |
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.
Can we add a test case to add a harmful value?
| List<Long> partitionIds = getPartitionIdsViaSqlFilter(catName, dbName, tblName, sqlFilter, | ||
| input, Collections.emptyList(), -1); | ||
| if (!partitionIds.isEmpty()) { | ||
| String deleteSql = "delete from " + PART_COL_STATS + " where \"PART_ID\" in ( " + getIdListForIn(partitionIds) + ")"; |
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.
This is just a pure question: I don't request any change in this pull request. Can we potentially replace getIdListForIn with a placeholder in this class at some point? In my opinion, it is better to avoid string concatenation thoroughly. Otherwise, new issues might easily pass code reviews.
|
|
||
| public void lockDbTable(String tableName) throws MetaException { | ||
| if (!ALLOWED_TABLES_TO_LOCK.contains(tableName)) { | ||
| throw new MetaException("Error while locking table " + tableName); |
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.
I want a Java comment because I can't deserialize the intention about why we should throw an exception.



What changes were proposed in this pull request?
Why are the changes needed?
Does this PR introduce any user-facing change?
How was this patch tested?