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

Expiration returned incorrectly as 0

    XMLWordPrintable

Details

    • 1

    Description

      If the query uses Legacy LOOK UP JOIN, subpaths can be missing. Expiration must get expiration through sub document API. However, in case of JOIN it only gets through Fetch Phase on the right side. This can cause expiration to be incorrectly returned as 0.

      Reproduction

      1. Insert the following document

      2. Execute the following query and note the outcome:

      Attachments

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

        Activity

          Sitaram.Vemulapalli Sitaram Vemulapalli added a comment - - edited

          expiration must be get through sub document API, In JOIN case it only got through Fetch on right side.

          This query uses Legacy LOOK UP JOIN. so subpaths are missing in the plan operator.

           {
                          "#operator": "Join",
                          "#stats": {
                            "#itemsIn": 3,
                            "#itemsOut": 3,
                            "#phaseSwitches": 17,
                            "execTime": "41.986µs",
                            "kernTime": "2.773269ms",
                            "servTime": "138.223µs"
                          },
                          "as": "sub",
                          "keyspace": "dataraw",
                          "namespace": "default",
                          "on_keys": "(\"subscription_\" || cover ((`req`.`subscription`)))",
                          "#time_normal": "00:00.000",
                          "#time_absolute": 0.000180209
                        } INSERT INTO default VALUES("k01",{"a":1}, {"expiration":10000});
          SELECT META(r).expiration   
          FROM ["k01"] AS d JOIN default AS r ON KEYS d;
           
          

          LOOKUP JOIN (JOIN ... ON KEYS), LOOKUP NEST (NEST ... ON KEYS) need to be fixed

          Also see if any change need legacy Index Joins

          Sitaram.Vemulapalli Sitaram Vemulapalli added a comment - - edited expiration must be get through sub document API, In JOIN case it only got through Fetch on right side. This query uses Legacy LOOK UP JOIN. so subpaths are missing in the plan operator. {                 "#operator" : "Join" ,                 "#stats" : {                   "#itemsIn" : 3 ,                   "#itemsOut" : 3 ,                   "#phaseSwitches" : 17 ,                   "execTime" : "41.986µs" ,                   "kernTime" : "2.773269ms" ,                   "servTime" : "138.223µs"                 },                 "as" : "sub" ,                 "keyspace" : "dataraw" ,                 "namespace" : "default" ,                 "on_keys" : "(\"subscription_\" || cover ((`req`.`subscription`)))" ,                 "#time_normal" : "00:00.000" ,                 "#time_absolute" : 0.000180209               } INSERT INTO default VALUES( "k01" ,{ "a" : 1 }, { "expiration" : 10000 }); SELECT META(r).expiration FROM [ "k01" ] AS d JOIN default AS r ON KEYS d;   LOOKUP JOIN (JOIN ... ON KEYS), LOOKUP NEST (NEST ... ON KEYS) need to be fixed Also see if any change need legacy Index Joins
          Sitaram.Vemulapalli Sitaram Vemulapalli added a comment - - edited

          UPSERT INTO default VALUES("k01",{"a":"k02"}, {"expiration":3000000000});
          UPSERT INTO default VALUES("k02",{"a":"k01"}, {"expiration":2000000000});
           
          create index ix11 on default (a);
           
          SELECT META(r).expiration, r.* FROM default AS l USE KEYS "k01" JOIN default AS r ON KEYS l.a;
          SELECT META(r).expiration, r.* FROM default AS l USE KEYS "k01" JOIN default AS r ON l.a = META(r).id;
          SELECT META(r).expiration, r.* FROM default AS l USE KEYS "k01" JOIN default AS r ON KEY r.a FOR l;
           
          SELECT ARRAY {META(v).expiration, v.a} FOR v IN r END AS r FROM default AS l USE KEYS "k01" NEST default AS r ON KEYS l.a LET x = META(r).expiration;
          SELECT ARRAY {META(v).expiration, v.a} FOR v IN r END AS r FROM default AS l USE KEYS "k01" NEST default AS r ON KEY r.a FOR l LET x = META(r).expiration;SELECT ARRAY {META(v).expiration, v.a} FOR v IN r END AS r FROM default AS l USE KEYS "k01" NEST default AS r ON l.a = META(r).id
          LET x = META(r).expiration;

          Sitaram.Vemulapalli Sitaram Vemulapalli added a comment - - edited UPSERT INTO default VALUES("k01",{"a":"k02"}, {"expiration":3000000000}); UPSERT INTO default VALUES("k02",{"a":"k01"}, {"expiration":2000000000});   create index ix11 on default (a);   SELECT META(r).expiration, r.* FROM default AS l USE KEYS "k01" JOIN default AS r ON KEYS l.a; SELECT META(r).expiration, r.* FROM default AS l USE KEYS "k01" JOIN default AS r ON l.a = META(r).id; SELECT META(r).expiration, r.* FROM default AS l USE KEYS "k01" JOIN default AS r ON KEY r.a FOR l;   SELECT ARRAY {META(v).expiration, v.a} FOR v IN r END AS r FROM default AS l USE KEYS "k01" NEST default AS r ON KEYS l.a LET x = META(r).expiration; SELECT ARRAY {META(v).expiration, v.a} FOR v IN r END AS r FROM default AS l USE KEYS "k01" NEST default AS r ON KEY r.a FOR l LET x = META(r).expiration;SELECT ARRAY {META(v).expiration, v.a} FOR v IN r END AS r FROM default AS l USE KEYS "k01" NEST default AS r ON l.a = META(r).id LET x = META(r).expiration;

          Build couchbase-server-7.2.0-1050 contains query commit ae2ca62 with commit message:
          MB-51623. Enable subpaths with legacy joins

          build-team Couchbase Build Team added a comment - Build couchbase-server-7.2.0-1050 contains query commit ae2ca62 with commit message: MB-51623 . Enable subpaths with legacy joins

          People

            mihir.kamdar Mihir Kamdar (Inactive)
            yuvraj.kanwar Yuvraj Kanwar
            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