tkalkirill commented on code in PR #5004:
URL: https://github.com/apache/calcite/pull/5004#discussion_r3602482519
##########
core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableLimit.java:
##########
@@ -106,30 +106,42 @@ public static EnumerableLimit create(final RelNode input,
@Nullable RexNode offs
v =
builder.append("offset",
Expressions.call(BuiltInMethod.SKIP_BIG_DECIMAL.method, v,
- getExpression(offset, "OFFSET", roundingPolicyExp)));
+ getExpression(offset, "OFFSET", implementor, builder,
+ roundingPolicyExp, false)));
}
if (fetch != null) {
v =
builder.append("fetch",
Expressions.call(BuiltInMethod.TAKE_BIG_DECIMAL.method, v,
- getExpression(fetch, "FETCH", roundingPolicyExp)));
+ getExpression(fetch, "FETCH", implementor, builder,
+ roundingPolicyExp, true)));
}
builder.add(Expressions.return_(null, v));
return implementor.result(physType, builder.toBlock());
}
static Expression getExpression(RexNode rexNode, String kind,
- Expression roundingPolicy) {
+ EnumerableRelImplementor implementor, BlockBuilder builder,
+ Expression roundingPolicy, boolean translateExpression) {
final Expression value;
if (rexNode instanceof RexDynamicParam) {
final RexDynamicParam param = (RexDynamicParam) rexNode;
value =
Expressions.call(DataContext.ROOT,
BuiltInMethod.DATA_CONTEXT_GET.method,
Expressions.constant("?" + param.getIndex()));
- } else {
+ } else if (rexNode instanceof RexLiteral) {
value = Expressions.constant(RexLiteral.bigDecimalValue(rexNode));
+ } else {
+ if (!translateExpression) {
Review Comment:
This is temporary until OFFSET expression support is added. Then the flag
and this check will be removed, so I would prefer to avoid refactoring it
separately.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]