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

Fix getDatabaseMajorVersion & getDatabaseMinorVersion #228

Merged
merged 4 commits into from
Jul 10, 2024

Conversation

rad-pat
Copy link
Contributor

@rad-pat rad-pat commented Jul 7, 2024

Just match RegEx in Full string "Databend Query vx.y.zzz" or "DatabendQuery vx.y.zzz"
Fixes #204

@hantmac
Copy link
Member

hantmac commented Jul 8, 2024

@rad-pat Thanks for your contribution. How about adding some unit tests for the modified function?

@rad-pat
Copy link
Contributor Author

rad-pat commented Jul 8, 2024

@hantmac, I can try. It looked like it was partially covered by a test already, but now I can see why that was incorrectly passing (because it always matched the "-1" version to string "rust-1"). I've made the test more specific for the version. Hope it works, I cannot get the tests to run locally for some reason.

@rad-pat
Copy link
Contributor Author

rad-pat commented Jul 9, 2024

Should be fixed now. It'd really help if I could run the tests, but the MetaData tests fail with this for me. I'm running against a locally installed Databend instance with user root and no password, on port 8100. I have to adjust the user/pwd/port in tests, but all other seem to work. If you have any ideas, I'd appreciate it.

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.databend.jdbc.TestDatabendDatabaseMetaData
Tests run: 16, Failures: 1, Errors: 0, Skipped: 15, Time elapsed: 2.057 sec <<< FAILURE! - in com.databend.jdbc.TestDatabendDatabaseMetaData
setUp(com.databend.jdbc.TestDatabendDatabaseMetaData)  Time elapsed: 1.848 sec  <<< FAILURE!
java.lang.RuntimeException: Query failed: Optional[{"error":{"code":"401","message":"No authorization header detected"}}]
	at com.databend.client.DatabendClientV1.executeInternal(DatabendClientV1.java:185)
	at com.databend.client.DatabendClientV1.execute(DatabendClientV1.java:206)
	at com.databend.client.DatabendClientV1.<init>(DatabendClientV1.java:91)
	at com.databend.jdbc.DatabendConnection.startQuery(DatabendConnection.java:588)
	at com.databend.jdbc.DatabendConnection.setSchema(DatabendConnection.java:473)
	at com.databend.jdbc.DatabendConnection.<init>(DatabendConnection.java:82)
	at com.databend.jdbc.NonRegisteringDatabendDriver.connect(NonRegisteringDatabendDriver.java:64)
	at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681)
	at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229)
	at com.databend.jdbc.TestDatabendDatabaseMetaData.createConnection(TestDatabendDatabaseMetaData.java:80)
	at com.databend.jdbc.TestDatabendDatabaseMetaData.setUp(TestDatabendDatabaseMetaData.java:63)

@hantmac
Copy link
Member

hantmac commented Jul 9, 2024

Should be fixed now. It'd really help if I could run the tests, but the MetaData tests fail with this for me. I'm running against a locally installed Databend instance with user root and no password, on port 8100. I have to adjust the user/pwd/port in tests, but all other seem to work. If you have any ideas, I'd appreciate it.

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.databend.jdbc.TestDatabendDatabaseMetaData
Tests run: 16, Failures: 1, Errors: 0, Skipped: 15, Time elapsed: 2.057 sec <<< FAILURE! - in com.databend.jdbc.TestDatabendDatabaseMetaData
setUp(com.databend.jdbc.TestDatabendDatabaseMetaData)  Time elapsed: 1.848 sec  <<< FAILURE!
java.lang.RuntimeException: Query failed: Optional[{"error":{"code":"401","message":"No authorization header detected"}}]
	at com.databend.client.DatabendClientV1.executeInternal(DatabendClientV1.java:185)
	at com.databend.client.DatabendClientV1.execute(DatabendClientV1.java:206)
	at com.databend.client.DatabendClientV1.<init>(DatabendClientV1.java:91)
	at com.databend.jdbc.DatabendConnection.startQuery(DatabendConnection.java:588)
	at com.databend.jdbc.DatabendConnection.setSchema(DatabendConnection.java:473)
	at com.databend.jdbc.DatabendConnection.<init>(DatabendConnection.java:82)
	at com.databend.jdbc.NonRegisteringDatabendDriver.connect(NonRegisteringDatabendDriver.java:64)
	at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681)
	at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229)
	at com.databend.jdbc.TestDatabendDatabaseMetaData.createConnection(TestDatabendDatabaseMetaData.java:80)
	at com.databend.jdbc.TestDatabendDatabaseMetaData.setUp(TestDatabendDatabaseMetaData.java:63)

@rad-pat Hi I add you to the github action CI, the CI will run auto when you push.

@rad-pat rad-pat force-pushed the fix-version branch 3 times, most recently from a85c7dc to f5f2d90 Compare July 9, 2024 12:37
@rad-pat
Copy link
Contributor Author

rad-pat commented Jul 9, 2024

@hantmac , thanks for that. It seems though that the test setup is a little flaky. I think that if this now ran, it would be successful.

Copy link
Member

@hantmac hantmac left a comment

Choose a reason for hiding this comment

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

/LGTM

@hantmac hantmac merged commit 9594751 into databendlabs:main Jul 10, 2024
1 check passed
@hantmac hantmac mentioned this pull request Jul 10, 2024
@rad-pat rad-pat deleted the fix-version branch July 10, 2024 08:20
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.

getDatabaseMajorVersion can not get the databend version
2 participants