Commit d54dc4a
authored
Support string column identifiers for sort/aggregate/window and stricter Expr validation (#1221)
* refactor: improve DataFrame expression handling, type checking, and docs
- Refactor expression handling and `_simplify_expression` for stronger
type checking and clearer error handling
- Improve type annotations for `file_sort_order` and `order_by` to
support string inputs
- Refactor DataFrame `filter` method to better validate predicates
- Replace internal error message variable with public constant
- Clarify usage of `col()` and `column()` in DataFrame examples
* refactor: unify expression and sorting logic; improve docs and error handling
- Update `order_by` handling in Window class for better type support
- Improve type checking in DataFrame expression handling
- Replace `Expr`/`SortExpr` with `SortKey` in file_sort_order and
related functions
- Simplify file_sort_order handling in SessionContext
- Rename `_EXPR_TYPE_ERROR` → `EXPR_TYPE_ERROR` for consistency
- Clarify usage of `col()` vs `column()` in DataFrame examples
- Enhance documentation for file_sort_order in SessionContext
* feat: add ensure_expr helper for validation; refine expression handling, sorting, and docs
- Introduce `ensure_expr` helper and improve internal expression
validation
- Update error messages and tests to consistently use `EXPR_TYPE_ERROR`
- Refactor expression handling with `_to_raw_expr`, `_ensure_expr`, and
`SortKey`
- Improve type safety and consistency in sort key definitions and file
sort order
- Add parameterized parquet sorting tests
- Enhance DataFrame docstrings with clearer guidance and usage examples
- Fix minor typos and error message clarity
* Refactor and enhance expression handling, test coverage, and documentation
- Introduced `ensure_expr_list` to validate and flatten nested
expressions, treating strings as atomic
- Updated expression utilities to improve consistency across aggregation
and window functions
- Consolidated and expanded parameterized tests for string equivalence
in ranking and window functions
- Exposed `EXPR_TYPE_ERROR` for consistent error messaging across
modules and tests
- Improved internal sort logic using `expr_internal.SortExpr`
- Clarified expectations for `join_on` expressions in documentation
- Standardized imports and improved test clarity for maintainability
* refactor: update docstring for sort_or_default function to clarify its purpose
* fix Ruff errors
* refactor: update type hints to use typing.Union for better clarity and consistency
* fix Ruff errors
* refactor: simplify type hints by removing unnecessary imports for type checking
* refactor: update type hints for rex_type and types methods to improve clarity
* refactor: remove unnecessary type ignore comments from rex_type and types methods
* docs: update section title for clarity on DataFrame method arguments
* docs: clarify description of DataFrame methods accepting column names
* docs: add note to clarify function documentation reference for DataFrame methods
* docs: remove outdated information about predicate acceptance in DataFrame class
* refactor: simplify type hint for expr_list parameter in expr_list_to_raw_expr_list function
* docs: clarify usage of datafusion.col and datafusion.lit in DataFrame method documentation
* docs: clarify usage of col() and lit() in DataFrame filter examples
* Fix ruff errors1 parent 9e97636 commit d54dc4a
File tree
7 files changed
+633
-123
lines changed- docs/source/user-guide/dataframe
- python
- datafusion
- tests
7 files changed
+633
-123
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
129 | 179 | | |
130 | 180 | | |
131 | 181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
| 30 | + | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | | - | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
553 | 555 | | |
554 | 556 | | |
555 | 557 | | |
556 | | - | |
| 558 | + | |
557 | 559 | | |
558 | 560 | | |
559 | 561 | | |
| |||
567 | 569 | | |
568 | 570 | | |
569 | 571 | | |
570 | | - | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
571 | 575 | | |
572 | 576 | | |
573 | 577 | | |
574 | 578 | | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | 579 | | |
581 | 580 | | |
582 | 581 | | |
583 | 582 | | |
584 | 583 | | |
585 | 584 | | |
586 | | - | |
| 585 | + | |
587 | 586 | | |
588 | 587 | | |
589 | 588 | | |
| |||
808 | 807 | | |
809 | 808 | | |
810 | 809 | | |
811 | | - | |
| 810 | + | |
812 | 811 | | |
813 | 812 | | |
814 | 813 | | |
| |||
827 | 826 | | |
828 | 827 | | |
829 | 828 | | |
830 | | - | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
831 | 832 | | |
832 | 833 | | |
833 | 834 | | |
| |||
840 | 841 | | |
841 | 842 | | |
842 | 843 | | |
843 | | - | |
844 | | - | |
845 | | - | |
| 844 | + | |
846 | 845 | | |
847 | 846 | | |
848 | 847 | | |
| |||
1099 | 1098 | | |
1100 | 1099 | | |
1101 | 1100 | | |
1102 | | - | |
| 1101 | + | |
1103 | 1102 | | |
1104 | 1103 | | |
1105 | 1104 | | |
| |||
1116 | 1115 | | |
1117 | 1116 | | |
1118 | 1117 | | |
1119 | | - | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
1120 | 1121 | | |
1121 | 1122 | | |
1122 | 1123 | | |
1123 | 1124 | | |
1124 | 1125 | | |
1125 | 1126 | | |
1126 | 1127 | | |
1127 | | - | |
1128 | | - | |
1129 | | - | |
1130 | | - | |
1131 | | - | |
| 1128 | + | |
1132 | 1129 | | |
1133 | 1130 | | |
1134 | 1131 | | |
| |||
1179 | 1176 | | |
1180 | 1177 | | |
1181 | 1178 | | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
1182 | 1197 | | |
1183 | 1198 | | |
1184 | 1199 | | |
| |||
0 commit comments