NganWave opened a new pull request, #12491:
URL: https://github.com/apache/seatunnel/pull/12491

   ## Description:
   
   Related: #11496
   
   ### Background & Problem
   When integrating SeaTunnel with Airflow, I found that users cannot pass 
complex connection properties (e.g., mysql_properties) via the -i command-line 
parameter because the current parser does not support JSON strings for map 
types.
   
   ### Solution
   This PR adds support for parsing JSON strings as map-type parameters in the 
CLI. It extends the existing parameter parsing logic, which already supports 
comma-containing strings and arrays, to now also handle JSON objects. For 
example:
   ```
   -i 
mysql_properties='{"connectTimeout":"5000","serverTimezone":"UTC","useSSL":"false","allowPublicKeyRetrieval":"true"}'
   ```
   
   Compared with #11496, this PR adjusts some logic as follows:
   
   1. `ParameterSplitter` is responsible for correctly splitting user input 
variables by commas. Brace/bracket depth detection is removed to maintain 
single responsibility. Format validation is deferred to 
`ConfigFactory.parseString()`, which provides more 
   accurate error messages. 
   
   2. To avoid false rejection of legitimate strings containing brackets (e.g., 
`password={drtv,dg}`), values that look like JSON/Array but fail structure 
validation are silently treated as plain String. The type-mismatch error 
surfaces at the `ReadOnlyConfig` generation stage, where the field name and 
actual value are included in the error message for troubleshooting.
   
   3. Do not support JSON variables at source/transform/sink and plugin-level 
nodes due to SeaTunnel SPI constraints.
   
   4. Separate user input config and system properties for user variables 
parsing and optimize priority.
   
   5. Reject duplicate placeholders with different default values in config 
file to maintain semantic consistency with the CLI duplicate key rejection.
   
   To reduce review burden and avoid scope creep, the three phases mentioned in 
PR #11496 are adjusted as follows:
   Phase-1: support JSON params via CLI;
   Phase-2: support JSON default values in config file;
   Phase-3: update docs and migration guide
   
   
   ### Note:
   ## 1. `-i` values are no longer visible via System.getProperties()
   ## 2. JSON variables via CLI and default JSON values in config file for 
source/sink/transform and plugin-level node are not supported
   


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