Repository navigation
Support multiply without blanks - #3830
qianheng-aws wants to merge 4 commits into
Conversation
Signed-off-by: Heng Qian <[email protected]>
Signed-off-by: Heng Qian <[email protected]>
| // specially allow index name ends with * without wrapping it with backticks | ||
| : (CLUSTER)? (ident | ID STAR) |
There was a problem hiding this comment.
I am not sure the table-ident-end-with-star is the only one table-ident-with-star pattern we can ignore backticks.
In another word, this makes a breaking change that blocks the use case of
source=table*.2025*
There was a problem hiding this comment.
This PR will no doubt introduce breaking change.
I just want to mitigate the gap for the most common case where only the table idents end ends with star. If we think cluster ident ends with * is also widely used, I may need to find a way to support this case without backticks as well.
There was a problem hiding this comment.
If the breaking change for the case where star in the middle of table ident is also unacceptable, the current approach won't make it. Then we need to find another way.
There was a problem hiding this comment.
We should support source=table*.2025*.
And we should differenate
- wildcard-field vs field. currently, PPL do not support wildcard-field, but it is needed https://github.com/opensearch-project/sql/pull/3830/files
- wildcard-string, e.g.
source=table*.2025*
There was a problem hiding this comment.
- Do we have plan to support wildcard-field in the future? It's also supported by current g4 with adding backticks
- It can work around by adding backticks
source=`table*.2025*`
There was a problem hiding this comment.
It can work around by adding backticks
I don't think the current implementation is a optimal fixing to merge, actually the current issue also contains a workaround a = b * 10. The patching doesn't make thing better IMO.
There was a problem hiding this comment.
Find a way to support source=table*.2025*, without adding backticks. It will eliminate the breaking change with the latest code. @LantaoJin @penghuo
There was a problem hiding this comment.
wildcard-field vs field. currently, PPL do not support wildcard-field, but it is needed
Seems the * can be used in field name in OpenSearch:
PUT test002
{
"mappings": {
"properties": {
"gender": {
"type": "text",
"fielddata": true
},
"updated_at": {
"type": "date",
"format": "strict_date_time"
},
"*id": {
"type": "integer"
}
}
}
}
POST test002/_bulk
{"create": {}}
{"gender":"M","updated_at":"2013-07-15T10:41:34Z", "*id": 1}
{"create": {}}
{"gender":"M","updated_at":"2013-07-15T10:42:34Z", "*id": 1}
{"create": {}}
{"gender":"F","updated_at":"2013-07-15T10:43:34Z", "*id": 1}
{"create": {}}
{"gender":"F","updated_at":"2013-07-15T10:44:34Z", "*id": 1}
POST /_plugins/_ppl/
{
"query": """
source = test002 | eval `10 * *id` = 10 * *id | fields `10 * *id`
"""
}
{
"schema": [
{
"name": "10 * *id",
"type": "int"
}
],
"datarows": [
[
10
],
[
10
],
[
10
],
[
10
]
],
"total": 4,
"size": 4
}
I think we should just call out in doc that the blanks are required for multiply operator in PPL/SQL syntax.
There was a problem hiding this comment.
Since we need to support wildcard-field as well, it's not easy to fix this issue without introducing breaking change.
Will close this PR
Signed-off-by: Heng Qian <[email protected]>
Signed-off-by: Heng Qian <[email protected]>
| ppl: | ||
| body: | ||
| query: 'source=test* | eval a = balance*10 | fields a' | ||
| query: 'source= *te*st* | eval a = balance*10 | fields a' |
There was a problem hiding this comment.
why add a SPACE after =? can it be source=*te*st*?
There was a problem hiding this comment.
please add a case:
source=*te*st* | eval a = balance*10 | fields a
source=`*te*st*` | eval a = balance *10 | fields a
source=*te*st*:`*te*st*` | eval a = balance* 10 | fields a
Since we need to support Will close this PR |
Description
Support multiply without blanks.
Implements it by making
IDnot allow containing*.But since we should support index patterns which contains
*, we have to make compromise that wrapping it with backticks. However, for the most common case where the index pattern ends with*, it doesn't need wrapping with backticks as we add this specific pattern in thetableIdent.For example:
Or
Related Issues
Resolves #720
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.