From 8d87978b2c90951ae2380a700dba23d567e8e930 Mon Sep 17 00:00:00 2001 From: Gavin Halliday Date: Fri, 29 Nov 2024 17:08:02 +0000 Subject: [PATCH] HPCC-33054 Codegen support KEYED JOIN where rhs may evaluate to a null dataset Signed-off-by: Gavin Halliday --- ecl/hqlcpp/hqlckey.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ecl/hqlcpp/hqlckey.cpp b/ecl/hqlcpp/hqlckey.cpp index 8f310120e0d..e0cc31c5315 100644 --- a/ecl/hqlcpp/hqlckey.cpp +++ b/ecl/hqlcpp/hqlckey.cpp @@ -310,9 +310,16 @@ IHqlExpression * queryBaseIndexForKeyedJoin(IHqlExpression * expr) IHqlExpression * left = queryBaseIndexForKeyedJoin(expr->queryChild(1)); IHqlExpression * right = queryBaseIndexForKeyedJoin(expr->queryChild(2)); if (left && right) - return left; + { + //IF (cond, index) and IF(cond, null, index) should be allowed, and will return the index + if (left->getOperator() != no_null) + return left; + return right; + } return nullptr; } + if (expr->getOperator() == no_null) + return expr; return queryPhysicalRootTable(expr); }