support Bool in JSONType

This commit is contained in:
Anton Popov 2023-03-01 02:04:06 +00:00
parent fc1e0608c6
commit 2c41ddf609
3 changed files with 7 additions and 2 deletions

View File

@ -647,11 +647,12 @@ public:
case ElementType::OBJECT:
type = '{';
break;
case ElementType::BOOL:
type = 'b';
break;
case ElementType::NULL_VALUE:
type = 0;
break;
default:
return false;
}
ColumnVector<Int8> & col_vec = assert_cast<ColumnVector<Int8> &>(dest);

View File

@ -19,6 +19,7 @@ a
--JSONType--
Object
Array
Bool
--JSONExtract<numeric>--
-100
200
@ -172,6 +173,7 @@ a
--JSONType--
Object
Array
Bool
--JSONExtract<numeric>--
-100
200

View File

@ -28,6 +28,7 @@ SELECT JSONKey('{"a": "hello", "b": [-100, 200.0, 300]}', -2);
SELECT '--JSONType--';
SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}');
SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}', 'b');
SELECT JSONType('{"a": true}', 'a');
SELECT '--JSONExtract<numeric>--';
SELECT JSONExtractInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 1);
@ -196,6 +197,7 @@ SELECT JSONKey('{"a": "hello", "b": [-100, 200.0, 300]}', -2);
SELECT '--JSONType--';
SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}');
SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}', 'b');
SELECT JSONType('{"a": true}', 'a');
SELECT '--JSONExtract<numeric>--';
SELECT JSONExtractInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 1);