Returns the source expression for this expression. Traverses the source exprs of intermediate slot descriptors to resolve materialization points (e.g., aggregations). Returns null if there are multiple source Exprs mapped to the expression at any given point.
()
| 1733 | * mapped to the expression at any given point. |
| 1734 | */ |
| 1735 | public Expr findSrcExpr() { |
| 1736 | // If the source expression is a constant expression, it won't have a scanSlotRef |
| 1737 | // and we can return this. |
| 1738 | if (isConstant()) { |
| 1739 | return this; |
| 1740 | } |
| 1741 | SlotRef slotRef = unwrapSlotRef(false); |
| 1742 | if (slotRef == null) return null; |
| 1743 | SlotDescriptor slotDesc = slotRef.getDesc(); |
| 1744 | if (slotDesc.isScanSlot()) return slotRef; |
| 1745 | if (slotDesc.getSourceExprs().size() == 1) { |
| 1746 | return slotDesc.getSourceExprs().get(0).findSrcExpr(); |
| 1747 | } |
| 1748 | // No known source expr, or there are several source exprs meaning the slot is |
| 1749 | // has no single source table. |
| 1750 | return null; |
| 1751 | } |
| 1752 | |
| 1753 | /** |
| 1754 | * Returns the descriptor of the scan slot that directly or indirectly produces |
no test coverage detected