regarding *AVRO routine LOAD with Kafka*: Does hav...
# questions-and-troubleshooting
n
regarding AVRO routine LOAD with Kafka: Does having a calculated column (
__op
) work when using jsonpaths extraction columns? I'm getting a error:
Error: NULL value in non-nullable column '__op'
• error doesn't occur when I omit the column with calculated value. • I made sure all the jsonpaths columns are listed first in columns section • the calculated column definition:
__op = (CASE WHEN _meta_op = 'd' THEN 'delete' ELSE 'upsert' END)
- this should never be null, and I confirmed that kafka messages always contain a value. Is this a bug? Or am I missing something? Thanks in advance!
Copy code
CREATE ROUTINE LOAD kafka_test_db.estuary_sensor_log_load_job ON sensor_log_upsert
COLUMNS(
    `id`,
    `_meta_op`,
    __op = (CASE WHEN `_meta_op` = 'd' THEN 'delete' ELSE 'upsert' END)
)
PROPERTIES
(
    "format" = "avro",
	"jsonpaths" = "[\"$.id\", \"$._meta_op\"]"
	...
)
FROM KAFKA
(
...
);
I resolved with a simple fix:
Copy code
__op = (CASE WHEN `_meta_op` = 'd' THEN 1 ELSE 0 END)