Skip to content

[Java] [JDBC] [Exceptions] Mapping Runtime Exceptions to SQL Exceptions#24

Open
escobargabriel wants to merge 27 commits intoflight-jdbc-driverfrom
exceptions-mapping
Open

[Java] [JDBC] [Exceptions] Mapping Runtime Exceptions to SQL Exceptions#24
escobargabriel wants to merge 27 commits intoflight-jdbc-driverfrom
exceptions-mapping

Conversation

@escobargabriel
Copy link
Copy Markdown
Collaborator

Mapping the runtime exceptions to throw SQL exceptions with appropriate error code.


private void assertMapStates(CallStatus timedOut, String code) {
FlightRuntimeException flightRuntimeException =
timedOut.withDescription("Failure in connection: %s").toRuntimeException();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Remove withDescription as it's not relevant to the test

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done.

private void assertMapStates(CallStatus timedOut, String code) {
FlightRuntimeException flightRuntimeException =
timedOut.withDescription("Failure in connection: %s").toRuntimeException();
SQLException map =
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Rename variable please

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done.

*/
public class FlightToJDBCExceptionMapper {

private static final String UNAUTHENTICATED = "28000";
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Lets prefix these contants to avoid ambiguation with FlightStatusCode members

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Can we remove the trailing : on all exceptions please?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Suggested change
throw FlightToJDBCExceptionMapper.map(e, "Failed to access the resource: ");
throw FlightToJDBCExceptionMapper.map(e, "Failed retrieve next row on ResultSet");

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Suggested change
throw FlightToJDBCExceptionMapper.map(e, "Failed to access catalogs: ");
throw FlightToJDBCExceptionMapper.map(e, "Failed to get catalogs");

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@vfraga vfraga force-pushed the flight-jdbc-driver branch from 532d91f to 59148df Compare March 29, 2022 13:16
Abner Eduardo Ferreira and others added 25 commits March 29, 2022 10:35
* Remove scope from 'hamcrest' dependency on java/pom.xml

* Use flight top-level module on parent pom.xml instead of declaring each one

* Avoid using getStatement inside StatementContext methods

* Make StatementContext.getQuery() return String

* Minor fixes on pom.xml

* Move 'os-maven-plugin' to parent pom.xml

* Update protobuf generation on pom.xml files

* Use ClassLoader#getResource to get network.properties on TestFlightSql

* Bind to any ephemeral port on TestFlightSql

* Move JDBC-Arrow type default conversion from JdbcToArrowConfig to JdbcToArrowUtils

* Micro-optimization: initialize ArrayList with the right size

* Fix null-check on PreparedStatement#setParameters

* Avoid wrapping vector into a ImmutableList and then into an ArrayList on FlightSqlExample#getTablesRoot

* Remove null-check on VectorSchemaRoot on FlightSqlClient#setParameters()

* Remove the need of separate cache for ResultSets

* Add missing 'final' modifiers
…les and query execution methods. (apache#226)

This add an auxiliary class FlightSqlColumnMetadata meant to read and write known metadata for Arrow schema fields, such as CATALOG_NAME, SCHEMA_NAME, TABLE_NAME, PRECISION, SCALE, IS_AUTO_INCREMENT, IS_CASE_SENSITIVE, IS_READ_ONLY and IS_SEARCHABLE.
@vfraga vfraga force-pushed the exceptions-mapping branch from e5e852f to 3a38fb8 Compare March 29, 2022 13: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.

5 participants