[GitHub] [calcite] NobiGo commented on a change in pull request #2559: [CALCITE-4822] Add functions ARRAY_CONCAT, ARRAY_REVERSE, ARRAY_LENGT…
NobiGo commented on a change in pull request #2559: URL: https://github.com/apache/calcite/pull/2559#discussion_r737959127 ## File path: core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java ## @@ -2657,6 +2664,38 @@ private static RelDataType nullifyType(JavaTypeFactory typeFactory, } } + /** Implementor for a array concat. */ + private static class ArrayConcatImplementor extends AbstractRexCallImplementor { + +ArrayConcatImplementor() { + super(NullPolicy.STRICT, false); +} + +@Override String getVariableName() { + return "array_concat"; +} + +@Override Expression implementSafe(RexToLixTranslator translator, RexCall call, +List argValueList) { + final BlockBuilder blockBuilder = translator.getBlockBuilder(); + final Expression list = + blockBuilder.append("list", Expressions.new_(ArrayList.class), false); + final Expression nullValue = Expressions.constant(null); Review comment: nullValue can be replced by "NULL_EXPR" -- 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-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [calcite] NobiGo commented on a change in pull request #2559: [CALCITE-4822] Add functions ARRAY_CONCAT, ARRAY_REVERSE, ARRAY_LENGT…
NobiGo commented on a change in pull request #2559: URL: https://github.com/apache/calcite/pull/2559#discussion_r737958944 ## File path: core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java ## @@ -2657,6 +2664,38 @@ private static RelDataType nullifyType(JavaTypeFactory typeFactory, } } + /** Implementor for a array concat. */ + private static class ArrayConcatImplementor extends AbstractRexCallImplementor { + +ArrayConcatImplementor() { + super(NullPolicy.STRICT, false); +} + +@Override String getVariableName() { + return "array_concat"; +} + +@Override Expression implementSafe(RexToLixTranslator translator, RexCall call, +List argValueList) { + final BlockBuilder blockBuilder = translator.getBlockBuilder(); + final Expression list = + blockBuilder.append("list", Expressions.new_(ArrayList.class), false); Review comment: +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-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [calcite] NobiGo commented on a change in pull request #2559: [CALCITE-4822] Add functions ARRAY_CONCAT, ARRAY_REVERSE, ARRAY_LENGT…
NobiGo commented on a change in pull request #2559: URL: https://github.com/apache/calcite/pull/2559#discussion_r737958837 ## File path: site/_docs/reference.md ## @@ -2513,6 +2513,9 @@ semantics. | C | Operator syntax| Description |:- |:---|:--- | p | expr :: type | Casts *expr* to *type* +| b | ARRAY_CONCAT(array [, array ]*)| Concatenates one or more arrays. If any input argument is `NULL` the function returns `NULL` Review comment: Thanks for your reply. +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-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [calcite] NobiGo commented on a change in pull request #2559: [CALCITE-4822] Add functions ARRAY_CONCAT, ARRAY_REVERSE, ARRAY_LENGT…
NobiGo commented on a change in pull request #2559: URL: https://github.com/apache/calcite/pull/2559#discussion_r736998286 ## File path: site/_docs/reference.md ## @@ -2513,6 +2513,9 @@ semantics. | C | Operator syntax| Description |:- |:---|:--- | p | expr :: type | Casts *expr* to *type* +| b | ARRAY_CONCAT(array [, array ]*)| Concatenates one or more arrays. If any input argument is `NULL` the function returns `NULL` Review comment: If any input argument is `NULL` the function returns `NULL`? According test in SqlOperatorBaseTest. The test return value is different. Or did I misunderstand? ## File path: core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java ## @@ -2657,6 +2664,38 @@ private static RelDataType nullifyType(JavaTypeFactory typeFactory, } } + /** Implementor for a array concat. */ + private static class ArrayConcatImplementor extends AbstractRexCallImplementor { + +ArrayConcatImplementor() { + super(NullPolicy.STRICT, false); +} + +@Override String getVariableName() { + return "array_concat"; +} + +@Override Expression implementSafe(RexToLixTranslator translator, RexCall call, +List argValueList) { + final BlockBuilder blockBuilder = translator.getBlockBuilder(); + final Expression list = + blockBuilder.append("list", Expressions.new_(ArrayList.class), false); Review comment: If you try to initialize ArrayList. Expressions.assign() is more suitable. -- 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-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org