GreptimeTeam / greptimedb

An open-source, cloud-native, unified time series database for metrics, logs and events with SQL/PromQL supported. Available on GreptimeCloud.
https://greptime.com/
Apache License 2.0
4.27k stars 307 forks source link

json_path_exists can't deal with null json #4865

Open Kev1n8 opened 2 hours ago

Kev1n8 commented 2 hours ago

What type of bug is this?

Incorrect result

What subsystems are affected?

Standalone mode, Frontend

Minimal reproduce step

The recently added json_path_exists behaves wrongly when json param is null. For example:

SELECT json_path_exists(null, '$.a')

OUTPUT:
Failed to plan SQL: Error during planning: Error during planning: Coercion from [Null, Utf8] to the signature Exact([Binary, Utf8]) failed. and No function matches the given name and argument types 'json_path_exists(Null, Utf8)'. You might need to add explicit type casts.\n\tCandidate functions:\n\tjson_path_exists(Binary, Utf8)

What did you expect to see?

According to JSON_PATH_MATCH, the result should be null.

What did you see instead?

Error.

What operating system did you use?

macOS 15.0.1

What version of GreptimeDB did you use?

0.9.5

Relevant log output and stack trace

No response

Kev1n8 commented 2 hours ago

I'm already working on it.