raminqaf opened a new pull request, #30032:
URL: https://github.com/apache/flink/pull/30032
## What is the purpose of the change
`IS_NAN` is documented as `IS_NAN(value)`, but SQL only resolves it as
`ISNAN`.
```sql
SELECT IS_NAN(d) FROM (VALUES (CAST('NaN' AS DOUBLE)), (CAST(1 AS DOUBLE)))
AS t(d);
SELECT ISNAN(d) FROM (VALUES (CAST('NaN' AS DOUBLE)), (CAST(1 AS DOUBLE)))
AS t(d);
```
| Call | Before
| After
|
|-----------------------------------------|-----------------------------------------------------------|----------------------------------------------------------|
| SQL `IS_NAN(d)` | `No match found for function
signature IS_NAN(<NUMERIC>)` | `TRUE`, `FALSE`
|
| SQL `ISNAN(d)` | `TRUE`, `FALSE`
| `No match found for function signature
ISNAN(<NUMERIC>)` |
| Table API `$("d").isNan()` as SQL | ``IS_NAN(`d`)``, which SQL
rejects | ``IS_NAN(`d`)``, which SQL runs
|
| `internalName` in a compiled plan | `$ISNAN$1`
| `$IS_NAN$1`
|
`CoreModule` registers built-in functions under `name()`. The definition had
`.name("isNan").sqlName("IS_NAN")`, and `sqlName` only controls how a Table API
call prints as SQL. Naming the definition `IS_NAN` makes SQL agree with the
docs and with the Table API, and matches the upper-case naming of the other
built-in functions. Spark and Databricks call it `isnan`.
Trade-off: `ISNAN` stops resolving, and a plan compiled before this change
no longer restores: `Could not resolve internal system function '$ISNAN$1'.
This is a bug, please file an issue.` No release has the function yet. It came
with FLINK-40196, and 2.4.0 isn't released. Backporting this to release-2.4
before 2.4.0 keeps `ISNAN` out of every release.
## Brief change log
- `BuiltInFunctionDefinitions.IS_NAN` is named `IS_NAN` and no longer sets
a separate `sqlName`.
## Verifying this change
This change added tests and can be verified as follows:
- `ComparisonFunctionITCase` runs SQL, the Table API and the Table API's
SQL string for NaN, an infinity, a number and NULL, and checks that `ISNAN`
fails validation. Without the fix, the 8 SQL items fail with `No match found
for function signature IS_NAN(<NUMERIC>)` and `ISNAN` resolves.
- `ExpressionSerializationTest` pins that `$("f0").isNan()` prints
``IS_NAN(`f0`)``.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): no
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: no. No signature changes, only the SQL name of an
unreleased function.
- The serializers: no
- The runtime per-record code paths (performance sensitive): no
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
- The S3 file system connector: no
## Documentation
- Does this pull request introduce a new feature? no
- If yes, how is the feature documented? not applicable. The docs already
describe `IS_NAN(value)`.
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
Generated-by: Claude Code 2.1.328 (Claude Opus 5.5)
--
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]