Skip to content
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

NullPointerException when an external JDBC driver returns null instead of the ResultSetMetaData instance #105

Closed
AnastasiiaSergienko opened this issue May 11, 2021 · 1 comment · Fixed by #106
Assignees
Labels
bug Unwanted / harmful behavior

Comments

@AnastasiiaSergienko
Copy link
Contributor

Problem

We don't check if the metadata of the result set is present. So the method mapResultMetadataToExasolDataTypes of the ResultSetMetadataReader throws a null pointer exception when the ResultSetMetaData is null. This happened in the Sybase dialect.

Solution

We want to validate the metadata and throw a dedicated exception if it's null.

@AnastasiiaSergienko AnastasiiaSergienko added the bug Unwanted / harmful behavior label May 11, 2021
@AnastasiiaSergienko AnastasiiaSergienko self-assigned this May 11, 2021
@AnastasiiaSergienko
Copy link
Contributor Author

Logs:

2021-05-11 14:35:58.898 FINER   [c.e.a.d.AbstractQueryRewriter] Push-down query generated with SybaseSqlGenerationVisitor:
SELECT TOP 1000 * FROM [master].[monCachePool]
2021-05-11 14:35:58.901 FINE    [c.e.a.j.ResultSetMetadataReader] Generating columns description for push-down query using BaseColumnMetadataReader:
SELECT TOP 1000 * FROM [master].[monCachePool]
2021-05-11 14:35:58.909 SEVERE  [c.e.a.RequestDispatcher] null
2021-05-11 14:35:58.910 FINE    [c.e.a.RequestDispatcher] Stack trace:
	java.lang.NullPointerException
	at com.exasol.adapter.jdbc.ResultSetMetadataReader.mapResultMetadataToExasolDataTypes(ResultSetMetadataReader.java:91)
	at com.exasol.adapter.jdbc.ResultSetMetadataReader.describeColumns(ResultSetMetadataReader.java:44)
	at com.exasol.adapter.dialects.ImportIntoQueryRewriter.createImportColumnsDescription(ImportIntoQueryRewriter.java:40)
	at com.exasol.adapter.dialects.ImportIntoQueryRewriter.generateImportStatement(ImportIntoQueryRewriter.java:31)
	at com.exasol.adapter.dialects.AbstractQueryRewriter.rewrite(AbstractQueryRewriter.java:52)
	at com.exasol.adapter.dialects.AbstractSqlDialect.rewriteQuery(AbstractSqlDialect.java:134)
	at com.exasol.adapter.jdbc.JdbcAdapter.pushdown(JdbcAdapter.java:210)
	at com.exasol.adapter.RequestDispatcher.dispatchPushDownRequestToAdapter(RequestDispatcher.java:142)
	at com.exasol.adapter.RequestDispatcher.processRequest(RequestDispatcher.java:80)
	at com.exasol.adapter.RequestDispatcher.executeAdapterCall(RequestDispatcher.java:52)
	at com.exasol.adapter.RequestDispatcher.adapterCall(RequestDispatcher.java:41)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.exasol.ExaWrapper.runSingleCall(ExaWrapper.java:100)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unwanted / harmful behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant