You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "amorynan (via GitHub)" <gi...@apache.org> on 2023/02/20 10:40:22 UTC
[GitHub] [doris] amorynan opened a new pull request, #16948: [Improve](map-type) Add contains_null for map
amorynan opened a new pull request, #16948:
URL: https://github.com/apache/doris/pull/16948
# Proposed changes
add contains_null for map
## Problem summary
Describe your changes.
## Checklist(Required)
* [ ] Does it affect the original behavior
* [ ] Has unit tests been added
* [ ] Has document been added or modified
* [ ] Does it need to update dependencies
* [ ] Is this PR support rollback (If NO, please explain WHY)
## Further comments
If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] amorynan commented on pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "amorynan (via GitHub)" <gi...@apache.org>.
amorynan commented on PR #16948:
URL: https://github.com/apache/doris/pull/16948#issuecomment-1441306465
run p0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] xy720 commented on a diff in pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "xy720 (via GitHub)" <gi...@apache.org>.
xy720 commented on code in PR #16948:
URL: https://github.com/apache/doris/pull/16948#discussion_r1112488331
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/MapLiteral.java:
##########
@@ -47,30 +47,35 @@ public MapLiteral(LiteralExpr... exprs) throws AnalysisException {
Type keyType = Type.NULL;
Type valueType = Type.NULL;
children = new ArrayList<>();
- int idx = 0;
- // TODO(xy): limit key type to scalar type
- for (LiteralExpr expr : exprs) {
- if (idx % 2 == 0) {
- if (keyType == Type.NULL) {
- keyType = expr.getType();
- } else {
- keyType = Type.getAssignmentCompatibleType(keyType, expr.getType(), true);
- }
- if (keyType == Type.INVALID) {
- throw new AnalysisException("Invalid element type in Map");
- }
+ // check types here
+ // 1. limit key type with map-key support
+ // 2. check type can be assigment for cast
+ for (int idx = 0; idx < exprs.length && idx + 1 < exprs.length; idx += 2) {
+ if (type.supportSubType(exprs[idx].getType())) {
Review Comment:
type is not initialized.
Why not changed this method to a static method?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] xy720 commented on a diff in pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "xy720 (via GitHub)" <gi...@apache.org>.
xy720 commented on code in PR #16948:
URL: https://github.com/apache/doris/pull/16948#discussion_r1112488331
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/MapLiteral.java:
##########
@@ -47,30 +47,35 @@ public MapLiteral(LiteralExpr... exprs) throws AnalysisException {
Type keyType = Type.NULL;
Type valueType = Type.NULL;
children = new ArrayList<>();
- int idx = 0;
- // TODO(xy): limit key type to scalar type
- for (LiteralExpr expr : exprs) {
- if (idx % 2 == 0) {
- if (keyType == Type.NULL) {
- keyType = expr.getType();
- } else {
- keyType = Type.getAssignmentCompatibleType(keyType, expr.getType(), true);
- }
- if (keyType == Type.INVALID) {
- throw new AnalysisException("Invalid element type in Map");
- }
+ // check types here
+ // 1. limit key type with map-key support
+ // 2. check type can be assigment for cast
+ for (int idx = 0; idx < exprs.length && idx + 1 < exprs.length; idx += 2) {
+ if (type.supportSubType(exprs[idx].getType())) {
Review Comment:
type is not initialized.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] xy720 commented on a diff in pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "xy720 (via GitHub)" <gi...@apache.org>.
xy720 commented on code in PR #16948:
URL: https://github.com/apache/doris/pull/16948#discussion_r1111890046
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/MapLiteral.java:
##########
@@ -47,30 +47,18 @@ public MapLiteral(LiteralExpr... exprs) throws AnalysisException {
Type keyType = Type.NULL;
Type valueType = Type.NULL;
children = new ArrayList<>();
- int idx = 0;
- // TODO(xy): limit key type to scalar type
- for (LiteralExpr expr : exprs) {
- if (idx % 2 == 0) {
- if (keyType == Type.NULL) {
- keyType = expr.getType();
- } else {
- keyType = Type.getAssignmentCompatibleType(keyType, expr.getType(), true);
- }
- if (keyType == Type.INVALID) {
- throw new AnalysisException("Invalid element type in Map");
- }
- } else {
- if (valueType == Type.NULL) {
- valueType = expr.getType();
- } else {
- valueType = Type.getAssignmentCompatibleType(valueType, expr.getType(), true);
- }
- if (valueType == Type.INVALID) {
- throw new AnalysisException("Invalid element type in Map");
- }
+ for (int idx = 0; idx < exprs.length && idx + 1 < exprs.length; idx += 2) {
+ // limit key type to scalar type
+ keyType = Type.getAssignmentCompatibleType(keyType, exprs[idx].getType(), true);
+ if (keyType == Type.INVALID || !keyType.isScalarType()) {
+ throw new AnalysisException("Invalid key type in Map Only support scalar type");
+ }
+ valueType = Type.getAssignmentCompatibleType(valueType, exprs[idx + 1].getType(), true);
+ if (valueType == Type.INVALID) {
+ throw new AnalysisException("Invalid value type in Map");
}
- children.add(expr);
- ++ idx;
+ children.add(exprs[idx]);
+ children.add(exprs[idx + 1]);
Review Comment:
Just a example:
```
for (int idx = 0; idx < exprs.length && idx + 1 < exprs.length; idx += 2) {
if (MapType.supportKeyType(exprs[idx].getType())) {
throw new AnalysisException("Invalid key type in Map, not support " + keyType);
}
keyType = Type.getAssignmentCompatibleType(keyType, exprs[idx].getType(), true);
valueType = Type.getAssignmentCompatibleType(valueType, exprs[idx + 1].getType(), true);
}
if (keyType == Type.INVALID) {
throw new AnalysisException("Invalid key type in Map.");
}
if (valueType == Type.INVALID) {
throw new AnalysisException("Invalid value type in Map.");
}
for (int idx = 0; idx < exprs.length && idx + 1 < exprs.length; idx += 2) {
if (exprs[idx].getType().equals(keyType)) {
children.add(expr[idx]);
} else {
children.add(expr[idx].castTo(keyType));
}
if (exprs[idx+1].getType().equals(valueType)) {
children.add(expr[idx+1]);
} else {
children.add(expr[idx+1].castTo(valueType));
}
}
```
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/MapLiteral.java:
##########
@@ -47,30 +47,18 @@ public MapLiteral(LiteralExpr... exprs) throws AnalysisException {
Type keyType = Type.NULL;
Type valueType = Type.NULL;
children = new ArrayList<>();
- int idx = 0;
- // TODO(xy): limit key type to scalar type
- for (LiteralExpr expr : exprs) {
- if (idx % 2 == 0) {
- if (keyType == Type.NULL) {
- keyType = expr.getType();
- } else {
- keyType = Type.getAssignmentCompatibleType(keyType, expr.getType(), true);
- }
- if (keyType == Type.INVALID) {
- throw new AnalysisException("Invalid element type in Map");
- }
- } else {
- if (valueType == Type.NULL) {
- valueType = expr.getType();
- } else {
- valueType = Type.getAssignmentCompatibleType(valueType, expr.getType(), true);
- }
- if (valueType == Type.INVALID) {
- throw new AnalysisException("Invalid element type in Map");
- }
+ for (int idx = 0; idx < exprs.length && idx + 1 < exprs.length; idx += 2) {
+ // limit key type to scalar type
+ keyType = Type.getAssignmentCompatibleType(keyType, exprs[idx].getType(), true);
+ if (keyType == Type.INVALID || !keyType.isScalarType()) {
+ throw new AnalysisException("Invalid key type in Map Only support scalar type");
Review Comment:
1、Put this error outside the loop.
2、Types such as float、double、bitmap、hll is also scala type but shouldn't be key type.
3、Users may be don't know what is `scala type`. Use actual type in msg.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] amorynan commented on pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "amorynan (via GitHub)" <gi...@apache.org>.
amorynan commented on PR #16948:
URL: https://github.com/apache/doris/pull/16948#issuecomment-1441366691
run compile
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16948:
URL: https://github.com/apache/doris/pull/16948#issuecomment-1436733390
clang-tidy review says "All clean, LGTM! :+1:"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] xy720 commented on a diff in pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "xy720 (via GitHub)" <gi...@apache.org>.
xy720 commented on code in PR #16948:
URL: https://github.com/apache/doris/pull/16948#discussion_r1111821110
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/MapLiteral.java:
##########
@@ -47,30 +47,18 @@ public MapLiteral(LiteralExpr... exprs) throws AnalysisException {
Type keyType = Type.NULL;
Type valueType = Type.NULL;
children = new ArrayList<>();
- int idx = 0;
- // TODO(xy): limit key type to scalar type
- for (LiteralExpr expr : exprs) {
- if (idx % 2 == 0) {
- if (keyType == Type.NULL) {
- keyType = expr.getType();
- } else {
- keyType = Type.getAssignmentCompatibleType(keyType, expr.getType(), true);
- }
- if (keyType == Type.INVALID) {
- throw new AnalysisException("Invalid element type in Map");
- }
- } else {
- if (valueType == Type.NULL) {
- valueType = expr.getType();
- } else {
- valueType = Type.getAssignmentCompatibleType(valueType, expr.getType(), true);
- }
- if (valueType == Type.INVALID) {
- throw new AnalysisException("Invalid element type in Map");
- }
+ for (int idx = 0; idx < exprs.length && idx + 1 < exprs.length; idx += 2) {
+ // limit key type to scalar type
+ keyType = Type.getAssignmentCompatibleType(keyType, exprs[idx].getType(), true);
+ if (keyType == Type.INVALID || !keyType.isScalarType()) {
+ throw new AnalysisException("Invalid key type in Map Only support scalar type");
Review Comment:
1、Put this error outside the loop.
2、When the exprs are all scala types, this error may still be thrown.
3、Types such as float、double、bitmap、hll is also scala type but shouldn't be key type.
4、Users may be don't know what is `scala type`. Use actual type in msg.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16948:
URL: https://github.com/apache/doris/pull/16948#issuecomment-1439386240
clang-tidy review says "All clean, LGTM! :+1:"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] amorynan commented on a diff in pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "amorynan (via GitHub)" <gi...@apache.org>.
amorynan commented on code in PR #16948:
URL: https://github.com/apache/doris/pull/16948#discussion_r1112505921
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/MapLiteral.java:
##########
@@ -47,30 +47,18 @@ public MapLiteral(LiteralExpr... exprs) throws AnalysisException {
Type keyType = Type.NULL;
Type valueType = Type.NULL;
children = new ArrayList<>();
- int idx = 0;
- // TODO(xy): limit key type to scalar type
- for (LiteralExpr expr : exprs) {
- if (idx % 2 == 0) {
- if (keyType == Type.NULL) {
- keyType = expr.getType();
- } else {
- keyType = Type.getAssignmentCompatibleType(keyType, expr.getType(), true);
- }
- if (keyType == Type.INVALID) {
- throw new AnalysisException("Invalid element type in Map");
- }
- } else {
- if (valueType == Type.NULL) {
- valueType = expr.getType();
- } else {
- valueType = Type.getAssignmentCompatibleType(valueType, expr.getType(), true);
- }
- if (valueType == Type.INVALID) {
- throw new AnalysisException("Invalid element type in Map");
- }
+ for (int idx = 0; idx < exprs.length && idx + 1 < exprs.length; idx += 2) {
+ // limit key type to scalar type
+ keyType = Type.getAssignmentCompatibleType(keyType, exprs[idx].getType(), true);
+ if (keyType == Type.INVALID || !keyType.isScalarType()) {
+ throw new AnalysisException("Invalid key type in Map Only support scalar type");
Review Comment:
yeh , I see ,
date and int are scala types but they are not compatible with each other. so here should throw err, but the error msg should be invaild key type for int (assume origin key type is date.)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] amorynan commented on a diff in pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "amorynan (via GitHub)" <gi...@apache.org>.
amorynan commented on code in PR #16948:
URL: https://github.com/apache/doris/pull/16948#discussion_r1112054418
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/MapLiteral.java:
##########
@@ -47,30 +47,18 @@ public MapLiteral(LiteralExpr... exprs) throws AnalysisException {
Type keyType = Type.NULL;
Type valueType = Type.NULL;
children = new ArrayList<>();
- int idx = 0;
- // TODO(xy): limit key type to scalar type
- for (LiteralExpr expr : exprs) {
- if (idx % 2 == 0) {
- if (keyType == Type.NULL) {
- keyType = expr.getType();
- } else {
- keyType = Type.getAssignmentCompatibleType(keyType, expr.getType(), true);
- }
- if (keyType == Type.INVALID) {
- throw new AnalysisException("Invalid element type in Map");
- }
- } else {
- if (valueType == Type.NULL) {
- valueType = expr.getType();
- } else {
- valueType = Type.getAssignmentCompatibleType(valueType, expr.getType(), true);
- }
- if (valueType == Type.INVALID) {
- throw new AnalysisException("Invalid element type in Map");
- }
+ for (int idx = 0; idx < exprs.length && idx + 1 < exprs.length; idx += 2) {
+ // limit key type to scalar type
+ keyType = Type.getAssignmentCompatibleType(keyType, exprs[idx].getType(), true);
+ if (keyType == Type.INVALID || !keyType.isScalarType()) {
+ throw new AnalysisException("Invalid key type in Map Only support scalar type");
Review Comment:
1, 3, 4 I got it !
but 2 u means, expr type may be valid scalar type for key but also throw error ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16948:
URL: https://github.com/apache/doris/pull/16948#issuecomment-1437760948
clang-tidy review says "All clean, LGTM! :+1:"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] xy720 commented on a diff in pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "xy720 (via GitHub)" <gi...@apache.org>.
xy720 commented on code in PR #16948:
URL: https://github.com/apache/doris/pull/16948#discussion_r1112482642
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/MapLiteral.java:
##########
@@ -47,30 +47,18 @@ public MapLiteral(LiteralExpr... exprs) throws AnalysisException {
Type keyType = Type.NULL;
Type valueType = Type.NULL;
children = new ArrayList<>();
- int idx = 0;
- // TODO(xy): limit key type to scalar type
- for (LiteralExpr expr : exprs) {
- if (idx % 2 == 0) {
- if (keyType == Type.NULL) {
- keyType = expr.getType();
- } else {
- keyType = Type.getAssignmentCompatibleType(keyType, expr.getType(), true);
- }
- if (keyType == Type.INVALID) {
- throw new AnalysisException("Invalid element type in Map");
- }
- } else {
- if (valueType == Type.NULL) {
- valueType = expr.getType();
- } else {
- valueType = Type.getAssignmentCompatibleType(valueType, expr.getType(), true);
- }
- if (valueType == Type.INVALID) {
- throw new AnalysisException("Invalid element type in Map");
- }
+ for (int idx = 0; idx < exprs.length && idx + 1 < exprs.length; idx += 2) {
+ // limit key type to scalar type
+ keyType = Type.getAssignmentCompatibleType(keyType, exprs[idx].getType(), true);
+ if (keyType == Type.INVALID || !keyType.isScalarType()) {
+ throw new AnalysisException("Invalid key type in Map Only support scalar type");
Review Comment:
for example, date and int are scala types but they are not compatible with each other.
But the error msg is "Invalid key type in Map Only support scalar type".
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] amorynan commented on pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "amorynan (via GitHub)" <gi...@apache.org>.
amorynan commented on PR #16948:
URL: https://github.com/apache/doris/pull/16948#issuecomment-1439454941
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16948:
URL: https://github.com/apache/doris/pull/16948#issuecomment-1436729469
clang-tidy review says "All clean, LGTM! :+1:"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16948:
URL: https://github.com/apache/doris/pull/16948#issuecomment-1437920097
clang-tidy review says "All clean, LGTM! :+1:"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16948:
URL: https://github.com/apache/doris/pull/16948#issuecomment-1438371260
PR approved by at least one committer and no changes requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] xy720 merged pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "xy720 (via GitHub)" <gi...@apache.org>.
xy720 merged PR #16948:
URL: https://github.com/apache/doris/pull/16948
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] amorynan commented on pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "amorynan (via GitHub)" <gi...@apache.org>.
amorynan commented on PR #16948:
URL: https://github.com/apache/doris/pull/16948#issuecomment-1441307107
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16948:
URL: https://github.com/apache/doris/pull/16948#issuecomment-1438371350
PR approved by anyone and no changes requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] xy720 commented on a diff in pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "xy720 (via GitHub)" <gi...@apache.org>.
xy720 commented on code in PR #16948:
URL: https://github.com/apache/doris/pull/16948#discussion_r1112488331
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/MapLiteral.java:
##########
@@ -47,30 +47,35 @@ public MapLiteral(LiteralExpr... exprs) throws AnalysisException {
Type keyType = Type.NULL;
Type valueType = Type.NULL;
children = new ArrayList<>();
- int idx = 0;
- // TODO(xy): limit key type to scalar type
- for (LiteralExpr expr : exprs) {
- if (idx % 2 == 0) {
- if (keyType == Type.NULL) {
- keyType = expr.getType();
- } else {
- keyType = Type.getAssignmentCompatibleType(keyType, expr.getType(), true);
- }
- if (keyType == Type.INVALID) {
- throw new AnalysisException("Invalid element type in Map");
- }
+ // check types here
+ // 1. limit key type with map-key support
+ // 2. check type can be assigment for cast
+ for (int idx = 0; idx < exprs.length && idx + 1 < exprs.length; idx += 2) {
+ if (type.supportSubType(exprs[idx].getType())) {
Review Comment:
type is not initialized.
Why not use a new static method?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] amorynan commented on pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "amorynan (via GitHub)" <gi...@apache.org>.
amorynan commented on PR #16948:
URL: https://github.com/apache/doris/pull/16948#issuecomment-1439606632
run compile
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] amorynan commented on pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "amorynan (via GitHub)" <gi...@apache.org>.
amorynan commented on PR #16948:
URL: https://github.com/apache/doris/pull/16948#issuecomment-1441225065
run p0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] amorynan commented on pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "amorynan (via GitHub)" <gi...@apache.org>.
amorynan commented on PR #16948:
URL: https://github.com/apache/doris/pull/16948#issuecomment-1439673362
run p0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] xy720 commented on a diff in pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "xy720 (via GitHub)" <gi...@apache.org>.
xy720 commented on code in PR #16948:
URL: https://github.com/apache/doris/pull/16948#discussion_r1111821110
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/MapLiteral.java:
##########
@@ -47,30 +47,18 @@ public MapLiteral(LiteralExpr... exprs) throws AnalysisException {
Type keyType = Type.NULL;
Type valueType = Type.NULL;
children = new ArrayList<>();
- int idx = 0;
- // TODO(xy): limit key type to scalar type
- for (LiteralExpr expr : exprs) {
- if (idx % 2 == 0) {
- if (keyType == Type.NULL) {
- keyType = expr.getType();
- } else {
- keyType = Type.getAssignmentCompatibleType(keyType, expr.getType(), true);
- }
- if (keyType == Type.INVALID) {
- throw new AnalysisException("Invalid element type in Map");
- }
- } else {
- if (valueType == Type.NULL) {
- valueType = expr.getType();
- } else {
- valueType = Type.getAssignmentCompatibleType(valueType, expr.getType(), true);
- }
- if (valueType == Type.INVALID) {
- throw new AnalysisException("Invalid element type in Map");
- }
+ for (int idx = 0; idx < exprs.length && idx + 1 < exprs.length; idx += 2) {
+ // limit key type to scalar type
+ keyType = Type.getAssignmentCompatibleType(keyType, exprs[idx].getType(), true);
+ if (keyType == Type.INVALID || !keyType.isScalarType()) {
+ throw new AnalysisException("Invalid key type in Map Only support scalar type");
Review Comment:
1、Put this error outside the loop.
2、When the exprs are all scala types, this error may still be thrown.
3、Types such as float、double、bitmap、hll are also scala type but shouldn't be key type.
4、Users may be don't know what is `scala type`. Use actual type in msg.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] amorynan commented on pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "amorynan (via GitHub)" <gi...@apache.org>.
amorynan commented on PR #16948:
URL: https://github.com/apache/doris/pull/16948#issuecomment-1438375396
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #16948: [Improve](map-type) Add contains_null for map
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16948:
URL: https://github.com/apache/doris/pull/16948#issuecomment-1441301392
clang-tidy review says "All clean, LGTM! :+1:"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org