Skip to content
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

Implement array_slice and array_element, remove array_trim #6936

Merged
merged 26 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
282278d
feat: reading array elements
izveigor Jul 12, 2023
415be26
feat: array_element, array_slice, struct_extract
izveigor Jul 14, 2023
2f8e992
feat: support for positive and zero numbers for array_element and arr…
izveigor Jul 14, 2023
ebff134
feat: support negative numbers for array_element and array_slice
izveigor Jul 15, 2023
11a8d55
feat: add more sql logic tests for array_element and array_slice
izveigor Jul 15, 2023
862a5f4
Merge branch 'main' into index
izveigor Jul 18, 2023
2145b7e
feat: unit tests for get indexed fields
izveigor Jul 18, 2023
1782fed
feat: sqllogictests for index
izveigor Jul 18, 2023
ec8cfa5
docs: array_element and array_slice
izveigor Jul 18, 2023
929f169
feat: some TODOS
izveigor Jul 18, 2023
fe08230
feat: proto
izveigor Jul 18, 2023
2078d23
Merge branch 'main' into index
izveigor Jul 28, 2023
0fcd411
feat: proto
izveigor Jul 28, 2023
518a733
fix: tests
izveigor Jul 28, 2023
7ad25bf
fix: query_nested_get_indexed_field_on_struct
izveigor Jul 28, 2023
8a83f33
fix: some bugs
izveigor Jul 30, 2023
c6c7416
Merge branch 'main' into index
izveigor Jul 31, 2023
de5b671
fix: typo
izveigor Jul 31, 2023
74c69f2
test: remove test_udaf_returning_struct_subquery
izveigor Jul 31, 2023
baef3f9
feat: column support for list with single index
izveigor Aug 1, 2023
4fed361
fix: list index does not support with columns
izveigor Aug 2, 2023
b68342d
fix: merge conflicts
izveigor Aug 2, 2023
65dbcc4
fix: proto
izveigor Aug 2, 2023
f91fb30
fix: proto test
izveigor Aug 2, 2023
502b2c7
fix: clippy
izveigor Aug 2, 2023
c754a29
fix: test_udaf_returning_struct_subquery
izveigor Aug 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions datafusion/core/src/physical_planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,28 @@ fn create_physical_name(e: &Expr, is_first_expr: bool) -> Result<String> {
let expr = create_physical_name(expr, false)?;
Ok(format!("{expr} IS NOT UNKNOWN"))
}
Expr::GetIndexedField(GetIndexedField { key, expr }) => {
Expr::GetIndexedField(GetIndexedField {
key,
extra_key,
expr,
}) => {
let expr = create_physical_name(expr, false)?;
Ok(format!("{expr}[{key}]"))

if let (Some(list_key), Some(extra_key)) = (&key.list_key, extra_key) {
let key = create_physical_name(list_key, false)?;
let extra_key = create_physical_name(extra_key, false)?;
Ok(format!("{expr}[{key}:{extra_key}]"))
} else {
let key = if let Some(list_key) = &key.list_key {
create_physical_name(list_key, false)?
} else if let Some(ScalarValue::Utf8(Some(struct_key))) = &key.struct_key
{
struct_key.to_string()
} else {
String::from("")
};
Ok(format!("{expr}[{key}]"))
}
}
Expr::ScalarFunction(func) => {
create_function_physical_name(&func.fun.to_string(), false, &func.args)
Expand Down
Loading