Description:
The document (https://dev.mysql.com/doc/refman/5.7/en/json-attribute-functions.html#function_json-valid) said the `JSON_VALID` function should return `NULL` for `NULL` argument. However, this behavior is not consistent when the argument is a column or a literal NULL.
For a column, it returns 0 instead of NULL.
```
mysql> create table t(col int);
Query OK, 0 rows affected (0.02 sec)
mysql> insert into t values (NULL);
Query OK, 1 row affected (0.01 sec)
mysql> select json_valid(t.col) from t;
+-------------------+
| json_valid(t.col) |
+-------------------+
| 0 |
+-------------------+
1 row in set (0.00 sec)
```
For a NULL literal, it returns NULL
```
mysql> select json_valid(NULL);
+------------------+
| json_valid(NULL) |
+------------------+
| NULL |
+------------------+
1 row in set (0.00 sec)
```
How to repeat:
For a column, it returns 0 instead of NULL.
```
mysql> create table t(col int);
Query OK, 0 rows affected (0.02 sec)
mysql> insert into t values (NULL);
Query OK, 1 row affected (0.01 sec)
mysql> select json_valid(t.col) from t;
+-------------------+
| json_valid(t.col) |
+-------------------+
| 0 |
+-------------------+
1 row in set (0.00 sec)
```
For a NULL literal, it returns NULL
```
mysql> select json_valid(NULL);
+------------------+
| json_valid(NULL) |
+------------------+
| NULL |
+------------------+
1 row in set (0.00 sec)
```
Suggested fix:
Make the result consistent. It'd be better to return NULL for `json_valid(col)` when the column is a `NULL`.