-
Notifications
You must be signed in to change notification settings - Fork 3.2k
JDBC Client: fix Exception Handling Bug in TrinoResultSet #25725
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?
JDBC Client: fix Exception Handling Bug in TrinoResultSet #25725
Conversation
…was not triggered when a query failed due to missing partition filters.
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 reword the commit message as mentioned here https://trino.io/development/process#pull-request-and-commit-guidelines-
private static class ExtraCredentialsSystemTable | ||
implements SystemTable | ||
{ |
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.
Do we need this System table ?
|
||
@TestInstance(PER_CLASS) | ||
@Execution(CONCURRENT) | ||
public class TestJdbcPartitionFilterRequired |
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.
Is the issue is very specific to PartitionFilter for hive ? If it is a race condition then it should be seen by other connectors as well.
|
||
@TestInstance(PER_CLASS) | ||
@Execution(CONCURRENT) | ||
public class TestJdbcPartitionFilterRequired |
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.
Please follow the guideline: Test classes should be defined as package-private and final.
} | ||
|
||
@Test | ||
public void testFilterRequiredPartitions() |
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.
Please follow the guideline: Test methods should be defined as package-private.
@@ -129,7 +129,7 @@ private static List<Column> getColumns(StatementClient client, Consumer<QuerySta | |||
QueryStatusInfo results = client.currentStatusInfo(); | |||
progressCallback.accept(QueryStats.create(results.getId(), results.getStats())); | |||
List<Column> columns = results.getColumns(); | |||
if (columns != null) { | |||
if (columns != null && !results.getStats().getState().equals("FAILED")) { |
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.
Do you know how does this get empty columns? @wendigo
I think it's a bug that should fix in the place that return empty columns
ResultSet resultSet = statement.getResultSet(); | ||
assertThat(resultSet.next()).isTrue(); | ||
} | ||
}).isInstanceOf(SQLException.class); |
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.
What's the error message ?
This pull request has gone a while without any activity. Ask for help on #core-dev on Trino slack. |
Description
When using the configuration setting hive.query-partition-filter-required=true in Trino's JDBC client, a SQLException is expected to be thrown when a query is missing a required partition column. However, no error was raised in this case.
The root cause is that when a query fails due to a missing partition filter, results.getColumns() returns an empty List object (i.e., a list with a size of 0). As a result, the exception handling logic that depends on the presence of columns was not triggered as expected.
This fix ensures that when the query execution result is FAILED, the column retrieval will also fail accordingly, allowing the exception handling code to run as intended.
Change Summary