Adalennis opened a new issue, #9314:
URL: https://github.com/apache/hop/issues/9314
### Apache Hop version?
2.20.0
### Java version?
Java 21
### Operating system
macOS
### What happened?
Reproduced on 2.20.0; the code involved is unchanged on main. Probes used
the 2.20.0 classes with H2 2.5.252 and SQLite 3.53.
**1. Generate DDL loses the schema and the quoting**
`DatabaseWorkbench.generateDdl` reads the fields with the quoted
`SALES."Order Items"`, but passes only `node.getObjectName()` to
`Database.getCreateTableStatement`, which appends the name as is. For schema
`SALES` and table `"Order Items"` with a column `"Item Name"`:
CREATE TABLE Order Items
(
ID INT
, Item Name VARCHAR(20)
)
;
Running it fails with `Syntax error … expected "identifier"`. The schema is
gone and neither the table nor the column name is quoted.
**2. Stop does not interrupt DDL or DML**
`Database.execStatement` runs the statement on a local
`Statement`/`PreparedStatement`, and `cancelQuery()` only cancels `pstmt` and
`selStmt`. With `DatabaseOperation.cancel()` called 300 ms after the start:
| Statement | After cancel |
|---|---|
| `SELECT MAX(A.X + B.X) FROM SYSTEM_RANGE(1, 30000) A, SYSTEM_RANGE(1,
30000) B` | stopped 1 ms later ("Statement was canceled") |
| `CREATE TABLE BIG AS SELECT X, X*2 AS Y FROM SYSTEM_RANGE(1, 3000000)` |
kept running, finished 1.5 s later |
The page says "*Stop* cancels the current operation (`Statement.cancel`)",
which is only true for queries.
**3. The operation then shows Cancelled although the statement was
committed**
In the CREATE TABLE case above the operation ends as `CANCELLED`, and the
table exists with 3,000,000 rows (autocommit).
**4. Rows returned by non-SELECT statements are discarded**
`SqlQueryClassifier.isQuery` returns false for `PRAGMA …`,
`INSERT/UPDATE/DELETE … RETURNING`, `CALL`, `EXEC`, DuckDB's `SUMMARIZE` and
`FROM t`, and Snowflake's `LIST @stage`, so they go through `execStatement` and
their result set is never read. On SQLite, `PRAGMA table_info(t)` shows no rows
(it returns 2 through `getRows`), and `INSERT INTO t (a) VALUES (5) RETURNING
id, a` inserts the row but the returned id is lost. The editor only says `OK:
<statement>`. The classic SQL editor uses the same classification.
**5. The row-limit message appears when a query returns exactly the limit**
`queryResultMessage` uses `rowCount >= rowLimit`, so with the default limit
of 1000, a table of exactly 1000 rows gives "Results are capped at 1000 rows by
the Database perspective…", although nothing was left out.
**6. UPDATE and DELETE don't report the affected rows**
`execStatement` returns a `Result` with the counts (H2: `nrLinesUpdated` = 5
for an UPDATE, `nrLinesDeleted` = 2 for a DELETE), but the editor ignores it
and writes `OK: <statement>`. The classic SQL editor doesn't show them either.
### Issue Priority
Priority: 3
### Issue Component
Component: Hop Gui
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]