fixes #2091 | Fixing PG driver portal#2114
Conversation
|
May you add your python code as test in https://github.com/ArcadeData/arcadedb/tree/main/e2e-python/tests ? |
|
I started writing tests but for some reasons
|
|
pg driver is still broken even with thoses fixes, if someone has the willing to fix it, here are more tests that fails : import psycopg
db_string_test = 'TEST'
import random
with psycopg.connect(user="root", password="rootroot",
host='localhost',
port='5432',
dbname=db_string_test,
sslmode='disable'
) as connection:
connection.autocommit = True
try_count = 128
with connection.cursor(row_factory=psycopg.rows.dict_row) as cursor:
for _ in range(try_count):
params = {'select_value': random.randint(0,16)}
query = "SELECT %(select_value)s as out"
cursor.execute(query, params)
result = cursor.fetchone()
assert result["out"] == params['select_value'], f'[SQL] Expected {params["select_value"]} got {result["out"]}'
print('sql param works')
with connection.cursor(row_factory=psycopg.rows.dict_row) as cursor:
for _ in range(try_count):
params = {'select_value': random.randint(0,16)}
query = "{sqlscript}SELECT %(select_value)s as out"
cursor.execute(query, params)
result = cursor.fetchone()
assert result["out"] == params['select_value'], f'[SQLScript] Expected {params["select_value"]} got {result["out"]}'
print('sqlscript param works')
with connection.cursor(row_factory=psycopg.rows.dict_row) as cursor:
for _ in range(try_count):
params = {'select_value': random.randint(0,16)}
query = '{cypher}return $select_value as out'
cursor.execute(query, params)
ret = cursor.fetchone()
assert result["out"] == params['select_value'], f'[CYPHER] Expected {params["select_value"]} got {result["out"]}'
print('cypher param works') |
There was a problem hiding this comment.
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
postgresw/src/main/java/com/arcadedb/postgres/PostgresNetworkExecutor.java:605
- Verify that sourcePortal is not null before copying its properties to avoid a potential NullPointerException. Consider adding an explicit null-check or fallback mechanism.
PostgresPortal sourcePortal = getPortal(sourcePreparedStatement, false);
| System.out.println("ResultSet is null"); | ||
| return columns; // Return empty columns instead of throwing NPE |
There was a problem hiding this comment.
Consider replacing the System.out.println with a proper logging mechanism to maintain consistency with the rest of the codebase.
| System.out.println("ResultSet is null"); | |
| return columns; // Return empty columns instead of throwing NPE | |
| logger.warning("ResultSet is null"); |
f17ffb3 to
dac6db4
Compare
|
thanks for the help on this @robfrank, we're out of "free time" to allocate on open source at the office |
|
@ExtReMLapin this doesn't fix the issue, yet. On java side, there's a problem with parameters that I'm trying to solve. Long story short, the problem is in the chyper to gremlin translation and the way JDBC defines the params. A sort of nightmare. Anyway, thank you for the effort! |
|
Can I close this PR? |
|
@ExtReMLapin does this PR fixes your issues? fixes #2091 (Same query causing an error) @robfrank why this doesn't solve the issues for you? |
|
A the time (and right now as well) I wrote this PR my PG protocol knowledge was limited, we could at least keep the tests I guess just in case |
|
@lvca from memory this PR itself isn't the right solutions but the tests inside are right. Since @robfrank also added commits I could be wrong For example, as of today on 25.5.1 #2114 (comment) this code is still showing it's not working, did not test on this branch code, just on master with latest release |
|
@ExtReMLapin I added, in python-e2e, some tests with parametric queries too: https://github.com/ArcadeData/arcadedb/blob/main/e2e-python/tests/test_arcadedb.py ( arcadedb/e2e-python/tests/test_arcadedb.py Line 202 in 9b4c9c2 If you have a failing test, please add it to the test suite, in that way it is easier for us to execute them and analyze them. |
|
Added a test on python test suite with parametrized cypher query. Note, parameters should be written in "python/pg" syntax, e.g.: |
…5 [skip ci] Bumps [org.jacoco:jacoco-maven-plugin](https://github.com/jacoco/jacoco) from 0.8.14 to 0.8.15. Release notes *Sourced from [org.jacoco:jacoco-maven-plugin's releases](https://github.com/jacoco/jacoco/releases).* > 0.8.15 > ------ > > New Features > ------------ > > * JaCoCo now officially supports Java 26 (GitHub [#2076](https://redirect.github.com/jacoco/jacoco/issues/2076)). > * Experimental support for Java 27 class files (GitHub [#2004](https://redirect.github.com/jacoco/jacoco/issues/2004)). > * Compatibility methods generated by Kotlin compiler for functions defined in interfaces are filtered out during generation of report (GitHub [#1905](https://redirect.github.com/jacoco/jacoco/issues/1905)). > * Compatibility methods generated by Kotlin compiler for exposed boxed inline value classes (JvmExposeBoxed annotation) are filtered out during generation of report (GitHub [#1944](https://redirect.github.com/jacoco/jacoco/issues/1944)). > * Methods generated by the Kotlin compiler for functions with JvmStatic annotation are filtered out during generation of report (GitHub [#2097](https://redirect.github.com/jacoco/jacoco/issues/2097)). > * Improved filtering of bytecode generated by Kotlin compiler for when expressions and statements with kotlin.String subject where first branch condition contains string with largest hash (GitHub [#2098](https://redirect.github.com/jacoco/jacoco/issues/2098)). > * Part of bytecode that javac versions from 24 to 26 generate for switch statements and expressions with selector expression of type java.lang.String inside lambdas is filtered out during generation of report (GitHub [#2023](https://redirect.github.com/jacoco/jacoco/issues/2023)). > * Improved performance of Kotlin files analysis by parsing SMAPs only once per class (GitHub [#2114](https://redirect.github.com/jacoco/jacoco/issues/2114)). > * For better performance agent output methods tcpclient and tcpserver use BufferedOutputStream to write execution data to socket. Maven plugin, Ant tasks, CLI, API usage examples, and ExecDumpClient API use BufferedInputStream to read execution data from socket. Third-party integrations should do the same to benefit from this change in agent (GitHub [#2089](https://redirect.github.com/jacoco/jacoco/issues/2089)). > > Fixed bugs > ---------- > > * Fixed processing of Kotlin SMAP in synthetic classes (GitHub [#1985](https://redirect.github.com/jacoco/jacoco/issues/1985)). > * Multiple JaCoCo runtimes within one JVM writing to the same output file should not cause data corruption when running on JDK versions from 6 to 10 affected by [JDK-8166253](https://bugs.openjdk.org/browse/JDK-8166253) (GitHub [#2065](https://redirect.github.com/jacoco/jacoco/issues/2065), [#2074](https://redirect.github.com/jacoco/jacoco/issues/2074)). > * For better performance agent writes to output file via BufferedOutputStream, this fixes regression introduced in version 0.6.2 (GitHub [#2073](https://redirect.github.com/jacoco/jacoco/issues/2073)). > * Fixed NullPointerException when JaCoCo agent is loaded by non system class loader, for example when loaded by JBoss Modules (GitHub [#1651](https://redirect.github.com/jacoco/jacoco/issues/1651)). > > Non-functional Changes > ---------------------- > > * JaCoCo now depends on ASM 9.10.1 (GitHub [#2134](https://redirect.github.com/jacoco/jacoco/issues/2134)). Commits * [`6c5260a`](jacoco/jacoco@6c5260a) Prepare release v0.8.15 * [`5c05141`](jacoco/jacoco@5c05141) Transfer of execution data through socket should use buffered stream ([#2089](https://redirect.github.com/jacoco/jacoco/issues/2089)) * [`ab5efa9`](jacoco/jacoco@ab5efa9) Remove from Azure Pipelines all builds except with JDK 5 and JDK EA ([#2148](https://redirect.github.com/jacoco/jacoco/issues/2148)) * [`5f6ea38`](jacoco/jacoco@5f6ea38) Use Windows 2025 image in GitHub Actions ([#2130](https://redirect.github.com/jacoco/jacoco/issues/2130)) * [`35a8af2`](jacoco/jacoco@35a8af2) Use Renovate instead of Dependabot for updates of ASM ([#2137](https://redirect.github.com/jacoco/jacoco/issues/2137)) * [`85b8ddf`](jacoco/jacoco@85b8ddf) Upgrade ASM to 9.10.1 ([#2134](https://redirect.github.com/jacoco/jacoco/issues/2134)) * [`2988647`](jacoco/jacoco@2988647) AgentModule should use ClassLoader of agent instead of SystemClassLoader ([#1651](https://redirect.github.com/jacoco/jacoco/issues/1651)) * [`75a4e31`](jacoco/jacoco@75a4e31) Add filter for Kotlin `@JvmExposeBoxed` ([#1944](https://redirect.github.com/jacoco/jacoco/issues/1944)) * [`691fa1d`](jacoco/jacoco@691fa1d) Use Renovate instead of Dependabot for updates of GitHub Actions ([#2132](https://redirect.github.com/jacoco/jacoco/issues/2132)) * [`3e18f17`](jacoco/jacoco@3e18f17) Require at least JDK 21 for build ([#2128](https://redirect.github.com/jacoco/jacoco/issues/2128)) * Additional commits viewable in [compare view](jacoco/jacoco@v0.8.14...v0.8.15) [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
fixes #2091 (Same query causing an error)
fixes #2114 (comment)
fixes #2117