zstan commented on code in PR #13311:
URL: https://github.com/apache/ignite/pull/13311#discussion_r3703705121
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/LimitNode.java:
##########
@@ -85,38 +90,46 @@ public LimitNode(
/** {@inheritDoc} */
@Override public void push(Row row) throws Exception {
- if (waiting == -1)
+ if (waiting == NOT_WAITING)
return;
- ++rowsProcessed;
-
--waiting;
- checkState();
-
- if (rowsProcessed > offset) {
- if (fetchNode == null || (fetchNode != null && rowsProcessed <=
fetch + offset))
- downstream().push(row);
+ if (rowsProcessed >= offset && hasMoreData()) {
+ // this two rows can`t be swapped, cause if all requested rows
have been pushed it will trigger further request call.
Review Comment:
done
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/IgniteSqlValidator.java:
##########
@@ -241,54 +241,81 @@ private void validateTableModify(SqlNode table) {
/** {@inheritDoc} */
@Override protected void validateSelect(SqlSelect select, RelDataType
targetRowType) {
- checkIntegerLimit(select.getFetch(), "fetch / limit");
- checkIntegerLimit(select.getOffset(), "offset");
-
super.validateSelect(select, targetRowType);
- }
- /** {@inheritDoc} */
- @Override protected void validateNamespace(SqlValidatorNamespace
namespace, RelDataType targetRowType) {
- SqlValidatorTable table = namespace.getTable();
-
- if (table != null) {
- IgniteCacheTable igniteTable =
table.unwrap(IgniteCacheTable.class);
-
- if (igniteTable != null)
- igniteTable.ensureCacheStarted();
- }
-
- super.validateNamespace(namespace, targetRowType);
+ invalidateFetchOffset(select.getFetch(), "fetch / limit");
+ invalidateFetchOffset(select.getOffset(), "offset");
}
/**
- * @param n Node to check limit.
+ * Invalidate fetch/offset params restrictions.
+ *
+ * @param n Node to check limit.
* @param nodeName Node name.
*/
- private void checkIntegerLimit(SqlNode n, String nodeName) {
+ private void invalidateFetchOffset(@Nullable SqlNode n, String nodeName) {
+ if (n == null) {
Review Comment:
done
--
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]