chovy-3012 opened a new issue, #13185: URL: https://github.com/apache/seatunnel/issues/13185
### Search before asking - [x] I had searched in the [feature](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22Feature%22) issues and found no similar feature requirement. ### Description The SQL transform currently has no `IF` conditional function. Queries like the one below fail at job planning with an unsupported-function error: ```sql SELECT IF(age < 18, 'Minor', 'Adult') AS age_category FROM fake ``` Actual error output: ``` Unsupported function: IF ``` The SQL transform already supports `MULTI_IF`, `CASE WHEN` and `IFNULL`, but not the most common single-condition form. `IF(condition, trueValue, falseValue)` is standard in Hive, MySQL and Spark SQL, so jobs migrated from those engines fail until every `IF` is rewritten to `MULTI_IF(condition, trueValue, falseValue)`. Expected behavior: - `IF(condition, trueValue, falseValue)` returns `trueValue` when the condition is true, otherwise `falseValue` - A null condition is treated as false - The two value branches may have different types; the result uses their common type (e.g. a string branch and a number branch produce a string result) ### Usage Scenario Migrating ETL jobs from Hive / MySQL / Spark SQL. `IF` appears constantly in column derivations, e.g.: - Categorization: `IF(score >= 60, 'pass', 'fail')` - Flag mapping: `IF(status = 1, 'active', 'inactive')` - Null-agnostic defaults: `IF(flag, value_a, value_b)` where `flag` is a boolean column that may be null Today each of these must be manually rewritten to `MULTI_IF(...)` or `CASE WHEN ... END`, which makes migrated SQL diverge from the original job and adds review effort on every migration. ### Related issues None. (#9153 requested `MULTI_IF`, which is already supported; this asks for the single-condition `IF` form.) ### Are you willing to submit a PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- 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]
