Skip to content

If there is an unequal operator in the query, HQL Query Plan is regenerated #3069

Open
@cokalyoncu

Description

@cokalyoncu
CrdCardResponse crdCardResponse = Query<CrdCard>()
    .Where(x => x.CardNo == cardNo)
    .Select(x => new CrdCardResponse()
    {
        IsLimitExceed = x.Dci != CardDci.Credit.GetKey()
    }).SingleOrDefault();

Hql query plan is regenerated each time this query is run. If the query is changed in this way, hql query plan is cached.

CrdCardResponse crdCardResponse = Query<CrdCard>()
    .Where(x => x.CardNo == cardNo)
    .Select(x => new CrdCardResponse()
    {
        IsLimitExceed = x.Dci == CardDci.Credit.GetKey()
    }).SingleOrDefault();

This line in SelectClauseHqlNominator is causing this trouble:

var projectConstantsInHql = _stateStack.Peek() || expression.NodeType == ExpressionType.Equal || IsRegisteredFunction(expression);

This code should be changed like this:

var projectConstantsInHql = _stateStack.Peek() || expression.NodeType == ExpressionType.Equal || expression.NodeType == ExpressionType.NotEqual || IsRegisteredFunction(expression);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions