Commit fed07d5
committed
Add ExpressionAnalyzer for pluggable expression-level statistics
Introduce ExpressionAnalyzer, a chain-of-responsibility framework for
expression-level statistics estimation (NDV, selectivity, min/max).
Framework:
- ExpressionAnalyzer trait with registry parameter for chain delegation
- ExpressionAnalyzerRegistry to chain analyzers (first Computed wins)
- DefaultExpressionAnalyzer: Selinger-style estimation for columns,
literals, binary expressions, NOT, boolean predicates
Integration:
- ExpressionAnalyzerRegistry stored in SessionState, initialized once
- ProjectionExprs stores optional registry (non-breaking, no signature
changes to project_statistics)
- ProjectionExec sets registry via Projector, injected by planner
- FilterExec uses registry for selectivity when interval analysis
cannot handle the predicate
- Custom nodes get builtin analyzer as fallback when registry is absent1 parent 4084a18 commit fed07d5
10 files changed
Lines changed: 1131 additions & 13 deletions
File tree
- datafusion
- common/src
- core/src
- execution
- physical-expr/src
- expression_analyzer
- physical-plan/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
963 | 963 | | |
964 | 964 | | |
965 | 965 | | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
966 | 973 | | |
967 | 974 | | |
968 | 975 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
| |||
184 | 185 | | |
185 | 186 | | |
186 | 187 | | |
| 188 | + | |
| 189 | + | |
187 | 190 | | |
188 | 191 | | |
189 | 192 | | |
| |||
202 | 205 | | |
203 | 206 | | |
204 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
205 | 212 | | |
206 | 213 | | |
207 | 214 | | |
| |||
909 | 916 | | |
910 | 917 | | |
911 | 918 | | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
912 | 924 | | |
913 | 925 | | |
914 | 926 | | |
| |||
988 | 1000 | | |
989 | 1001 | | |
990 | 1002 | | |
| 1003 | + | |
991 | 1004 | | |
992 | 1005 | | |
993 | 1006 | | |
| |||
1028 | 1041 | | |
1029 | 1042 | | |
1030 | 1043 | | |
| 1044 | + | |
1031 | 1045 | | |
1032 | 1046 | | |
1033 | 1047 | | |
| |||
1083 | 1097 | | |
1084 | 1098 | | |
1085 | 1099 | | |
| 1100 | + | |
1086 | 1101 | | |
1087 | 1102 | | |
1088 | 1103 | | |
| |||
1326 | 1341 | | |
1327 | 1342 | | |
1328 | 1343 | | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
1329 | 1353 | | |
1330 | 1354 | | |
1331 | 1355 | | |
| |||
1456 | 1480 | | |
1457 | 1481 | | |
1458 | 1482 | | |
| 1483 | + | |
1459 | 1484 | | |
1460 | 1485 | | |
1461 | 1486 | | |
| |||
1493 | 1518 | | |
1494 | 1519 | | |
1495 | 1520 | | |
| 1521 | + | |
| 1522 | + | |
1496 | 1523 | | |
1497 | 1524 | | |
1498 | 1525 | | |
| |||
1675 | 1702 | | |
1676 | 1703 | | |
1677 | 1704 | | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
1678 | 1712 | | |
1679 | 1713 | | |
1680 | 1714 | | |
| |||
1750 | 1784 | | |
1751 | 1785 | | |
1752 | 1786 | | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
1753 | 1791 | | |
1754 | 1792 | | |
1755 | 1793 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1106 | 1106 | | |
1107 | 1107 | | |
1108 | 1108 | | |
1109 | | - | |
| 1109 | + | |
1110 | 1110 | | |
1111 | 1111 | | |
1112 | 1112 | | |
1113 | | - | |
1114 | | - | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
1115 | 1126 | | |
1116 | 1127 | | |
1117 | 1128 | | |
| |||
1121 | 1132 | | |
1122 | 1133 | | |
1123 | 1134 | | |
1124 | | - | |
| 1135 | + | |
1125 | 1136 | | |
1126 | 1137 | | |
1127 | 1138 | | |
| |||
1130 | 1141 | | |
1131 | 1142 | | |
1132 | 1143 | | |
1133 | | - | |
1134 | | - | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
1135 | 1157 | | |
1136 | 1158 | | |
1137 | 1159 | | |
| |||
2892 | 2914 | | |
2893 | 2915 | | |
2894 | 2916 | | |
2895 | | - | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
2896 | 2928 | | |
2897 | 2929 | | |
2898 | 2930 | | |
| |||
2904 | 2936 | | |
2905 | 2937 | | |
2906 | 2938 | | |
2907 | | - | |
| 2939 | + | |
2908 | 2940 | | |
| 2941 | + | |
| 2942 | + | |
| 2943 | + | |
| 2944 | + | |
| 2945 | + | |
| 2946 | + | |
| 2947 | + | |
| 2948 | + | |
| 2949 | + | |
2909 | 2950 | | |
2910 | 2951 | | |
2911 | 2952 | | |
| |||
0 commit comments