-
Notifications
You must be signed in to change notification settings - Fork 43
Fixes gh-2516 New SQL data types and function changes #2523
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
Conversation
Hi, @pgulutzan! I will review this PR. I also want to say that there will be a few more patches related to MAP and ARRAY. There will be a patch that adds a syntax for MAP values, patches that fix an error when MAP or ARRAY is used in ORDER BY/GROUP BY, and patches that fix some problems with using MAP and ARRAY in C user-defined functions. Also, it's possible that I will find more problems. |
@ImeevMA: "A possible controversial point is that I introduced arrays and maps in a section about literals rather than a later section about expressions -- putting them later would require some reorganizing." What is your opinion? |
In sql_plus_lua.rst, examples that work in earlier versions will fail in Tarantool version 2.10.0. .. code-block:: lua
The comments should be translated for the Russian manual. |
@pgulutzan Yes, let's do what you suggest. Thanks for letting me know. |
…removing WE due to style guide
… redoing tables due to style guide
…imported recently-changed sql-features.rst and made small adjustments
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.
Hi! Thanks for the patch-set. I have a few comments below, but nothing major. I only reviewed the part about MAP and ARRAY.
* - MAP | ||
- map | ||
- (none) | ||
- ``{'':''}`` |
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.
I think {}
can be considered smaller than {'':''}
.
:ref:`column definitions <sql_column_def_data_type>` and the individual column values have | ||
type ANY. | ||
The difference between SCALAR and ANY is: | ||
SCALAR columns may not contain MAP or ARRAY values, but ANY columns may contain them. |
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.
I think we should add that ANY values are not comparable (SCALAR values are comparable).
{ key : value } |br| | ||
... for MAP expressions. |br| | ||
Literal Examples: ``{'a':1}``, ``{ "column_1" : X'1234' }`` |br| | ||
Non-literal Examples: ``{"a":"a"}``, ``{UUID(), (SELECT 1) + 1}`` |br| |
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.
I think here should be {UUID(): (SELECT 1) + 1}
. Also, I think we should add some examples of MAP values where there is more than one key-value pairs, for example: {1:'a123', 'two':uuid()}
.
(also called braces) ``{`` and ``}`` and contains a key for identification, | ||
then a colon ``:``, then a value for what the key identifies. | ||
The key data type must be INTEGER or STRING or UUID. | ||
The value data type may be anything. |
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.
I think we should add that the value can also be a MAP, so MAPs can be nested (as was done for ARRAY).
|
||
.. _sql_array_index_expression: | ||
|
||
ARRAY index expression: |br| |
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.
I think we should expand this part to include []
for MAP. Or it should be dropped, since the patch is currently in review: tarantool/tarantool#7140
Issue #2516 is intended as a fix for
Issue #2406 Literals for INTEGER, DECIMAL and DOUBLE
Issue #2439 SUBSTR() function
Issue #2440 Field type ANY in SQL
Issue #2455 Default types of SQL built-in functions
Issue #2461 Field type ARRAY in SQL
Issue #2462 Field type MAP in SQL
Issue #2475 Syntax for ARRAY in SQL
Probably reviewers will include @ImeevMA and @NickVolynkin.
Probably there will be several commits so consider this a first draft.
A possible controversial point is that I introduced arrays and maps in a section about literals rather than a later section about expressions -- putting them later would require some reorganizing.
UPDATE (2022-02-07): This is no longer a draft, so reviewer @ImeevMA can look at it whenever it's convenient.