Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-2385

get_key() for ordering cursor return actual key

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      Hi!
      Suppose, we have following queries to storage:

      tbl.x > X1 AND tbl.y == Y1 AND (tbl.z == Z1 || tbl.z == Z2)
      

      Indexes exists for all conditions and ordering of results is important (should be ordered by tbl.x). We transform it to next:

      (tbl.x > X1 AND tbl.y == Y1 AND tbl.z == Z1) OR (tbl.x > X1 AND tbl.y == Y1 AND tbl.z == Z2)
      

      And then create two join cursors ordered by tbl.x. Then we should merge results of next() calls for join cursors. For this, we should extract values of the tbl.x form result of join_cursor->get_value() using corresponding extractor, and compare extracted values using corresponding collator. Described method will work only if extractor always extract only one value. If it is not, we will not know which of returned results use for comparison. This problem can be avoided if get_key() function for ordering cursor will return actual value, corresponding to the join cursor. I tried to express my thoughts in attached program. It has next output:

      $ LD_LIBRARY_PATH=wt_2.7_master_with_3_pullreq/ ./jcursor_ord_key                                                                                                                                                                    
      value from jcursor: key = 3, v1 = 17, v2 = 22
      ordering cursor key: 17, expected value: 17
      value from jcursor: key = 2, v1 = 18, v2 = 21
      ordering cursor key: 17, expected value: 18
      value from jcursor: key = 1, v1 = 19, v2 = 20
      ordering cursor key: 17, expected value: 19
      

        1. jcursor_ord_key.c
          4 kB
          Denis Shkirya

            Assignee:
            backlog-server-execution [DO NOT USE] Backlog - Storage Execution Team
            Reporter:
            Denis Shkirya Denis Shkirya
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: