[ https://issues.apache.org/jira/browse/CALCITE-2985?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Forward Xu updated CALCITE-2985: -------------------------------- Description: JSON_STORAGE_SIZE(json_val) This function returns the number of bytes used to store the binary representation of a JSON document. When the argument is a JSON column, this is the space used to store the JSON document. json_val must be a valid JSON document or a string which can be parsed as one. In the case where it is string, the function returns the amount of storage space in the JSON binary representation that is created by parsing the string as JSON and converting it to binary. It returns NULL if the argument is NULL. An error results when json_val is not NULL, and is not—or cannot be successfully parsed as—a JSON document. To illustrate this function's behavior when used with a JSON column as its argument, we create a table named jtable containing a JSON column jcol, insert a JSON value into the table, then obtain the storage space used by this column with JSON_STORAGE_SIZE(), as shown here: SELECT JSON_STORAGE_SIZE('[100, "sakila", [1, 3, 5], 425.05]') AS A, JSON_STORAGE_SIZE('{"a": 1000, "b": "a", "c": "[1, 3, 5, 7]"}') AS B, JSON_STORAGE_SIZE('{"a": 1000, "b": "wxyz", "c": "[1, 3, 5, 7]"}') AS C, JSON_STORAGE_SIZE('[100, "json", [[10, 20, 30], 3, 5], 425.05]') AS D; +----+----+----+----+ | A | B | C | D | +----+----+----+----+ | 29 | 37 | 40 | 36 | +----+----+----+----+ was: JSON_STORAGE_SIZE(json_val) This function returns the number of bytes used to store the binary representation of a JSON document. When the argument is a JSON column, this is the space used to store the JSON document. json_val must be a valid JSON document or a string which can be parsed as one. In the case where it is string, the function returns the amount of storage space in the JSON binary representation that is created by parsing the string as JSON and converting it to binary. It returns NULL if the argument is NULL. An error results when json_val is not NULL, and is not—or cannot be successfully parsed as—a JSON document. To illustrate this function's behavior when used with a JSON column as its argument, we create a table named jtable containing a JSON column jcol, insert a JSON value into the table, then obtain the storage space used by this column with JSON_STORAGE_SIZE(), as shown here: > Add the JSON_STORAGE_SIZE function > ---------------------------------- > > Key: CALCITE-2985 > URL: https://issues.apache.org/jira/browse/CALCITE-2985 > Project: Calcite > Issue Type: Sub-task > Reporter: Forward Xu > Assignee: Forward Xu > Priority: Major > > JSON_STORAGE_SIZE(json_val) > This function returns the number of bytes used to store the binary > representation of a JSON document. When the argument is a JSON column, this > is the space used to store the JSON document. json_val must be a valid JSON > document or a string which can be parsed as one. In the case where it is > string, the function returns the amount of storage space in the JSON binary > representation that is created by parsing the string as JSON and converting > it to binary. It returns NULL if the argument is NULL. > An error results when json_val is not NULL, and is not—or cannot be > successfully parsed as—a JSON document. > To illustrate this function's behavior when used with a JSON column as its > argument, we create a table named jtable containing a JSON column jcol, > insert a JSON value into the table, then obtain the storage space used by > this column with JSON_STORAGE_SIZE(), as shown here: > SELECT > JSON_STORAGE_SIZE('[100, "sakila", [1, 3, 5], 425.05]') AS A, > JSON_STORAGE_SIZE('{"a": 1000, "b": "a", "c": "[1, 3, 5, 7]"}') AS B, > JSON_STORAGE_SIZE('{"a": 1000, "b": "wxyz", "c": "[1, 3, 5, 7]"}') AS C, > JSON_STORAGE_SIZE('[100, "json", [[10, 20, 30], 3, 5], 425.05]') AS D; > +----+----+----+----+ > | A | B | C | D | > +----+----+----+----+ > | 29 | 37 | 40 | 36 | > +----+----+----+----+ -- This message was sent by Atlassian JIRA (v7.6.3#76005)