This is an automated email from the ASF dual-hosted git repository.

mbudiu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/main by this push:
     new 444a8cea43 Document MAP types in grammar
444a8cea43 is described below

commit 444a8cea4389b5db515f4356bf810f03d8efed28
Author: Mihai Budiu <mbu...@feldera.com>
AuthorDate: Thu Jun 20 10:06:08 2024 -0700

    Document MAP types in grammar
    
    Signed-off-by: Mihai Budiu <mbu...@feldera.com>
---
 babel/src/test/java/org/apache/calcite/test/BabelParserTest.java | 6 ++++++
 site/_docs/reference.md                                          | 8 ++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/babel/src/test/java/org/apache/calcite/test/BabelParserTest.java 
b/babel/src/test/java/org/apache/calcite/test/BabelParserTest.java
index 8137a6b4c6..a5faeea15f 100644
--- a/babel/src/test/java/org/apache/calcite/test/BabelParserTest.java
+++ b/babel/src/test/java/org/apache/calcite/test/BabelParserTest.java
@@ -304,6 +304,12 @@ class BabelParserTest extends SqlParserTest {
     sql(sql).ok(expected);
   }
 
+  @Test void testCreateTableMapType() {
+    final String sql = "create table foo (bar map<integer, varchar>)";
+    final String expected = "CREATE TABLE `FOO` (`BAR` MAP< INTEGER, VARCHAR 
>)";
+    sql(sql).ok(expected);
+  }
+
   @Test void testCreateSetTable() {
     final String sql = "create set table foo (bar int not null, baz 
varchar(30))";
     final String expected = "CREATE SET TABLE `FOO` (`BAR` INTEGER NOT NULL, 
`BAZ` VARCHAR(30))";
diff --git a/site/_docs/reference.md b/site/_docs/reference.md
index f9edf9c4b9..5e018480fb 100644
--- a/site/_docs/reference.md
+++ b/site/_docs/reference.md
@@ -1205,12 +1205,12 @@ Note:
 
 ### Non-scalar types
 
-| Type     | Description                | Example literals
+| Type     | Description                | Example type
 |:-------- |:---------------------------|:---------------
 | ANY      | The union of all types |
 | UNKNOWN  | A value of an unknown type; used as a placeholder |
 | ROW      | Row with 1 or more columns | Example: row(f0 int null, f1 varchar)
-| MAP      | Collection of keys mapped to values | Example: (int, varchar) map
+| MAP      | Collection of keys mapped to values | Example: map &lt; int, 
varchar &gt;
 | MULTISET | Unordered collection that may contain duplicates | Example: int 
multiset
 | ARRAY    | Ordered, contiguous collection that may contain duplicates | 
Example: varchar(10) array
 | CURSOR   | Cursor over the result of executing a query |
@@ -1500,8 +1500,12 @@ type:
 typeName:
       sqlTypeName
   |   rowTypeName
+  |   mapTypeName
   |   compoundIdentifier
 
+mapTypeName:
+  MAP '<' type ',' type '>'
+
 sqlTypeName:
       char [ precision ] [ charSet ]
   |   varchar [ precision ] [ charSet ]

Reply via email to