[feature](jsonb) rename JSONB type name and function name to JSON (#19774)

To be more compatible with MySQL, rename JSONB type name and function name to JSON.

The old JSONB type name and jsonb_xx function can still be used for backward compatibility.

There is a function jsonb_extract remained since json_extract is used by json string function and more work need to change it. It will be changed further.
This commit is contained in:
Kang
2023-05-18 16:16:52 +08:00
committed by GitHub
parent a2c9ed7be8
commit 294599ee45
29 changed files with 10090 additions and 438 deletions

View File

@ -421,6 +421,7 @@ terminal String
KW_INVERTED,
KW_JOB,
KW_JOIN,
KW_JSON,
KW_JSONB,
KW_KEY,
KW_KEYS,
@ -5995,6 +5996,8 @@ type ::=
{: RESULT = Type.QUANTILE_STATE; :}
| KW_STRING
{: RESULT = ScalarType.createStringType(); :}
| KW_JSON
{: RESULT = ScalarType.createJsonbType(); :}
| KW_JSONB
{: RESULT = ScalarType.createJsonbType(); :}
| KW_TEXT
@ -7216,6 +7219,8 @@ keyword ::=
{: RESULT = id; :}
| KW_JOB:id
{: RESULT = id; :}
| KW_JSON:id
{: RESULT = id; :}
| KW_JSONB:id
{: RESULT = id; :}
| KW_ENCRYPTKEY:id

View File

@ -78,7 +78,7 @@ public class Util {
TYPE_STRING_MAP.put(PrimitiveType.DATETIMEV2, "datetimev2");
TYPE_STRING_MAP.put(PrimitiveType.CHAR, "char(%d)");
TYPE_STRING_MAP.put(PrimitiveType.VARCHAR, "varchar(%d)");
TYPE_STRING_MAP.put(PrimitiveType.JSONB, "jsonb");
TYPE_STRING_MAP.put(PrimitiveType.JSONB, "json");
TYPE_STRING_MAP.put(PrimitiveType.STRING, "string");
TYPE_STRING_MAP.put(PrimitiveType.DECIMALV2, "decimal(%d, %d)");
TYPE_STRING_MAP.put(PrimitiveType.DECIMAL32, "decimal(%d, %d)");

View File

@ -625,7 +625,7 @@ public class JdbcClient {
case "inet":
case "macaddr":
case "varbit":
case "jsonb":
case "json":
case "uuid":
case "bytea":
return ScalarType.createStringType();

View File

@ -278,6 +278,7 @@ import org.apache.doris.qe.SqlModeHelper;
keywordMap.put("isolation", new Integer(SqlParserSymbols.KW_ISOLATION));
keywordMap.put("job", new Integer(SqlParserSymbols.KW_JOB));
keywordMap.put("join", new Integer(SqlParserSymbols.KW_JOIN));
keywordMap.put("json", new Integer(SqlParserSymbols.KW_JSON));
keywordMap.put("jsonb", new Integer(SqlParserSymbols.KW_JSONB));
keywordMap.put("key", new Integer(SqlParserSymbols.KW_KEY));
keywordMap.put("keys", new Integer(SqlParserSymbols.KW_KEYS));