Skip to content

Commit

Permalink
Merge pull request #2107 from ghalliday/nullconstant
Browse files Browse the repository at this point in the history
Common up null datasets with minor differences

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
  • Loading branch information
richardkchapman committed Apr 18, 2012
2 parents d184bb0 + de332a3 commit 1dfd45f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ecl/hql/hqlfold.cpp
Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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))
{
Expand Down

0 comments on commit 1dfd45f

Please sign in to comment.