An example of the problem is attached.
I have a JSON array, but I need to remove those with null values. When handling, a formatting error occurs. 87362496-98ea-4022-8dbc-4d52fa15c298.zip (7.8 KB)
All data are strings. I have attached the document that clearly demonstrates the problem I am facing. I just need to transform the “Array” field into JSON, but if there is a null field, it is a problem.
Follow the CSV in the attached example in ZIP. Example-Problem-JSON.zip (289 Bytes)
It looks like the double quotes in JSON string is not the right one, I replaced it with the right one and then you will hit the below error
UNSUPPORTED_OPERATION ERROR: Null values are not supported in lists by default. Please set store.json.all_text_mode to true to read lists containing nulls. Be advised that this will treat JSON null values as a string containing the word ‘null’.
Once you set that parameter, the query will work
SELECT oid_id, convert_fromJSON(“array”) JSON_aray FROM “Example-Problem-JSON 2”
But why does it always give an error when I try to treat the field I want to convert to JSON? For example, I would like to replace the [“null”] fields with empty. However, when doing this, Dremio returns me the following error:
Using CONVERT_FROM(*, ‘JSON’) is only supported against string literals and direct table references of types VARCHAR and VARBINARY.
SQL Error: VALIDATION ERROR: Using CONVERT_FROM(*, 'JSON') is only supported against string literals and direct table references of types VARCHAR and VARBINARY.
ErrorOrigin: COORDINATOR
[Error Id: eef65012-b404-4397-b2ec-dadd9fe91953 on dremio-master-0.dremio-cluster-pod.-dev-dremions.svc.cluster.local:31010]
Guys,
what could be my error on it please? Any idea to guide me?
@weslleybarboza How exactly is the JSON file coming in? In your query it’s specified in a WITH clause. However, If you use the actual JSON file instead (attached), you can query it with:
SELECT convert_from(weslleybarboza.DATA_ORDER."value",'JSON').subscription.catalogOfferCode
FROM weslleybarboza AS weslleybarboza
HI @lenoyjacob, thanks for your reply.
My context is:
The source is a view on Dremio pointing to a table from MariaDB
CREATE or REPLACE VIEW "data_product".bronze.glx."workflow-query".integration_context AS
select * from "src-mdb-system"."db_stg_workflow-query".integration_context;