This is an automated email from the ASF dual-hosted git repository.
rongr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 23c1e5f3a5 [bugfix] fix literal query return multiple duplicate
results (#12240)
23c1e5f3a5 is described below
commit 23c1e5f3a59af008f209ca4b2921a0e0be29ce3b
Author: Rong Rong <[email protected]>
AuthorDate: Mon Jan 8 11:37:42 2024 -0800
[bugfix] fix literal query return multiple duplicate results (#12240)
Co-authored-by: Rong Rong <[email protected]>
---
.../src/test/resources/queries/LiteralEvaluationPlans.json | 9 +++++++++
.../pinot/query/runtime/operator/LiteralValueOperator.java | 3 ++-
pinot-query-runtime/src/test/resources/queries/BasicQuery.json | 4 ++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git
a/pinot-query-planner/src/test/resources/queries/LiteralEvaluationPlans.json
b/pinot-query-planner/src/test/resources/queries/LiteralEvaluationPlans.json
index 71793c7823..902648f1cc 100644
--- a/pinot-query-planner/src/test/resources/queries/LiteralEvaluationPlans.json
+++ b/pinot-query-planner/src/test/resources/queries/LiteralEvaluationPlans.json
@@ -1,6 +1,15 @@
{
"literal_evaluation_tests": {
"queries": [
+ {
+ "description": "Select without from",
+ "sql": "EXPLAIN PLAN FOR SELECT 1",
+ "output": [
+ "Execution Plan",
+ "\nLogicalValues(tuples=[[{ 1 }]])",
+ "\n"
+ ]
+ },
{
"description": "Select arithmetic expression",
"sql": "EXPLAIN PLAN FOR SELECT 5*6,5+6 FROM d",
diff --git
a/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/LiteralValueOperator.java
b/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/LiteralValueOperator.java
index 59aeec3e75..ad0cf2a129 100644
---
a/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/LiteralValueOperator.java
+++
b/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/LiteralValueOperator.java
@@ -45,7 +45,8 @@ public class LiteralValueOperator extends MultiStageOperator {
super(context);
_dataSchema = dataSchema;
_rexLiteralBlock = constructBlock(rexLiteralRows);
- _isLiteralBlockReturned = false;
+ // only return a single literal block when it is the 1st virtual server.
otherwise, result will be duplicated.
+ _isLiteralBlockReturned = context.getId().getVirtualServerId() != 0;
}
@Override
diff --git a/pinot-query-runtime/src/test/resources/queries/BasicQuery.json
b/pinot-query-runtime/src/test/resources/queries/BasicQuery.json
index 3348a7a856..eb8e8d53d6 100644
--- a/pinot-query-runtime/src/test/resources/queries/BasicQuery.json
+++ b/pinot-query-runtime/src/test/resources/queries/BasicQuery.json
@@ -16,6 +16,10 @@
{
"description": "basic test case example",
"sql": "SELECT * FROM {tbl}"
+ },
+ {
+ "description": "basic test with literal",
+ "sql": "SELECT 1 AS int, CAST(2 AS DOUBLE) AS double"
}
]
},
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]