OpenSearch/x-pack/plugin/sql
Andras Palinkas a7301065d7
SQL: Fix the return type in the sign function (#64845) (#64968)
Fixes the inconsistency between the type of the object returned by the
`SIGN()/SIGNUM()` SQL functions and the specified `DataType`.

In the Class Sign, DataType is DataTypes.INTEGER. The source code is as
follows:

```
    public DataType dataType() {
        return DataTypes.INTEGER;
    }
```

But In the Class MathProcessor, the source code of SIGN((Object l),
Parameter and return value types are the same. Therefore, when using
double or float parameters to test, there is a little problem, the test
method is like the following curl :

```
curl -XPOST 127.0.0.1:9200/_sql -d "{\"query\":\"select  SIGN(1.0) \"}" \
  -H 'Content-Type: application/json'
```

The result is:

```
{"columns":[{"name":"SIGN(1.0)","type":"integer"}],"rows":[[1.0]]}
```

The result value is `1.0`, but the type is `integer`.

Signed-off-by: mantuliu <240951888@qq.com>
Co-authored-by: Marios Trivyzas <matriv@gmail.com>
(cherry picked from commits aa78301e71f, ced3c1281c7, 40e5b9b)
2020-11-11 17:07:17 -05:00
..
jdbc Add compatibility testing for JDBC driver (#60409) 2020-07-29 10:45:11 -07:00
qa Use no-kpi subdomains for tests downloading artifacts (#64502) 2020-11-07 11:30:52 -08:00
sql-action Upgrade to Lucene-8.7.0 (#64532) (#64537) 2020-11-03 16:57:04 +01:00
sql-cli Replace immediate task creations by using task avoidance api (#60071) (#60504) 2020-07-31 13:09:04 +02:00
sql-client [7.x] SQL: Redact credentials in connection exceptions (#58650) (#59025) 2020-07-04 11:29:06 +02:00
sql-proto SQL: Add option to provide the delimiter for the CSV format (#59907) (#60420) 2020-07-29 21:40:11 +02:00
src SQL: Fix the return type in the sign function (#64845) (#64968) 2020-11-11 17:07:17 -05:00
build.gradle SQL: Allow skip of bwc tests on `check` task (#62936) (#63089) 2020-09-30 20:03:19 +02:00