Permalink
Browse files

Merge pull request #2107 from ghalliday/nullconstant

Common up null datasets with minor differences

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
  • Loading branch information...
2 parents d184bb0 + de332a3 commit 1dfd45fbb2bbe37a4c41741915326300adb80994 @richardkchapman richardkchapman committed Apr 18, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 ecl/hql/hqlfold.cpp
View
@@ -3950,6 +3950,15 @@ static bool isWorthPercolating(const HqlExprArray & exprs)
}
+bool expressionsEquivalent(IHqlExpression * left, IHqlExpression * right)
+{
+ if (left->queryBody() == right->queryBody())
+ return true;
+ if ((left->getOperator() == no_null) && (right->getOperator() == no_null))
+ return recordTypesMatch(left, right);
+ return false;
+}
+
class HqlConstantPercolator : public CInterface
{
public:
@@ -4012,7 +4021,7 @@ class HqlConstantPercolator : public CInterface
ForEachItemInRev(i, targets)
{
unsigned match = other->targets.find(targets.item(i));
- if ((match == NotFound) || (sources.item(i).queryBody() != other->sources.item(match).queryBody()))
+ if ((match == NotFound) || !expressionsEquivalent(&sources.item(i), &other->sources.item(match)))
{
sources.remove(i);
targets.remove(i);
@@ -4841,6 +4850,7 @@ IHqlExpression * CExprFolderTransformer::percolateConstants(IHqlExpression * exp
{
updated.setown(percolateConstants(updated, child, no_left));
updated.setown(percolateConstants(updated, rhs, no_right, 2));
+ //MORE: Could also replace intersection of rhs constants with a NULL row
}
else if ((joinKind == rightonlyAtom) || (joinKind == rightouterAtom))
{

0 comments on commit 1dfd45f

Please sign in to comment.