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 failing Netezza symbols core tests #579

Merged
merged 6 commits into from
Jun 10, 2017

Conversation

javornikolov
Copy link
Contributor

@javornikolov javornikolov commented May 27, 2017

Resolves #578

  • Parameterize CalcLength parameters in Symbols acceptance tests

  • Create CalcLength stored procedure for Netezza

  • Implement support for Neteza functions return values

  • Fix a small old typo in 001_add_objects_needed_for_acceptance_test.sql

@javornikolov
Copy link
Contributor Author

@MMatten, I hope that should solve the Netezza tests failure. Possibly we may need to also rename the input parameter (e.g. to $1) but I'm not quite sure yet.
Would you be able to test it?

@javornikolov javornikolov force-pushed the topic/fix-netezza-symbols-test branch from de3fac2 to fc6edd4 Compare May 27, 2017 08:36
@javornikolov
Copy link
Contributor Author

Possibly we may need to also rename the input parameter (e.g. to $1) but I'm not quite sure yet.

Pretty much looks like we should follow the $n naming so I just changed and force pushed it that way.

@MMatten
Copy link
Contributor

MMatten commented May 27, 2017

I'm getting a failure in CoreTests.CommonSuite.Symbols whilst executing CalcLength: -

java.sql.SQLException: Cannot find parameter ""
	at dbfit.api.DbStoredProcedure.findAccessorForParamWithName(DbStoredProcedure.java:42)
	at dbfit.api.DbStoredProcedure.getDbParameterAccessor(DbStoredProcedure.java:29)
	at dbfit.fixture.DbObjectExecutionFixture.getAccessors(DbObjectExecutionFixture.java:121)
	at dbfit.fixture.DbObjectExecutionFixture.getAccessors(DbObjectExecutionFixture.java:108)
	at dbfit.fixture.DbObjectExecutionFixture.doRows(DbObjectExecutionFixture.java:71)
	at fit.Fixture.doTable(Fixture.java:156)
	at fitlibrary.traverse.AlienTraverseHandler.doTable(AlienTraverseHandler.java:21)
	at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:104)
	at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:89)
	at fitlibrary.DoFixture.interpretWholeTable(DoFixture.java:73)
	at fitlibrary.suite.InFlowPageRunner.run(InFlowPageRunner.java:27)
	at fitlibrary.DoFixture.interpretTables(DoFixture.java:42)
	at dbfit.DatabaseTest.interpretTables(DatabaseTest.java:26)
	at fit.Fixture.doTables(Fixture.java:81)
	at fit.FitServer.process(FitServer.java:81)
	at fit.FitServer.run(FitServer.java:56)
	at fit.FitServer.main(FitServer.java:41)

@MMatten
Copy link
Contributor

MMatten commented May 27, 2017

Note that in the _v_procedure system view this another column called RETURNS. It specifies the data type of the RETURNS clause for a procedure.

Perhaps we can use this to return the OUT param via the SQL query.

@javornikolov
Copy link
Contributor Author

Indeed - Netezza dbfit environment doesn't support return values yet. Perhaps RETURNS column is what we need to form the return value descriptor.

@MMatten
Copy link
Contributor

MMatten commented May 28, 2017

@javornikolov let me know if you need me to run any SQL queries, tests, etc, etc.

@javornikolov
Copy link
Contributor Author

@MMatten, I just pushed an attempt to add Netezza function return value support. May we test with it please. (It might worth adding some specific acceptance test for that but for a start we may use the Symbols tests).

@javornikolov javornikolov force-pushed the topic/fix-netezza-symbols-test branch from 606ec11 to 74b24ce Compare May 28, 2017 12:14
@MMatten
Copy link
Contributor

MMatten commented May 28, 2017

I got a build error: -

:dbfit-java:netezza:compileJava
/var/dbfit/dbfit-java/netezza/src/main/java/dbfit/environment/NetezzaEnvironment.java:258: error: variable paramName might not have been initialized
            allParams.put(NameNormaliser.normaliseName(paramName), dbp);
                                                       ^
1 error
:dbfit-java:netezza:compileJava FAILED

FAILURE: Build failed with an exception.

@javornikolov
Copy link
Contributor Author

Yes, sorry, I saw that too. I just force-pushed a version which should compile OK.

@MMatten
Copy link
Contributor

MMatten commented May 28, 2017

In FlowMode.CallProcedures for the Inspect Procedure of sp_procedure I get the error: -

org.netezza.error.NzSQLException: Column Index out of range: 2
	at org.netezza.sql.NzResultSet.getPgString(NzResultSet.java:2806)
	at org.netezza.sql.NzResultSet.getString(NzResultSet.java:1378)
	at dbfit.environment.NetezzaEnvironment.getAllProcedureParameters(NetezzaEnvironment.java:220)
	at dbfit.fixture.Inspect.inspectProcedure(Inspect.java:70)
	at dbfit.fixture.Inspect.doTable(Inspect.java:44)
	at fitlibrary.traverse.AlienTraverseHandler.doTable(AlienTraverseHandler.java:21)
	at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:104)
	at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:89)
	at fitlibrary.DoFixture.interpretWholeTable(DoFixture.java:73)
	at fitlibrary.suite.InFlowPageRunner.run(InFlowPageRunner.java:27)
	at fitlibrary.DoFixture.interpretTables(DoFixture.java:42)
	at dbfit.DatabaseTest.interpretTables(DatabaseTest.java:26)
	at fit.Fixture.doTables(Fixture.java:81)
	at fit.FitServer.process(FitServer.java:81)
	at fit.FitServer.run(FitServer.java:56)
	at fit.FitServer.main(FitServer.java:41)

@MMatten
Copy link
Contributor

MMatten commented May 28, 2017

Executing CalcLength I get: -

org.netezza.error.NzSQLException: Column Index out of range: 2
	at org.netezza.sql.NzResultSet.getPgString(NzResultSet.java:2806)
	at org.netezza.sql.NzResultSet.getString(NzResultSet.java:1378)
	at dbfit.environment.NetezzaEnvironment.getAllProcedureParameters(NetezzaEnvironment.java:220)
	at dbfit.api.DbStoredProcedure.getAllParams(DbStoredProcedure.java:49)
	at dbfit.api.DbStoredProcedure.findAccessorForParamWithName(DbStoredProcedure.java:40)
	at dbfit.api.DbStoredProcedure.getDbParameterAccessor(DbStoredProcedure.java:29)
	at dbfit.fixture.DbObjectExecutionFixture.getAccessors(DbObjectExecutionFixture.java:121)
	at dbfit.fixture.DbObjectExecutionFixture.getAccessors(DbObjectExecutionFixture.java:108)
	at dbfit.fixture.DbObjectExecutionFixture.doRows(DbObjectExecutionFixture.java:71)
	at fit.Fixture.doTable(Fixture.java:156)
	at fitlibrary.traverse.AlienTraverseHandler.doTable(AlienTraverseHandler.java:21)
	at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:104)
	at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:89)
	at fitlibrary.DoFixture.interpretWholeTable(DoFixture.java:73)
	at fitlibrary.suite.InFlowPageRunner.run(InFlowPageRunner.java:27)
	at fitlibrary.DoFixture.interpretTables(DoFixture.java:42)
	at dbfit.DatabaseTest.interpretTables(DatabaseTest.java:26)
	at fit.Fixture.doTables(Fixture.java:81)
	at fit.FitServer.process(FitServer.java:81)
	at fit.FitServer.run(FitServer.java:56)
	at fit.FitServer.main(FitServer.java:41)

@javornikolov javornikolov force-pushed the topic/fix-netezza-symbols-test branch from 74b24ce to 737dd75 Compare May 28, 2017 13:35
@javornikolov
Copy link
Contributor Author

That was because I forgot to add retuns column to the SQL query... Fixed now.

@MMatten
Copy link
Contributor

MMatten commented May 28, 2017

FlowMode.CallProcedures is now passing.

CoreTests.CommonSuite.Symbols now fails with: -

org.netezza.sql.NzCallableStatement$OutParameterNorRegisteredException: out parameter not registered
	at org.netezza.sql.NzCallableStatement.getObject(NzCallableStatement.java:684)
	at dbfit.fixture.StatementExecution.getObject(StatementExecution.java:31)
	at dbfit.util.DbParameterAccessor.get(DbParameterAccessor.java:118)
	at dbfit.util.DbParameterAccessorTypeAdapter.get(DbParameterAccessorTypeAdapter.java:18)
	at dbfit.util.SymbolAccessQueryBinding.doCell(SymbolAccessQueryBinding.java:15)
	at dbfit.fixture.DbObjectExecutionFixture.executeStatementAndEvaluateOutputs(DbObjectExecutionFixture.java:188)
	at dbfit.fixture.DbObjectExecutionFixture.runRow(DbObjectExecutionFixture.java:155)
	at dbfit.fixture.DbObjectExecutionFixture.doRows(DbObjectExecutionFixture.java:79)
	at fit.Fixture.doTable(Fixture.java:156)
	at fitlibrary.traverse.AlienTraverseHandler.doTable(AlienTraverseHandler.java:21)
	at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:104)
	at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:89)
	at fitlibrary.DoFixture.interpretWholeTable(DoFixture.java:73)
	at fitlibrary.suite.InFlowPageRunner.run(InFlowPageRunner.java:27)
	at fitlibrary.DoFixture.interpretTables(DoFixture.java:42)
	at dbfit.DatabaseTest.interpretTables(DatabaseTest.java:26)
	at fit.Fixture.doTables(Fixture.java:81)
	at fit.FitServer.process(FitServer.java:81)
	at fit.FitServer.run(FitServer.java:56)
	at fit.FitServer.main(FitServer.java:41)

@javornikolov
Copy link
Contributor Author

Hmm... I just added in FlowMode.CallProcedures another test for sp_procedure return value and Inspect Procedure and direct calls to CalcLength.

@javornikolov
Copy link
Contributor Author

javornikolov commented May 28, 2017

@MMatten
Copy link
Contributor

MMatten commented May 28, 2017

Gee, looks like we're already in debt with that (#11): https://www.ibm.com/developerworks/community/forums/html/threadTopic?id=6ab238ce-f4d2-48f9-ae4e-f9e648fff9fe

No, no out params in stored procs and no function return values?

May be the what we created for Informix would suit this.

Let me test your updates now.

@javornikolov
Copy link
Contributor Author

I decompiled the JDBC driver to see what's going on inside. Looks like it has some support for return values but not through getObject but using getInt, getString, etc... (Internally these are implemented via getResultSet). Besides getBigDecimal looks a bit buggy at first glimpse.

I'm just working on a getObject override to see if we can trick it in that way. I'll push it in a few minutes. Later we may try the getResultSet approach too.

@javornikolov
Copy link
Contributor Author

@MMatten, I just pushed the patched Netezza environment.

@MMatten
Copy link
Contributor

MMatten commented May 28, 2017

CallProcedures fails with: -

image

Everything else seems to be passing.

@javornikolov
Copy link
Contributor Author

Everything else seems to be passing.

Great :-)
I fixed the other part too (I didn't pay attention that the function call had side effect in populating a table).

@javornikolov
Copy link
Contributor Author

At first glimpse the Informix approach for function calls should work here out of the box. I'll change that shortly to see if we can get rid of my getObject overrides.

@javornikolov
Copy link
Contributor Author

At first glimpse the Informix approach for function calls should work here out of the box. I'll change that shortly to see if we can get rid of my getObject overrides.

Done - pushed with 4bee54e.

@MMatten
Copy link
Contributor

MMatten commented May 28, 2017

In CallProcedures where we're testing procs and looking for the output I'm getting: -

org.netezza.error.NzSQLException: Value can be set for IN/INOUT parameter type only
	at org.netezza.sql.NzCallableStatement.setObject(NzCallableStatement.java:2031)
	at dbfit.fixture.StatementExecution.setObject(StatementExecution.java:26)
	at dbfit.fixture.StatementExecutionCapturingResultSetValue.setObject(StatementExecutionCapturingResultSetValue.java:32)
	at dbfit.util.DbParameterAccessor.set(DbParameterAccessor.java:110)
	at dbfit.util.DbParameterAccessorTypeAdapter.set(DbParameterAccessorTypeAdapter.java:22)
	at fit.Binding$SetBinding.doCell(Binding.java:217)
	at dbfit.util.SymbolAccessSetBinding.doCell(SymbolAccessSetBinding.java:22)
	at dbfit.fixture.DbObjectExecutionFixture.runRow(DbObjectExecutionFixture.java:151)
	at dbfit.fixture.DbObjectExecutionFixture.doRows(DbObjectExecutionFixture.java:79)
	at fit.Fixture.doTable(Fixture.java:156)
	at fitlibrary.traverse.AlienTraverseHandler.doTable(AlienTraverseHandler.java:21)
	at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:104)
	at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:89)
	at fitlibrary.DoFixture.interpretWholeTable(DoFixture.java:73)
	at fitlibrary.suite.InFlowPageRunner.run(InFlowPageRunner.java:27)
	at fitlibrary.DoFixture.interpretTables(DoFixture.java:42)
	at dbfit.DatabaseTest.interpretTables(DatabaseTest.java:26)
	at fit.Fixture.doTables(Fixture.java:81)
	at fit.FitServer.process(FitServer.java:81)
	at fit.FitServer.run(FitServer.java:56)
	at fit.FitServer.main(FitServer.java:41)

@MMatten
Copy link
Contributor

MMatten commented May 28, 2017

image
I'm still seeing this.

@javornikolov
Copy link
Contributor Author

I'm still seeing this.

My bad. I moved more calls than needed. should be OK now.

org.netezza.error.NzSQLException: Value can be set for IN/INOUT parameter type only

Perhaps we sholdn't adjust the parameter index as we do for Informix. I changed that. Let's see if that helps.

@MMatten
Copy link
Contributor

MMatten commented May 28, 2017

Awesome. A clean bill of health again. No test failures.

@javornikolov
Copy link
Contributor Author

Nice :-) I need to tidy up some bits here but looks like that we finally managed to get Netezza functions working.

@MMatten
Copy link
Contributor

MMatten commented May 29, 2017

Great work!

Interestingly there are also functions in Netezza in addition to stored procs that return values. I think they have to be built in C++ and compiled into the DB. One for another day!

* Parameterize CalcLength parameters in Symbols acceptance tests in
  order to be able to configure it in an Netezza-compatible way.

* Create CalcLength stored procedure for Netezza
Netezza JDBC driver doesn't support CallableStatement.getObject. We
handle that limitation by retrieving return value through the
statement's ResultSet.
Split getAllProcedureParameters into several routines using the same
approach (and copy of some code) as in Postgres environment
@javornikolov javornikolov force-pushed the topic/fix-netezza-symbols-test branch from c4609c7 to 76aa8b9 Compare May 29, 2017 21:39
@javornikolov
Copy link
Contributor Author

@MMatten, I did some refactoring. Can we test it again?
And if it looks good enough to you - I think we can merge it (maybe slicing the last commit with the refactoring into a separate PR).

@MMatten
Copy link
Contributor

MMatten commented Jun 3, 2017

We're still missing the CalcLength stored routine for SQL Server.

But I'll test all the others (I just have Teradata to do).

@MMatten
Copy link
Contributor

MMatten commented Jun 3, 2017

I'm now seeing Netezza failures in FlowMode.CallProcedures: -

image

@javornikolov javornikolov added this to the Next milestone Jun 6, 2017
@javornikolov
Copy link
Contributor Author

@MMatten, could you test that again. I hope we have that error fixed now.

@MMatten
Copy link
Contributor

MMatten commented Jun 10, 2017

All tests are passing now.

@javornikolov
Copy link
Contributor Author

Wonderful :-) Thanks for verifying, @MMatten! I guess we're ready to merge that PR?

@MMatten
Copy link
Contributor

MMatten commented Jun 10, 2017

Yes. I think so. I've nothing else to add.

@javornikolov javornikolov merged commit fe7e983 into master Jun 10, 2017
@javornikolov javornikolov deleted the topic/fix-netezza-symbols-test branch June 10, 2017 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants