alex-plekhanov commented on code in PR #13467:
URL: https://github.com/apache/ignite/pull/13467#discussion_r3821512499


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/sql/IgniteSqlPaginationPolicy.java:
##########
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.query.calcite.sql;
+
+import java.math.RoundingMode;
+import org.apache.calcite.plan.Context;
+import org.apache.calcite.tools.Frameworks;
+import org.apache.ignite.internal.processors.query.calcite.util.IgniteMath;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Defines a policy for processing values of SQL pagination clauses: LIMIT, 
FETCH, and OFFSET.
+ *
+ * <p>Custom instance can be supplied through {@link 
Frameworks.ConfigBuilder#context(Context)}.</p>
+ */
+@FunctionalInterface
+public interface IgniteSqlPaginationPolicy {
+    /** Returns the rounding mode for FETCH, LIMIT and OFFSET values. */
+    RoundingMode roundingMode();
+
+    /** Rounds the given value according to the specified policy and converts 
it to {@code long}. */
+    static long convertToLongExact(Number value, @Nullable 
IgniteSqlPaginationPolicy policy) {

Review Comment:
   This method with it's logic looks a little bit weird in this interface. 
Maybe replace usage of this method to something like:
   ```
               if (pagPlc == null) 
                   IgniteMath.convertToLongExact(val);
               else 
                   IgniteMath.convertToLongExact(val, pagPlc.roundingMode());
   ```
   ?



##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/sql/IgniteSqlPaginationPolicy.java:
##########
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.query.calcite.sql;

Review Comment:
   Package `sql` related to parsed AST nodes. `prepare` or `exec` packages are 
better places for this policy



-- 
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]

Reply via email to