>From Peeyush Gupta <[email protected]>: Peeyush Gupta has submitted this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20527?usp=email )
Change subject: [ASTERIXDB-3649][*DB] Improve async request API ...................................................................... [ASTERIXDB-3649][*DB] Improve async request API - user model changes: no - storage format changes: no - interface changes: no Details: Add a field to denote if the partitions returned as part of the status should be read in order. Ext-ref: MB-60882 Change-Id: If32b1020c41e7d70e2af07275b4f6f9beb8ad184 Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20527 Integration-Tests: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Reviewed-by: Ali Alsuliman <[email protected]> --- M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/ResultMetadata.java M asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryStatusApiServlet.java M asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/JobResultCallback.java M asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/fields/PartitionInfoPrinter.java A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.4.ddl.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.5.update.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.6.async.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.7.pollget.http A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.8.get.http M asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-exhausted-result/async-exhausted-result.2.regexjson M asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-json/async-json.2.regexjson A asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-json/async-json.6.ignore A asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-json/async-json.7.regexjson A asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-json/async-json.8.json M asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-repeated/async-repeated.2.regexjson M asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-running/async-running.3.regexjson M asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async/async.2.regexjson M hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/AbstractExchangePOperator.java M hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/AbstractRangeExchangePOperator.java M hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/PartialBroadcastRangeIntersectExchangePOperator.java M hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/PushNestedOrderByUnderPreSortedGroupByRule.java M hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/HyracksJobProperty.java M hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/result/ResultJobRecord.java M hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/result/ResultDirectoryService.java 24 files changed, 200 insertions(+), 8 deletions(-) Approvals: Ali Alsuliman: Looks good to me, approved Jenkins: Verified; Verified diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/ResultMetadata.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/ResultMetadata.java index de6026b..66b2503 100644 --- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/ResultMetadata.java +++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/ResultMetadata.java @@ -47,6 +47,7 @@ private long compileTime; private long createTime; private long endTime; + private boolean resultSetOrdered; public ResultMetadata(SessionConfig.OutputFormat format) { this.format = format; @@ -194,6 +195,14 @@ this.endTime = endTime; } + public boolean isResultSetOrdered() { + return resultSetOrdered; + } + + public void setResultSetOrdered(boolean resultSetOrdered) { + this.resultSetOrdered = resultSetOrdered; + } + @Override public String toString() { return "ResultMetadata{" + "format=" + format + ", jobDuration=" + jobDuration + ", processedObjects=" diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryStatusApiServlet.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryStatusApiServlet.java index 52597ad..9052f8f 100644 --- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryStatusApiServlet.java +++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryStatusApiServlet.java @@ -110,10 +110,11 @@ } printer.addResultPrinter(new ResultHandlePrinter(resHandle)); if (uriMode) { + ResultMetadata metadata = (ResultMetadata) resultReader.getMetadata(); printer.addResultPrinter(new ResultCountPrinter( ((ResultMetadata) (resultReader.getResultSetReader().getResultMetadata())).getResultCount())); - printer.addResultPrinter( - new PartitionInfoPrinter(resultReader.getResultSetReader().getResultRecords(), resHandle)); + printer.addResultPrinter(new PartitionInfoPrinter(resultReader.getResultSetReader().getResultRecords(), + resHandle, metadata.isResultSetOrdered())); } } diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/JobResultCallback.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/JobResultCallback.java index a941100..6e25be4 100644 --- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/JobResultCallback.java +++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/JobResultCallback.java @@ -67,6 +67,7 @@ final ResultMetadata metadata = (ResultMetadata) resultSetMetaData.getMetadata(); metadata.setJobDuration(resultJobRecord.getJobDuration()); metadata.setResultCount(resultJobRecord.getResultCount()); + metadata.setResultSetOrdered(resultJobRecord.isResultSetOrdered()); aggregateJobStats(jobId, metadata); } diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/fields/PartitionInfoPrinter.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/fields/PartitionInfoPrinter.java index 8e8d7f2..194f33e 100644 --- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/fields/PartitionInfoPrinter.java +++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/fields/PartitionInfoPrinter.java @@ -29,13 +29,16 @@ public static final String FIELD_NAME = "partitions"; public static final String HANDLE_FIELD_NAME = "handle"; public static final String RESULT_COUNT_FIELD_NAME = "resultCount"; + public static final String RESULTSET_ORDERED_FIELD_NAME = "resultSetOrdered"; private final ResultDirectoryRecord[] resultRecords; private final String handlePrefix; + private final boolean resultSetOrdered; - public PartitionInfoPrinter(ResultDirectoryRecord[] resultRecords, String handlePrefix) { + public PartitionInfoPrinter(ResultDirectoryRecord[] resultRecords, String handlePrefix, boolean resultSetOrdered) { this.resultRecords = resultRecords; this.handlePrefix = handlePrefix; + this.resultSetOrdered = resultSetOrdered; } @Override @@ -54,7 +57,9 @@ pw.print(","); } } - pw.print("]"); + pw.print("],"); + pw.print("\n\t"); + ResultUtil.printField(pw, RESULTSET_ORDERED_FIELD_NAME, resultSetOrdered, false); } @Override diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.4.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.4.ddl.sqlpp new file mode 100644 index 0000000..b0d22c2 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.4.ddl.sqlpp @@ -0,0 +1,32 @@ +/* + * 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. + */ + +drop dataverse test if exists; +create dataverse test; + +use test; + +create type TestType as + closed { + id : integer, + val : double +}; + +create dataset Test(TestType) primary key id; + diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.5.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.5.update.sqlpp new file mode 100644 index 0000000..31abd48 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.5.update.sqlpp @@ -0,0 +1,28 @@ +/* + * 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. + */ + +use test; + +UPSERT INTO Test { "id": 1, "val": 2.5 }; + +UPSERT INTO Test { "id": 2, "val": 3.5 }; + +UPSERT INTO Test { "id": 3, "val": 4.5 }; + +UPSERT INTO Test { "id": 4, "val": 5.5 }; diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.6.async.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.6.async.sqlpp new file mode 100644 index 0000000..32ad877 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.6.async.sqlpp @@ -0,0 +1,23 @@ +/* + * 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. + */ +-- handlevariable=status + +use test; +SET `compiler.sort.parallel` "true"; +Select * from Test order by val; diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.7.pollget.http b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.7.pollget.http new file mode 100644 index 0000000..d10aed9 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.7.pollget.http @@ -0,0 +1,23 @@ +/* + * 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. + */ + +-- polltimeoutsecs=10 +-- handlevariable=result + +$status diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.8.get.http b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.8.get.http new file mode 100644 index 0000000..6496a4b --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/async-deferred-improved/async-json/async-json.8.get.http @@ -0,0 +1,20 @@ +/* + * 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. + */ +-- extractresult=true +$result diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-exhausted-result/async-exhausted-result.2.regexjson b/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-exhausted-result/async-exhausted-result.2.regexjson index 0ed7a67..fbcb2c6 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-exhausted-result/async-exhausted-result.2.regexjson +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-exhausted-result/async-exhausted-result.2.regexjson @@ -3,6 +3,7 @@ "handle": "R{.*}", "resultCount": 10, "partitions": "R{.*}", + "resultSetOrdered": false, "metrics": "R{.*}", "createdAt": "R{.*}" } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-json/async-json.2.regexjson b/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-json/async-json.2.regexjson index c6c829b..a967c36 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-json/async-json.2.regexjson +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-json/async-json.2.regexjson @@ -3,6 +3,7 @@ "handle": "R{.*}", "resultCount": 5, "partitions": "R{.*}", + "resultSetOrdered": false, "metrics": "R{.*}", "createdAt": "R{.*}" } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-json/async-json.6.ignore b/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-json/async-json.6.ignore new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-json/async-json.6.ignore diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-json/async-json.7.regexjson b/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-json/async-json.7.regexjson new file mode 100644 index 0000000..3d4a86c --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-json/async-json.7.regexjson @@ -0,0 +1,9 @@ +{ + "status":"success", + "handle": "R{.*}", + "resultCount": 4, + "partitions": "R{.*}", + "resultSetOrdered": true, + "metrics": "R{.*}", + "createdAt": "R{.*}" +} \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-json/async-json.8.json b/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-json/async-json.8.json new file mode 100644 index 0000000..5ca6c1e --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-json/async-json.8.json @@ -0,0 +1,4 @@ +{ "Test": { "id": 1, "val": 2.5 } } +{ "Test": { "id": 2, "val": 3.5 } } +{ "Test": { "id": 3, "val": 4.5 } } +{ "Test": { "id": 4, "val": 5.5 } } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-repeated/async-repeated.2.regexjson b/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-repeated/async-repeated.2.regexjson index 0ed7a67..fbcb2c6 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-repeated/async-repeated.2.regexjson +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-repeated/async-repeated.2.regexjson @@ -3,6 +3,7 @@ "handle": "R{.*}", "resultCount": 10, "partitions": "R{.*}", + "resultSetOrdered": false, "metrics": "R{.*}", "createdAt": "R{.*}" } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-running/async-running.3.regexjson b/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-running/async-running.3.regexjson index 9e724fd..bc20bf9 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-running/async-running.3.regexjson +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async-running/async-running.3.regexjson @@ -3,6 +3,7 @@ "handle": "R{.*}", "resultCount": 1, "partitions": "R{.*}", + "resultSetOrdered": false, "metrics": "R{.*}", "createdAt": "R{.*}" } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async/async.2.regexjson b/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async/async.2.regexjson index 0ed7a67..fbcb2c6 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async/async.2.regexjson +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/async-deferred-improved/async/async.2.regexjson @@ -3,6 +3,7 @@ "handle": "R{.*}", "resultCount": 10, "partitions": "R{.*}", + "resultSetOrdered": false, "metrics": "R{.*}", "createdAt": "R{.*}" } \ No newline at end of file diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/AbstractExchangePOperator.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/AbstractExchangePOperator.java index 6f8d5e9..c844f31 100644 --- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/AbstractExchangePOperator.java +++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/AbstractExchangePOperator.java @@ -27,6 +27,7 @@ import org.apache.hyracks.algebricks.core.jobgen.impl.JobGenContext; import org.apache.hyracks.api.dataflow.IConnectorDescriptor; import org.apache.hyracks.api.job.IConnectorDescriptorRegistry; +import org.apache.hyracks.api.job.JobSpecification; public abstract class AbstractExchangePOperator extends AbstractPhysicalOperator { @Override @@ -38,6 +39,11 @@ builder.contributeConnectorWithTargetConstraint(op, connPair.first, connPair.second); ILogicalOperator src = op.getInputs().get(0).getValue(); builder.contributeGraphEdge(src, 0, op, 0); + setJobSpecAnnotation(builder.getJobSpec()); + } + + protected void setJobSpecAnnotation(JobSpecification spec) { + // No-op } @Override diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/AbstractRangeExchangePOperator.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/AbstractRangeExchangePOperator.java index 53f3aaf..03a49cf 100644 --- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/AbstractRangeExchangePOperator.java +++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/AbstractRangeExchangePOperator.java @@ -36,6 +36,8 @@ import org.apache.hyracks.algebricks.data.INormalizedKeyComputerFactoryProvider; import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; import org.apache.hyracks.api.dataflow.value.INormalizedKeyComputerFactory; +import org.apache.hyracks.api.job.HyracksJobProperty; +import org.apache.hyracks.api.job.JobSpecification; import org.apache.hyracks.dataflow.common.data.partition.range.DynamicRangeMapSupplier; import org.apache.hyracks.dataflow.common.data.partition.range.RangeMap; import org.apache.hyracks.dataflow.common.data.partition.range.RangeMapSupplier; @@ -132,4 +134,9 @@ } return new Triple<>(sortFields, comps, nkcf); } + + @Override + protected void setJobSpecAnnotation(JobSpecification spec) { + spec.setProperty(HyracksJobProperty.RESULT_SET_ORDERED, true); + } } diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/PartialBroadcastRangeIntersectExchangePOperator.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/PartialBroadcastRangeIntersectExchangePOperator.java index 4097101..e9de45f 100644 --- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/PartialBroadcastRangeIntersectExchangePOperator.java +++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/PartialBroadcastRangeIntersectExchangePOperator.java @@ -46,7 +46,9 @@ import org.apache.hyracks.api.dataflow.IConnectorDescriptor; import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; import org.apache.hyracks.api.dataflow.value.ITupleMultiPartitionComputerFactory; +import org.apache.hyracks.api.job.HyracksJobProperty; import org.apache.hyracks.api.job.IConnectorDescriptorRegistry; +import org.apache.hyracks.api.job.JobSpecification; import org.apache.hyracks.dataflow.common.data.partition.range.FieldRangeIntersectPartitionComputerFactory; import org.apache.hyracks.dataflow.common.data.partition.range.RangeMap; import org.apache.hyracks.dataflow.common.data.partition.range.StaticRangeMapSupplier; @@ -137,6 +139,11 @@ } @Override + protected void setJobSpecAnnotation(JobSpecification spec) { + spec.setProperty(HyracksJobProperty.RESULT_SET_ORDERED, true); + } + + @Override public String toString() { return getOperatorTag().toString() + " " + intervalFields + (rangeMap != null ? " RANGE_MAP:" + rangeMap : ""); } diff --git a/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/PushNestedOrderByUnderPreSortedGroupByRule.java b/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/PushNestedOrderByUnderPreSortedGroupByRule.java index 344e103..db855b3 100644 --- a/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/PushNestedOrderByUnderPreSortedGroupByRule.java +++ b/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/PushNestedOrderByUnderPreSortedGroupByRule.java @@ -114,7 +114,7 @@ // ++k; } // sort2.setSortColumns(sortColumns); - sort2.computeDeliveredProperties(order2, null); + sort2.computeDeliveredProperties(order2, context); // remove order1 ILogicalOperator underOrder1 = order1.getInputs().get(0).getValue(); opRef2.setValue(underOrder1); diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/HyracksJobProperty.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/HyracksJobProperty.java index d8bf5cb..5d6075f 100644 --- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/HyracksJobProperty.java +++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/HyracksJobProperty.java @@ -19,5 +19,6 @@ package org.apache.hyracks.api.job; public enum HyracksJobProperty implements IJobProperty { - JOB_KIND + JOB_KIND, + RESULT_SET_ORDERED } diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/result/ResultJobRecord.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/result/ResultJobRecord.java index edda92f..dd568d0 100644 --- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/result/ResultJobRecord.java +++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/result/ResultJobRecord.java @@ -87,11 +87,13 @@ private ResultSetId rsId; private ResultSetMetaData resultSetMetaData; private long resultCount; + private boolean resultSetOrdered; - public ResultJobRecord() { + public ResultJobRecord(boolean resultSetOrdered) { this.timestamp = System.nanoTime(); this.status = new Status(); this.resultCount = 0; + this.resultSetOrdered = resultSetOrdered; } private void updateState(State newStatus) { @@ -149,6 +151,10 @@ return status; } + public boolean isResultSetOrdered() { + return resultSetOrdered; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/result/ResultDirectoryService.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/result/ResultDirectoryService.java index 6a1d28f..f61bafc 100644 --- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/result/ResultDirectoryService.java +++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/result/ResultDirectoryService.java @@ -31,6 +31,7 @@ import org.apache.hyracks.api.exceptions.ErrorCode; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.exceptions.HyracksException; +import org.apache.hyracks.api.job.HyracksJobProperty; import org.apache.hyracks.api.job.JobId; import org.apache.hyracks.api.job.JobSpecification; import org.apache.hyracks.api.job.JobStatus; @@ -83,7 +84,11 @@ if (jobResultLocations.get(jobId) != null) { throw HyracksDataException.create(ErrorCode.MORE_THAN_ONE_RESULT, jobId); } - jobResultLocations.put(jobId, new JobResultInfo(new ResultJobRecord(), null)); + Boolean partitionsOrdered = (Boolean) spec.getProperty(HyracksJobProperty.RESULT_SET_ORDERED); + if (partitionsOrdered == null) { + partitionsOrdered = false; + } + jobResultLocations.put(jobId, new JobResultInfo(new ResultJobRecord(partitionsOrdered), null)); } @Override -- To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20527?usp=email To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: asterixdb Gerrit-Branch: phoenix Gerrit-Change-Id: If32b1020c41e7d70e2af07275b4f6f9beb8ad184 Gerrit-Change-Number: 20527 Gerrit-PatchSet: 5 Gerrit-Owner: Peeyush Gupta <[email protected]> Gerrit-Reviewer: Ali Alsuliman <[email protected]> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Murtadha Hubail <[email protected]> Gerrit-Reviewer: Peeyush Gupta <[email protected]>
