# Copyright 2023 PingCAP, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

>> DBGInvoke __enable_schema_sync_service('false')

>> drop table if exists json_test

>> create table json_test (id Int64, c1 Nullable(String)) engine = Log

>> insert into json_test(id,c1) values(-1,null),(0,'\x04\00'),(1,'\x04\01'),(2,'\x04\02'),(3,'\x0a'),(4,'\x01\x77\x00\x00\x00'),(5,'\x03\x88\x00\x00\x00')

>> select id, jsonLength(c1) from json_test order by id
┌─id─┬─jsonLength(c1)─┐
│ -1 │             \N │
│  0 │              1 │
│  1 │              1 │
│  2 │              1 │
│  3 │              1 │
│  4 │            119 │
│  5 │            136 │
└────┴────────────────┘

# Clean up
>> drop table if exists json_test
