You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/08/07 16:32:01 UTC
[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #7215: improve the ergonomics of creating field and list array accesses
alamb commented on code in PR #7215:
URL: https://github.com/apache/arrow-datafusion/pull/7215#discussion_r1286131008
##########
datafusion/physical-expr/src/expressions/get_indexed_field.rs:
##########
@@ -28,72 +28,46 @@ use arrow::{
};
use datafusion_common::{cast::as_struct_array, DataFusionError, Result, ScalarValue};
use datafusion_expr::{
- field_util::get_indexed_field as get_data_type_field, ColumnarValue,
+ field_util::{
+ get_indexed_field as get_data_type_field, GetFieldAccessCharacteristic,
+ },
+ ColumnarValue,
};
use std::fmt::Debug;
use std::hash::{Hash, Hasher};
use std::{any::Any, sync::Arc};
-/// Key of `GetIndexedFieldExpr`.
-/// This structure is needed to separate the responsibilities of the key for `DataType::List` and `DataType::Struct`.
-/// If we use index with `DataType::List`, then we use the `list_key` argument with `struct_key` equal to `None`.
-/// If we use index with `DataType::Struct`, then we use the `struct_key` argument with `list_key` equal to `None`.
-/// `list_key` can be any expression, unlike `struct_key` which can only be `ScalarValue::Utf8`.
#[derive(Clone, Hash, Debug)]
-pub struct GetIndexedFieldExprKey {
- /// The key expression for `DataType::List`
- list_key: Option<Arc<dyn PhysicalExpr>>,
- /// The key expression for `DataType::Struct`
- struct_key: Option<ScalarValue>,
+pub enum GetFieldAccessExpr {
Review Comment:
👍
##########
datafusion/physical-expr/src/expressions/get_indexed_field.rs:
##########
@@ -28,72 +28,46 @@ use arrow::{
};
use datafusion_common::{cast::as_struct_array, DataFusionError, Result, ScalarValue};
use datafusion_expr::{
- field_util::get_indexed_field as get_data_type_field, ColumnarValue,
+ field_util::{
+ get_indexed_field as get_data_type_field, GetFieldAccessCharacteristic,
+ },
+ ColumnarValue,
};
use std::fmt::Debug;
use std::hash::{Hash, Hasher};
use std::{any::Any, sync::Arc};
-/// Key of `GetIndexedFieldExpr`.
-/// This structure is needed to separate the responsibilities of the key for `DataType::List` and `DataType::Struct`.
-/// If we use index with `DataType::List`, then we use the `list_key` argument with `struct_key` equal to `None`.
-/// If we use index with `DataType::Struct`, then we use the `struct_key` argument with `list_key` equal to `None`.
-/// `list_key` can be any expression, unlike `struct_key` which can only be `ScalarValue::Utf8`.
#[derive(Clone, Hash, Debug)]
-pub struct GetIndexedFieldExprKey {
- /// The key expression for `DataType::List`
- list_key: Option<Arc<dyn PhysicalExpr>>,
- /// The key expression for `DataType::Struct`
- struct_key: Option<ScalarValue>,
+pub enum GetFieldAccessExpr {
Review Comment:
👍
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org