SQL: Fix incorrect field type returned by SYS TYPE (elastic/x-pack-elasticsearch#4358)

SYS TYPE returns an integer instead of a boolean (the bug was caused
by reading the ODBC spec which refers to the wire representation instead
of the JDBC one which uses primitives)

Original commit: elastic/x-pack-elasticsearch@f9fe64ab0d
This commit is contained in:
Costin Leau 2018-04-13 18:22:53 +03:00 committed by GitHub
parent fc5e1631f1
commit 4252b3094c
2 changed files with 3 additions and 1 deletions

View File

@ -83,7 +83,7 @@ public class SysTypes extends Command {
// only numerics are signed
!t.isSigned(),
//no fixed precision scale SQL_FALSE
0,
false,
null,
null,
null,

View File

@ -66,6 +66,8 @@ public class SysParserTests extends ESTestCase {
assertFalse(r.schema().types().contains(DataType.NULL));
// test numeric as signed
assertFalse(r.column(9, Boolean.class));
// make sure precision is returned as boolean (not int)
assertFalse(r.column(10, Boolean.class));
for (int i = 0; i < r.size(); i++) {
assertEquals(names.get(i), r.column(0));