我要评分
获取效率
正确性
完整性
易理解

Scenarios Where OmniCache Does Not Support Rewriting

Table 1 describes the scenarios where OmniCache does not support rewriting.

Table 1 Scenario rules

Rule

Description

Basic rules

  • When required data is queried, if the view condition does not match the query condition, rewriting is not supported. For example, when the query condition is c1 ≥ 2 and the view condition is c1 > 2, rewriting is not supported.
  • The In and Like statements require that the query and view conditions be completely matched. If not, rewriting is not supported. For example, when the query condition is in (2,3) and the view condition is in (1,2,3), rewriting is not supported.
  • When a view has been used in the SQL query statements, rewriting is not supported.

Join rules

  • Only the Inner-Join type supports rewriting.
  • isValidPlan is used to check whether the logical plan tree of the currently matched query and view meets the minimum unit requirement, which requires that only the following operators be included. If the requirement is not met, rewriting is not supported.
    • LogicalRelation
    • HiveTableRelation
    • Project
    • Filter
    • Join
    • SubqueryAlias

Aggregate rules

  • The root node of the logical plan tree in the view must be the Aggregate operator. For example, the root nodes of order by and having are Sort and Filter respectively, and these views do not support rewriting.
  • The query must match the logical plan tree of the view. The root nodes on both sides must be the Aggregate operator. Then, isValidPlan is used to check whether the subtree meets the minimum unit requirement. If the subtree does not meet the requirement, rewriting is not supported.
  • If the query contains aggregate functions that do not exist in the view, rewriting is not supported.
  • The group by field in the query is a subset of the group by field in the view. Only the following aggregate functions (without distinct) can be rolled up. If the condition is not met, rewriting is not supported.
    • sum
    • min
    • max
    • count