Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-40112

[N1QL][RQG][Flex] flex index with USING FTS,USING GSI hint returns null

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 7.0.0
    • Cheshire-Cat
    • fts
    • 7.0.0-2302
    • Untriaged
    • 1
    • Unknown

    Description

      1 bucket
      primary index on bucket
      default fts index created on the bucket (with analyzer set to keyword)

      I have this query:

      SELECT MAX( decimal_field1 ) FROM simple_table_db_25169944_simple_table WHERE (varchar_field1 BETWEEN "AGinObeWBu" and "zyByCDiiAL") AND (varchar_field1 = "aNRxXzlgWU")

      This query uses the primary index and returns:

      [

      { "$1": 4433 }

      ]

      Now if I run this query:
      SELECT MAX( decimal_field1 ) FROM simple_table_db_25169944_simple_table USE INDEX(USING FTS,USING GSI) WHERE (varchar_field1 BETWEEN "AGinObeWBu" and "zyByCDiiAL") AND (varchar_field1 = "aNRxXzlgWU")

      It uses fts default index and returns:

      [

      { "$1": null }

      ]

      Here is the document that fits the query criteria in its entirety:
      [
      {
      "simple_table_db_25169944_simple_table":

      { "bool_field1": false, "char_field1": "W", "datetime_field1": "2004-01-04 00:00:00", "decimal_field1": 4433, "int_field1": 31175533, "primary_key_id": "290", "varchar_field1": "aNRxXzlgWU" }

      }
      ]

      here is the explain plan of the broken query:

      {
          "#operator": "Sequence",
          "~children": [
              {
                  "#operator": "IndexFtsSearch",
                  "index": "default_index1",
                  "index_id": "4349fc00f170e7c3",
                  "keyspace": "simple_table_db_25169944_simple_table",
                  "namespace": "default",
                  "search_info": {
                      "field": "\"\"",
                      "options": "{\"index\": \"default_index1\"}",
                      "outname": "out",
                      "query": "{\"query\": {\"conjuncts\": [{\"field\": \"varchar_field1\", \"inclusive_max\": true, \"inclusive_min\": true, \"max\": \"zyByCDiiAL\", \"min\": \"AGinObeWBu\"}, {\"field\": \"varchar_field1\", \"term\": \"aNRxXzlgWU\"}]}, \"score\": \"none\"}"
                  },
                  "using": "fts"
              },
              {
                  "#operator": "Fetch",
                  "filter": "((\"AGinObeWBu\" <= (`simple_table_db_25169944_simple_table`.`varchar_field1`)) and ((`simple_table_db_25169944_simple_table`.`varchar_field1`) <= \"zyByCDiiAL\") and ((`simple_table_db_25169944_simple_table`.`varchar_field1`) = \"aNRxXzlgWU\") and ((`simple_table_db_25169944_simple_table`.`decimal_field1`) is not null))",
                  "keyspace": "simple_table_db_25169944_simple_table",
                  "namespace": "default"
              },
              {
                  "#operator": "Parallel",
                  "~child": {
                      "#operator": "Sequence",
                      "~children": [
                          {
                              "#operator": "Filter",
                              "condition": "((`simple_table_db_25169944_simple_table`.`varchar_field1`) between \"AGinObeWBu\" and \"zyByCDiiAL\")"
                          },
                          {
                              "#operator": "InitialGroup",
                              "aggregates": [
                                  "max((`simple_table_db_25169944_simple_table`.`decimal_field1`))"
                              ],
                              "group_keys": []
                          }
                      ]
                  }
              },
              {
                  "#operator": "IntermediateGroup",
                  "aggregates": [
                      "max((`simple_table_db_25169944_simple_table`.`decimal_field1`))"
                  ],
                  "group_keys": []
              },
              {
                  "#operator": "FinalGroup",
                  "aggregates": [
                      "max((`simple_table_db_25169944_simple_table`.`decimal_field1`))"
                  ],
                  "group_keys": []
              },
              {
                  "#operator": "Parallel",
                  "~child": {
                      "#operator": "Sequence",
                      "~children": [
                          {
                              "#operator": "InitialProject",
                              "result_terms": [
                                  {
                                      "expr": "max((`simple_table_db_25169944_simple_table`.`decimal_field1`))"
                                  }
                              ]
                          }
                      ]
                  }
              }
          ]
      }
      

      Here is my fts index definition:

      {
      "type": "fulltext-index",
      "name": "default_index1",
      "uuid": "4349fc00f170e7c3",
      "sourceType": "gocbcore",
      "sourceName": "simple_table_db_25169944_simple_table",
      "sourceUUID": "8d60a61219d2d47cb4efaf5a91f27ba1",
      "planParams":

      { "maxPartitionsPerPIndex": 171 }

      ,
      "params": {
      "doc_config":

      { "docid_prefix_delim": "", "docid_regexp": "", "mode": "type_field", "type_field": "type" }

      ,
      "mapping": {
      "analysis": {},
      "default_analyzer": "standard",
      "default_datetime_parser": "dateTimeOptional",
      "default_field": "_all",
      "default_mapping":

      { "default_analyzer": "keyword", "dynamic": true, "enabled": true }

      ,
      "default_type": "_default",
      "docvalues_dynamic": true,
      "index_dynamic": true,
      "store_dynamic": false,
      "type_field": "type"
      },
      "store": {
      "indexType": "scorch",
      "mossStoreOptions": {}
      }
      },
      "sourceParams": {}
      }

      Logs attatched

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              ajay.bhullar Ajay Bhullar
              ajay.bhullar Ajay Bhullar
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty