-
Notifications
You must be signed in to change notification settings - Fork 974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Expr::GetIndexedField
, replace Expr::{field,index,range}
with FieldAccessor
, IndexAccessor
, and SliceAccessor
#10568
Conversation
Signed-off-by: jayzhan211 <jayzhan211@gmail.com>
Signed-off-by: jayzhan211 <jayzhan211@gmail.com>
Signed-off-by: jayzhan211 <jayzhan211@gmail.com>
@@ -233,3 +241,120 @@ impl TableSource for MyTableSource { | |||
self.schema.clone() | |||
} | |||
} | |||
|
|||
#[test] | |||
fn test_nested_schema_nullability() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move tests that use functions to core/tests
@@ -1037,29 +1037,6 @@ mod tests { | |||
assert_optimized_plan_equal(plan, expected) | |||
} | |||
|
|||
#[test] | |||
fn test_struct_field_push_down() -> Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to slt
Signed-off-by: jayzhan211 <jayzhan211@gmail.com>
@@ -61,7 +63,7 @@ fn test_eq_with_coercion() { | |||
#[test] | |||
fn test_get_field() { | |||
evaluate_expr_test( | |||
get_field(col("props"), "a"), | |||
col("props").field("a"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
Expr::GetIndexedField
and fix panic of field
, index
and range
Expr::GetIndexedField
, replace Expr::{field,index,range}
with FieldAccessor
, IndexAccessor
, and SliceAccessor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great -- thank you @jayzhan211 . I had one small comment regarding the placement of docstrings but I also think we could do that as a follow on PR
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
//! Extension methods for Expr. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very clever idea. Thank you @jayzhan211
} | ||
|
||
impl IndexAccessor for Expr { | ||
/// Return access to the element field. Example `expr["name"]` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the way that rustdoc works, this documentation won't appear on index
-- can you please move the docs and example to IndexAccessor
itself?
} | ||
|
||
impl FieldAccessor for Expr { | ||
/// Return access to the named field. Example `expr["name"]` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
likewise here I think we need to move the docs / example to FieldAccessor
rather than on the impl in Expr
@@ -287,24 +284,6 @@ pub fn create_physical_expr( | |||
input_dfschema, | |||
execution_props, | |||
)?), | |||
Expr::GetIndexedField(GetIndexedField { expr: _, field }) => match field { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
Thanks, @alamb ! |
…ith `FieldAccessor`, `IndexAccessor`, and `SliceAccessor` (apache#10568) * remove expr Signed-off-by: jayzhan211 <jayzhan211@gmail.com> * add expr extension Signed-off-by: jayzhan211 <jayzhan211@gmail.com> * doc Signed-off-by: jayzhan211 <jayzhan211@gmail.com> * move test that has struct Signed-off-by: jayzhan211 <jayzhan211@gmail.com> * fmt Signed-off-by: jayzhan211 <jayzhan211@gmail.com> * add foc and fix displayed name Signed-off-by: jayzhan211 <jayzhan211@gmail.com> * rm test Signed-off-by: jayzhan211 <jayzhan211@gmail.com> * rebase Signed-off-by: jayzhan211 <jayzhan211@gmail.com> * move doc Signed-off-by: jayzhan211 <jayzhan211@gmail.com> --------- Signed-off-by: jayzhan211 <jayzhan211@gmail.com>
Which issue does this PR close?
Closes #10374.
Closes #10565
Rationale for this change
What changes are included in this PR?
After the change, you need to import
to use old expression api.
Are these changes tested?
Are there any user-facing changes?