Skip to content

Commit 08055cd

Browse files
committed
update
Signed-off-by: Kai Huang <ahkcs@amazon.com>
1 parent 6470b8e commit 08055cd

3 files changed

Lines changed: 16 additions & 22 deletions

File tree

core/src/main/java/org/opensearch/sql/ast/statement/Query.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import lombok.EqualsAndHashCode;
99
import lombok.Getter;
10+
import lombok.RequiredArgsConstructor;
1011
import lombok.Setter;
1112
import lombok.ToString;
1213
import org.opensearch.sql.ast.AbstractNodeVisitor;
@@ -18,18 +19,13 @@
1819
@Setter
1920
@ToString
2021
@EqualsAndHashCode(callSuper = false)
22+
@RequiredArgsConstructor
2123
public class Query extends Statement {
2224

2325
protected final UnresolvedPlan plan;
2426
protected final int fetchSize;
2527
private final QueryType queryType;
2628

27-
public Query(UnresolvedPlan plan, int fetchSize, QueryType queryType) {
28-
this.plan = plan;
29-
this.fetchSize = fetchSize;
30-
this.queryType = queryType;
31-
}
32-
3329
@Override
3430
public <R, C> R accept(AbstractNodeVisitor<R, C> visitor, C context) {
3531
return visitor.visitQuery(this, context);

core/src/main/java/org/opensearch/sql/executor/QueryService.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ public void executeWithCalcite(
100100
QueryProfiling.activate(QueryContext.isProfileEnabled());
101101
ProfileMetric analyzeMetric = profileContext.getOrCreateMetric(MetricName.ANALYZE);
102102
long analyzeStart = System.nanoTime();
103-
SysLimit sysLimit = SysLimit.fromSettings(settings);
104103
CalcitePlanContext context =
105-
CalcitePlanContext.create(buildFrameworkConfig(), sysLimit, queryType);
104+
CalcitePlanContext.create(
105+
buildFrameworkConfig(), SysLimit.fromSettings(settings), queryType);
106106
RelNode relNode = analyze(plan, context);
107107
RelNode calcitePlan = convertToCalcitePlan(relNode, context);
108108
analyzeMetric.set(System.nanoTime() - analyzeStart);
@@ -236,18 +236,16 @@ public void executePlan(
236236
.getSplit()
237237
.ifPresentOrElse(
238238
split -> executionEngine.execute(plan(plan), new ExecutionContext(split), listener),
239-
() -> {
240-
Integer effectiveLimit;
241-
if (plan instanceof LogicalPaginate) {
242-
// For pagination, querySizeLimit shouldn't take effect.
243-
// See {@link PaginationWindowIT::testQuerySizeLimitDoesNotEffectPageSize}
244-
effectiveLimit = null;
245-
} else {
246-
effectiveLimit = SysLimit.fromSettings(settings).querySizeLimit();
247-
}
248-
executionEngine.execute(
249-
plan(plan), ExecutionContext.querySizeLimit(effectiveLimit), listener);
250-
});
239+
() ->
240+
executionEngine.execute(
241+
plan(plan),
242+
ExecutionContext.querySizeLimit(
243+
// For pagination, querySizeLimit shouldn't take effect.
244+
// See {@link PaginationWindowIT::testQuerySizeLimitDoesNotEffectPageSize}
245+
plan instanceof LogicalPaginate
246+
? null
247+
: SysLimit.fromSettings(settings).querySizeLimit()),
248+
listener));
251249
} catch (Exception e) {
252250
listener.onFailure(e);
253251
}

core/src/main/java/org/opensearch/sql/executor/execution/QueryPlan.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class QueryPlan extends AbstractPlan {
2929

3030
protected final Optional<Integer> pageSize;
3131

32-
/** Constructor without page size. */
32+
/** Constructor. */
3333
public QueryPlan(
3434
QueryId queryId,
3535
QueryType queryType,
@@ -43,7 +43,7 @@ public QueryPlan(
4343
this.pageSize = Optional.empty();
4444
}
4545

46-
/** Constructor with page size (for pagination). */
46+
/** Constructor with page size. */
4747
public QueryPlan(
4848
QueryId queryId,
4949
QueryType queryType,

0 commit comments

Comments
 (0)