Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-10965

Automate detection of presence of Filter#filterRow()

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Filters
    • Labels:
      None

      Description

      There is potential inconsistency between the return value of Filter#hasFilterRow() and presence of Filter#filterRow().

      Filters may override Filter#filterRow() while leaving return value of Filter#hasFilterRow() being false (inherited from FilterBase).

      Downside to purely depending on hasFilterRow() telling us whether custom filter overrides filterRow(List) or filterRow() is that the check below may be rendered ineffective:

                if (nextKv == KV_LIMIT) {
                  if (this.filter != null && filter.hasFilterRow()) {
                    throw new IncompatibleFilterException(
                      "Filter whose hasFilterRow() returns true is incompatible with scan with limit!");
                  }
      

      When user forgets to override hasFilterRow(), the above check becomes not useful.

      Another limitation is that we cannot optimize FilterList#filterRow() through short circuit when FilterList#hasFilterRow() turns false.
      See https://issues.apache.org/jira/browse/HBASE-11093?focusedCommentId=13985149&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13985149

      This JIRA aims to remove the inconsistency by automatically detecting the presence of overridden Filter#filterRow(). For FilterBase-derived classes, if filterRow() is implemented and not inherited from FilterBase, it is equivalent to having hasFilterRow() return true.

      With precise detection of presence of Filter#filterRow(), the following code from HRegion is no longer needed while backward compatibility is kept.

            return filter != null && (!filter.hasFilterRow())
                && filter.filterRow();
      

        Attachments

        1. 10965-v7.txt
          13 kB
          Ted Yu
        2. 10965-v6.txt
          10 kB
          Ted Yu
        3. 10965-v4.txt
          5 kB
          Ted Yu
        4. 10965-v3.txt
          5 kB
          Ted Yu
        5. 10965-v2.txt
          4 kB
          Ted Yu
        6. 10965-v1.txt
          4 kB
          Ted Yu

          Issue Links

            Activity

              People

              • Assignee:
                yuzhihong@gmail.com Ted Yu
                Reporter:
                yuzhihong@gmail.com Ted Yu
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: