Following the documentation:
We’re implementing a stored procedure as part of the Kafka Memsql pipeline. We have a mix of string, boolean, and integer values.
For integer/numerical values, we used:
JSON_EXTRACT_DOUBLE
For string values:
JSON_EXTRACT_STRING
For boolean values, we used
JSON_EXTRACT_JSON
This worked for us in the first go, but failed at a later point, and now it is persistently failing with the below mentioned exception:
Unhandled exception
Type: ER_WARN_DATA_OUT_OF_RANGE (1264)
Message: Leaf Error : Out of range value for column 'booleancolumn'
Callstack:
#0 Line 3 in db_name.prc_name called from
#1 Line 1 in helper
Leaf Error: Out of range value for column 'booleancolumn'
Following are the questions:
- What could be the possible reason for this exception?
- We also observed that JSON_EXTRACT_DOUBLE is also working for boolean values. Is that understanding right?
- Is there an operator for boolean values just like %(for numerical value), $(for string)?
Here is the sample JSON:
{a:"1",b:2,c:true}
Sample procedure:
CREATE OR REPLACE PROCEDURE prc_name(SAMPLE_BATCH query(SAMPLE_JSON json))
AS
BEGIN
INSERT INTO table_name(a,b,c)
SELECT json_extract_string(SAMPLE_JSON, 'a'), json_extract_double(SAMPLE_JSON,'b'),json_extract_json(SAMPLE_JSON,'c')
FROM SAMPLE_BATCH;
END;
Corresponding pipeline creation:
CREATE PIPELINE `pipeline_name`
AS LOAD DATA KAFKA 'kafka_url/topic'
FORMAT JSON
(
`SAMPLE_JSON` <- %
)