taoran92 opened a new issue, #10543:
URL: https://github.com/apache/paimon/issues/10543

   ### Search before asking
   
   - [x] I searched the issues and found nothing similar.
   
   ### Paimon version
   
   Master at `625d0d4e8`.
   
   ### Compute Engine
   
   Flink 1.20.1, using Docker-based E2E tests with the `flink1` profile.
   
   ### Minimal reproduce step
   
   Add the following test to a class extending `E2eTestBase` and run it with 
Docker available:
   
   ```java
   @Test
   void invalidSqlShouldFail() throws Exception {
       runBatchSql("SELECT * FROM table_that_does_not_exist;");
   }
   ```
   
   The SQL Client reports:
   
   ```text
   Flink SQL> [ERROR] Could not execute SQL statement. Reason:
   org.apache.calcite.sql.validate.SqlValidatorException:
   Object 'table_that_does_not_exist' not found
   ```
   
   However, the SQL Client process can exit with code `0`. `E2eTestBase#runSql` 
currently checks only the exit code and returns `null` when no Job ID is found, 
so the test passes despite the SQL failure. This affects tests using both 
`runBatchSql` and `runStreamingSql`.
   
   ### What doesn't meet your expectations?
   
   An E2E test should fail when a SQL statement fails. Successful statements 
without a Job ID should remain valid, and error-like text in query results 
should not cause false failures.
   
   ### Anything else?
   
   The proposed fix is to append a completion check to each script:
   
   ```sql
   CREATE TEMPORARY VIEW <unique_name> AS SELECT 1 AS <unique_name>;
   DESCRIBE <unique_name>;
   ```
   
   Flink SQL Client file execution stops on the first statement error. The 
helper can therefore require both a zero exit code and the unique column's 
metadata row in the `DESCRIBE` output. If the completion check is missing, it 
should fail with stdout and stderr included in the diagnostic message.
   
   Using a temporary view has several advantages:
   
   - **No additional Flink job:** creating and describing the view are metadata 
operations, making the check suitable for both batch and streaming scripts.
   - **Session-local lifecycle:** the view does not create a persistent catalog 
object or require separate cleanup.
   - **Unambiguous completion evidence:** a fresh identifier distinguishes the 
metadata row from ordinary query data and echoed SQL.
   - **Preserves existing return behavior:** the check produces no Job ID, so 
successful DDL and configuration statements can still return `null`.
   - **Avoids error-message parsing:** detection does not depend on exception 
wording or mistake error-like query results for client failures.
   
   This helper supports Flink's default SQL dialect and scripts that run to 
completion. Hive dialect scripts and explicit `QUIT`/`EXIT` commands are 
outside its supported scope.
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!
   


-- 
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]

Reply via email to