I started a discussion on this before, you can check it in the mail group https://lists.apache.org/thread/o770bc3k623kyfks2mzkt21qsc4g6328 In order to facilitate everyone to organize the documents, I created a new-docs directory under the incubator-doris directory. The new directory structure is below this. I just created a directory structure here, which needs to be rearranged. In the data import scenario, in order to take into account the viewing habits of previous users, the import is organized in two ways: 1. According to the usage scenario: This will give users clearer guidance. For example, the user is the data source of kafka, then the user can directly select the routine to load 2. According to the import method: it is the introduction of the various import methods we provided before In order to facilitate everyone to run and debug locally, I migrated the entire .vuepress under the original document. After completion, you only need to delete the original docs directory and rename the new new-docs directory to docs. At the same time, you can also run it locally, so that you can organize documents and know the content of each document directory. In the local debugging execution, switch to the new-docs directory and execute the following command: ```` npm install npm run dev ```` then through the browser http://ip:port/zh-CN http://ip:port/en
3.4 KiB
3.4 KiB
title, language
| title | language |
|---|---|
| get_json_string | en |
get_json_string
description
Syntax
VARCHAR get_json_string (VARCHAR json str, VARCHAR json path)
Parse and retrieve the string content of the specified path in the JSON string. Where json_path must start with the $symbol and use. as the path splitter. If the path contains..., double quotation marks can be used to surround it. Use [] to denote array subscripts, starting at 0. The content of path cannot contain ",[and]. If the json_string format is incorrect, or the json_path format is incorrect, or matches cannot be found, NULL is returned.
example
- Get the value of key as "k1"
mysql> SELECT get_json_string('{"k1":"v1", "k2":"v2"}', "$.k1");
+---------------------------------------------------+
| get_json_string('{"k1":"v1", "k2":"v2"}', '$.k1') |
+---------------------------------------------------+
| v1 |
+---------------------------------------------------+
- Get the second element of the array whose key is "my. key"
mysql> SELECT get_json_string('{"k1":"v1", "my.key":["e1", "e2", "e3"]}', '$."my.key"[1]');
+------------------------------------------------------------------------------+
| get_json_string('{"k1":"v1", "my.key":["e1", "e2", "e3"]}', '$."my.key"[1]') |
+------------------------------------------------------------------------------+
| e2 |
+------------------------------------------------------------------------------+
- Get the first element in an array whose secondary path is k1. key - > K2
mysql> SELECT get_json_string('{"k1.key":{"k2":["v1", "v2"]}}', '$."k1.key".k2[0]');
+-----------------------------------------------------------------------+
| get_json_string('{"k1.key":{"k2":["v1", "v2"]}}', '$."k1.key".k2[0]') |
+-----------------------------------------------------------------------+
| v1 |
+-----------------------------------------------------------------------+
- Get all the values in the array where the key is "k1"
mysql> SELECT get_json_string('[{"k1":"v1"}, {"k2":"v2"}, {"k1":"v3"}, {"k1":"v4"}]', '$.k1');
+---------------------------------------------------------------------------------+
| get_json_string('[{"k1":"v1"}, {"k2":"v2"}, {"k1":"v3"}, {"k1":"v4"}]', '$.k1') |
+---------------------------------------------------------------------------------+
| ["v1","v3","v4"] |
+---------------------------------------------------------------------------------+
keyword
GET_JSON_STRING,GET,JSON,STRING