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

[Java] JDBC driver throws error based on SqlInfo values #40249

Closed
lidavidm opened this issue Feb 26, 2024 · 3 comments
Closed

[Java] JDBC driver throws error based on SqlInfo values #40249

lidavidm opened this issue Feb 26, 2024 · 3 comments

Comments

@lidavidm
Copy link
Member

Describe the bug, including details regarding any error messages, version, and platform.

java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because "sqlInfoList" is null
	at org.apache.arrow.driver.jdbc.ArrowDatabaseMetadata.convertListSqlInfoToString(ArrowDatabaseMetadata.java:757)
	at org.apache.arrow.driver.jdbc.ArrowDatabaseMetadata.getSQLKeywords(ArrowDatabaseMetadata.java:199)
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCDatabaseMetaDataImpl.getSQLKeywords(JDBCDatabaseMetaDataImpl.java:452)
	at org.jkiss.dbeaver.model.impl.jdbc.JDBCSQLDialect.loadDriverKeywords(JDBCSQLDialect.java:384)
	at org.jkiss.dbeaver.model.impl.jdbc.JDBCSQLDialect.initDriverSettings(JDBCSQLDialect.java:223)
	at org.jkiss.dbeaver.ext.generic.model.GenericSQLDialect.initDriverSettings(GenericSQLDialect.java:72)
	at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.initialize(JDBCDataSource.java:484)
	at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.initialize(GenericDataSource.java:468)
	at org.jkiss.dbeaver.registry.DataSourceDescriptor.openDataSource(DataSourceDescriptor.java:1322)
	at org.jkiss.dbeaver.registry.DataSourceDescriptor.connect0(DataSourceDescriptor.java:1163)
	at org.jkiss.dbeaver.registry.DataSourceDescriptor.connect(DataSourceDescriptor.java:960)
	at org.jkiss.dbeaver.runtime.jobs.ConnectJob.run(ConnectJob.java:77)
	at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:105)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

This was with DBeaver. I'm guessing that this SqlInfo value isn't provided and the driver isn't checking for null before manipulating the value

Component(s)

FlightRPC, Java

@normanj-bitquill
Copy link
Contributor

@lidavidm Which database server was this tested against?

normanj-bitquill added a commit to Bit-Quill/arrow that referenced this issue Apr 3, 2024
When retrieving database metadata using the JDBC driver, some data such as SQL keywords
could be null. Before this change, an NPE would be thrown when trying to convert the
list of SQL keywords into a String.

The following database metadata fields:

* SQL keywords
* Numeric functions
* String functions
* System functions
* Time/date functions

will convert to an empty string when they are null.

A unit test has been added to verify that the fields above are converted to the empty
string when null, with no exceptions thrown.

The fields above will now return an empty string rather than throw an NPE.
normanj-bitquill added a commit to Bit-Quill/arrow that referenced this issue Apr 3, 2024
### Rationale for this change

When retrieving database metadata using the JDBC driver, some data such as SQL keywords
could be null. Before this change, an NPE would be thrown when trying to convert the
list of SQL keywords into a String.

### What changes are included in this PR?

The following database metadata fields:

* SQL keywords
* Numeric functions
* String functions
* System functions
* Time/date functions

will convert to an empty string when they are null.

### Are these changes tested?

A unit test has been added to verify that the fields above are converted to the empty
string when null, with no exceptions thrown.

### Are there any user-facing changes?

The fields above will now return an empty string rather than throw an NPE.
@lidavidm
Copy link
Member Author

lidavidm commented Apr 3, 2024

Ah, sorry - this was something proprietary I was giving a shot so I don't think there's a public download I can point to.

normanj-bitquill added a commit to Bit-Quill/arrow that referenced this issue Apr 5, 2024
### Rationale for this change

When retrieving database metadata using the JDBC driver, some data such as SQL keywords
could be null. Before this change, an NPE would be thrown when trying to convert the
list of SQL keywords into a String.

### What changes are included in this PR?

The following database metadata fields:

* SQL keywords
* Numeric functions
* String functions
* System functions
* Time/date functions

will convert to an empty string when they are null.

### Are these changes tested?

A unit test has been added to verify that the fields above are converted to the empty
string when null, with no exceptions thrown.

### Are there any user-facing changes?

The fields above will now return an empty string rather than throw an NPE.
lidavidm pushed a commit that referenced this issue Apr 7, 2024
### Rationale for this change

When retrieving database metadata using the JDBC driver, some data such as SQL keywords could be null. Before this change, an NPE would be thrown when trying to convert the list of SQL keywords into a String.

### What changes are included in this PR?

The following database metadata fields:

* SQL keywords
* Numeric functions
* String functions
* System functions
* Time/date functions

will convert to an empty string when they are null.

### Are these changes tested?

A unit test has been added to verify that the fields above are converted to the empty string when null, with no exceptions thrown.

### Are there any user-facing changes?

The fields above will now return an empty string rather than throw an NPE.
* GitHub Issue: #40249

Authored-by: Norman Jordan <norman.jordan@improving.com>
Signed-off-by: David Li <li.davidm96@gmail.com>
@lidavidm lidavidm added this to the 16.0.0 milestone Apr 7, 2024
@lidavidm
Copy link
Member Author

lidavidm commented Apr 7, 2024

Issue resolved by pull request 40988
#40988

@lidavidm lidavidm closed this as completed Apr 7, 2024
verma-kartik pushed a commit to verma-kartik/arrow that referenced this issue Apr 11, 2024
### Rationale for this change

When retrieving database metadata using the JDBC driver, some data such as SQL keywords could be null. Before this change, an NPE would be thrown when trying to convert the list of SQL keywords into a String.

### What changes are included in this PR?

The following database metadata fields:

* SQL keywords
* Numeric functions
* String functions
* System functions
* Time/date functions

will convert to an empty string when they are null.

### Are these changes tested?

A unit test has been added to verify that the fields above are converted to the empty string when null, with no exceptions thrown.

### Are there any user-facing changes?

The fields above will now return an empty string rather than throw an NPE.
* GitHub Issue: apache#40249

Authored-by: Norman Jordan <norman.jordan@improving.com>
Signed-off-by: David Li <li.davidm96@gmail.com>
tolleybot pushed a commit to tmct/arrow that referenced this issue May 2, 2024
### Rationale for this change

When retrieving database metadata using the JDBC driver, some data such as SQL keywords could be null. Before this change, an NPE would be thrown when trying to convert the list of SQL keywords into a String.

### What changes are included in this PR?

The following database metadata fields:

* SQL keywords
* Numeric functions
* String functions
* System functions
* Time/date functions

will convert to an empty string when they are null.

### Are these changes tested?

A unit test has been added to verify that the fields above are converted to the empty string when null, with no exceptions thrown.

### Are there any user-facing changes?

The fields above will now return an empty string rather than throw an NPE.
* GitHub Issue: apache#40249

Authored-by: Norman Jordan <norman.jordan@improving.com>
Signed-off-by: David Li <li.davidm96@gmail.com>
vibhatha pushed a commit to vibhatha/arrow that referenced this issue May 25, 2024
### Rationale for this change

When retrieving database metadata using the JDBC driver, some data such as SQL keywords could be null. Before this change, an NPE would be thrown when trying to convert the list of SQL keywords into a String.

### What changes are included in this PR?

The following database metadata fields:

* SQL keywords
* Numeric functions
* String functions
* System functions
* Time/date functions

will convert to an empty string when they are null.

### Are these changes tested?

A unit test has been added to verify that the fields above are converted to the empty string when null, with no exceptions thrown.

### Are there any user-facing changes?

The fields above will now return an empty string rather than throw an NPE.
* GitHub Issue: apache#40249

Authored-by: Norman Jordan <norman.jordan@improving.com>
Signed-off-by: David Li <li.davidm96@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants