FgForrest / evitaDB

evitaDB is a specialized database with an easy-to-use API for e-commerce systems. It is a low-latency NoSQL in-memory engine that handles all the complex tasks that e-commerce systems have to deal with on a daily basis. evitaDB is expected to act as a fast secondary lookup/search index used by front stores.
https://evitadb.io
Other
62 stars 7 forks source link

Compute was not yet called on price termination formula, this is not expected! #460

Closed novoj closed 9 months ago

novoj commented 9 months ago

Valid query produces this error:

{
  "data": null,
  "errors": [
    {
      "message": "Compute was not yet called on price termination formula, this is not expected!",
      "locations": [
        {
          "line": 2,
          "column": 464,
          "sourceName": null
        }
      ],
      "path": [
        "queryProduct"
      ],
      "extensions": {
        "errorCode": "897f068d2c8d52f22b7472294a23cf19:3ac10e4c1e0245eefed6b3cb73410c70:88"
      }
    }
  ]
}

Link to query in evitaLab

novoj commented 9 months ago

The query is exactly:

query(
    collection('Product'),
    filterBy(
        entityPrimaryKeyInSet(125319, 125320, 741, 748, 755, 235132, 699, 67627),
        userFilter(
            priceBetween(194, 500)
        ),
        entityLocaleEquals('cs'),
        attributeInSet('productType', 'BASIC', 'SET', 'MASTER'),
        attributeEquals('status', 'ACTIVE'),
        priceInCurrency('CZK'),
        priceInPriceLists('jko-cenik-registrovani', 'jko-cenik-vsichni', 'basic', 'reference', 'stanardni-cenik1', 'dalsi-novy-cenik'),
        priceValidInNow(),
        referenceHaving(
            'stockVisibilities',
            entityHaving(
                attributeInSet('code', 'moda', 'moda-sklad-2', 'moda-sklad-3')
            )
        )
    ),
    orderBy(
        priceNatural(DESC)
    ),
    require(
        priceType(WITH_TAX),
        page(1, 20),
        entityFetch(
            attributeContent('minOrderQuantity', 'rating', 'relatedFiles', 'name', 'availability', 'descriptionShort', 'productType', 'ratingVotes', 'url'),
            priceContentAll(),
            referenceContentWithAttributes(
                'stocks',
                attributeContent('quantityOnStock'),
                entityFetch(
                    attributeContent('code', 'name'),
                    dataInLocales('cs')
                )
            ),
            referenceContent(
                'tags',
                entityFetch(
                    attributeContent('isVisibleInDetail', 'isVisibleInListing', 'isVisibleInFilter', 'code', 'name'),
                    dataInLocales('cs')
                )
            ),
            referenceContent(
                'parameterValues',
                filterBy(
                    attributeEquals('variant', true)
                ),
                entityFetch(
                    attributeContent('code', 'order', 'name'),
                    referenceContentWithAttributes(
                        'parameter',
                        attributeContent('orderInParameter'),
                        entityFetch(
                            attributeContent('code', 'isVisibleInDetail'),
                            dataInLocales('cs')
                        )
                    ),
                    dataInLocales('cs')
                )
            ),
            referenceContent('master'),
            dataInLocales('cs')
        ),
        attributeHistogram(20, STANDARD, 'delka'),
        priceHistogram(20, STANDARD),
        facetSummaryOfReference(
            'brand',
            IMPACT,
            entityFetch(
                attributeContent('code', 'name'),
                dataInLocales('cs')
            )
        ),
        facetSummaryOfReference(
            'stocks',
            IMPACT,
            entityFetch(
                attributeContent('code', 'name'),
                dataInLocales('cs')
            )
        ),
        facetSummaryOfReference(
            'parameterValues',
            IMPACT,
            filterGroupBy(
                attributeEquals('isVisibleInFilter', true)
            ),
            entityFetch(
                attributeContent('code', 'basicUnitValue', 'name'),
                dataInLocales('cs')
            ),
            entityGroupFetch(
                attributeContent('code', 'description', 'name'),
                dataInLocales('cs')
            )
        ),
        facetSummaryOfReference(
            'tags',
            IMPACT,
            filterBy(
                attributeEquals('isVisibleInFilter', true)
            ),
            entityFetch(
                attributeContent('code', 'name'),
                dataInLocales('cs')
            )
        )
    )
)
novoj commented 9 months ago

The problem is caused by following the prefetching logic evaluation path which doesn't produce the data in requested way.