6.7 xpack-sql throws "Rule execution limit %d reached"

ERROR:

{
  "error": {
    "root_cause": [
      {
        "type": "rule_execution_exception",
        "reason": "Rule execution limit %d reached"
      }
    ],
    "type": "rule_execution_exception",
    "reason": "Rule execution limit %d reached"
  },
  "status": 500
}

My query:

GET _xpack/sql
{

"query": """

select

sum(l_extendedprice * (1 - l_discount) ) as revenue

from

lineitem_join_test

where

(

part.p_brand = 'BRAND1'

and part.p_container = 'SM CASE'

and l_quantity >= 10 and l_quantity <= 20

and part.p_size between 1 and 5

and l_shipmode = 'AIR'

and l_shipinstruct = 'DELIVER IN PERSON'

)

or

(

part.p_brand = 'BRAND2'

and part.p_container = 'MED BAG'

and l_quantity >= 10 and l_quantity <= 30

and part.p_size between 1 and 10

and l_shipmode = 'AIR'

and l_shipinstruct = 'DELIVER IN PERSON'

)

or

(

part.p_brand = 'BRAND3'

and part.p_container = 'LG CASE'

and l_quantity >= 20 and l_quantity <= 30

and part.p_size between 1 and 15

and l_shipmode = 'AIR'

and l_shipinstruct = 'DELIVER IN PERSON'

)

"""

}

There is no actual docs in this index, just an empty one.

  • index mapping:
PUT lineitem_join_test

{

    "aliases": {},

    "mappings": {

      "_doc": {

        "properties": {

          "l_comment": {

            "type": "text"

          },

          "l_commitdate": {

            "type": "date",

            "format": "yyyy-MM-dd"

          },

          "l_discount": {

            "type": "scaled_float",

            "scaling_factor": 100

          },

          "l_extendedprice": {

            "type": "scaled_float",

            "scaling_factor": 100

          },

          "l_linenumber": {

            "type": "keyword"

          },

          "l_linestatus": {

            "type": "keyword"

          },

          "l_orderkey": {

            "type": "keyword"

          },

          "l_partkey": {

            "type": "keyword"

          },

          "l_quantity": {

            "type": "long"

          },

          "l_receiptdate": {

            "type": "date",

            "format": "yyyy-MM-dd"

          },

          "l_returnflag": {

            "type": "keyword"

          },

          "l_shipdate": {

            "type": "date",

            "format": "yyyy-MM-dd"

          },

          "l_shipinstruct": {

            "type": "keyword"

          },

          "l_shipmode": {

            "type": "keyword"

          },

          "l_suppkey": {

            "type": "keyword"

          },

          "l_tax": {

            "type": "scaled_float",

            "scaling_factor": 100

          },

          "part": {

            "type": "nested",

            "properties": {

              "p_brand": {

                "type": "keyword"

              },

              "p_comment": {

                "type": "text"

              },

              "p_container": {

                "type": "keyword"

              },

              "p_mfgr": {

                "type": "keyword"

              },

              "p_name": {

                "type": "keyword"

              },

              "p_partkey": {

                "type": "keyword"

              },

              "p_retailprice": {

                "type": "scaled_float",

                "scaling_factor": 100

              },

              "p_size": {

                "type": "long"

              },

              "p_type": {

                "type": "keyword"

              }

            }

          }

        }

      }

    },

    "settings": {

      "index": {

        "refresh_interval": "-1",

        "number_of_shards": "128",

        "translog": {

          "flush_threshold_size": "2gb",

          "sync_interval": "100s",

          "durability": "async"

        },

        "merge": {

          "scheduler": {

            "max_thread_count": "15"

          },

          "policy": {

            "max_merged_segment": "256M"

          }

        },

        "number_of_replicas": "0"

      }

    }

  }

I remember in 6.3.2 version, this sql query will directly cause OOM in coordinating node. Now in
6.7.0, sql is already a GA feature, but this query still cannot run normally.

If translated into dsl, it's just a simple OR query.

reached words limitation.

ES-DSL:

GET lineitem/_search
{
  "size": 0,
  "query":{
    "bool": {
      "should": [
       {
        "bool": {
           "filter": [
            {
              "nested": {
                "path": "part",
                "query": {
                  "term": {
                    "part.p_brand": "BRAND1" #以实际为准
                  }
                }
              }
            },
            {
              "nested": {
                "path": "part",
                "query": {
                  "terms": {
                    "part.p_container": ["SM CASE", "SM BOX", "SM PACK", "SM PKG"]
                  }
                }
              }
            },
            {
              "nested": {
                "path": "part",
                "query": {
                  "range": {
                    "part.p_size": {
                      "gte": 1,
                      "lte": 5
                    }
                  }
                }
              }
            },
            {
              "range": {
                "l_quantity": {
                  "gte": 10, #以实际为准
                  "lte": 20
                }
              }
            },
            {
              "terms": {
                "l_shipmode": ["AIR", "AIR REG"]
              }
            },
            {
              "term": {
                "l_shipinstruct": "DELIVER IN PERSON"
              }
            }
          ]
        }
      },
       {
        "bool": {
           "filter": [
            {
              "nested": {
                "path": "part",
                "query": {
                  "term": {
                    "part.p_brand": "BRAND2"  #以实际为准
                  }
                }
              }
            },
            {
              "nested": {
                "path": "part",
                "query": {
                  "terms": {
                    "part.p_container": ["MED BAG", "MED BOX", "MED PKG", "MED PACK"]
                  }
                }
              }
            },
            {
              "nested": {
                "path": "part",
                "query": {
                  "range": {
                    "part.p_size": {
                      "gte": 1,
                      "lte": 10
                    }
                  }
                }
              }
            },
            {
              "range": {
                "l_quantity": {
                  "gte": 20, #以实际为准
                  "lte": 30
                }
              }
            },
            {
              "terms": {
                "l_shipmode": ["AIR", "AIR REG"]
              }
            },
            {
              "term": {
                "l_shipinstruct": "DELIVER IN PERSON"
              }
            }
          ]
        }
      },
       {
        "bool": {
           "filter": [
            {
              "nested": {
                "path": "part",
                "query": {
                  "term": {
                    "part.p_brand": "BRAND3"  #以实际为准
                  }
                }
              }
            },
            {
              "nested": {
                "path": "part",
                "query": {
                  "terms": {
                    "part.p_container": ["LG CASE", "LG BOX", "LG PACK", "LG PKG"]
                  }
                }
              }
            },
            {
              "nested": {
                "path": "part",
                "query": {
                  "range": {
                    "part.p_size": {
                      "gte": 1,
                      "lte": 15
                    }
                  }
                }
              }
            },
            {
              "range": {
                "l_quantity": {
                  "gte": 30, #以实际为准
                  "lte": 40
                }
              }
            },
            {
              "terms": {
                "l_shipmode": ["AIR", "AIR REG"]
              }
            },
            {
              "term": {
                "l_shipinstruct": "DELIVER IN PERSON"
              }
            }
          ]
        }
      }
      ],
      "minimum_should_match" : 1
    }
  },
  "aggs": {
    "revenue": {
      "sum": {
        "script": {
          "source": "doc['l_extendedprice'].value * (1 - doc['l_discount'].value)"
        }
      }
    }
  }
}

Hi @kaihong,

Thank you for bringing up this issue.
I would, also, appreciate if next time you post here to format the code, please. I edited you two message and formatted them.

Regarding the issue itself, I've created a github issue to look into it: https://github.com/elastic/elasticsearch/issues/40835

Truly sorry for this bad formatting, I'm new here and still not so familiar with this editor, thank you so much for your time. I'll follow up this issue in github.:slightly_smiling_face:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.