-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MINOR] Add example for MAP type in reference docs #3444
Conversation
11d2d6f
to
06061d1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a test which confirms this syntax?
thanks for reviewing. Yes, we have.
The background is that I was going to implement Spark's MAP function, and found that the MAP constructor embedded in calcite had no examples in docs. So try to add it here. |
06061d1
to
05dfde7
Compare
LGTM |
site/_docs/reference.md
Outdated
@@ -1200,7 +1200,7 @@ Note: | |||
| 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 | | |||
| MAP | Collection of keys mapped to values | Example: MAP\['washington', 1, 'obama', 44\] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example is different from other examples.
I think the example should be map(varchar, int)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. I have updated to map[varchar, int] instead of map(varchar, int), because the previous one is calcite standard form, the later one is Spark map form. We haven't implemented this yet. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chucheng92 Do you know generateTypeString
? Please take a look at them.
- ArraySqlType#generateTypeString
- MapSqlType#generateTypeString
- MultisetSqlType#generateTypeString
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JiajunBernoulli thanks. Jiajun, I get your point. I actually wanted to add an example of map function at the beginning, here is actually map type.
I have updated the PR. thanks for reminding me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chucheng92
In fact, we have many map constructor examples.
calcite/core/src/test/resources/sql/misc.iq
Line 2346 in 6f79436
from (select map['a', false, 'b', true] from (values (2))) as t(mycol); |
calcite/core/src/test/resources/sql/misc.iq
Line 2595 in 6f79436
map[multiset['A'], map[1,2], multiset['B'], map[3, 4]] as z |
9ca19d4
to
7f86960
Compare
7f86960
to
41f35f9
Compare
Kudos, SonarCloud Quality Gate passed! |
hi,@JiajunBernoulli I have squashed the commit, If u have time, could you help to merge this? |
The background is that I was going to implement Spark's MAP function, and found that the MAP constructor embedded in calcite had no examples in docs. So try to add it here.
Background and context can be found at: https://issues.apache.org/jira/browse/CALCITE-5918