ovr commented on code in PR #2196:
URL: https://github.com/apache/arrow-datafusion/pull/2196#discussion_r861339475
##########
datafusion/physical-expr/src/expressions/get_indexed_field.rs:
##########
@@ -105,9 +105,51 @@ impl PhysicalExpr for GetIndexedFieldExpr {
}
(dt, key) => Err(DataFusionError::NotImplemented(format!("get
indexed field is only possible on lists with int64 indexes. Tried {} with {}
index", dt, key))),
},
- ColumnarValue::Scalar(_) => Err(DataFusionError::NotImplemented(
- "field access is not yet implemented for scalar
values".to_string(),
- )),
+ ColumnarValue::Scalar(scalar) => match (scalar.get_datatype(),
&self.key) {
+ (DataType::List(v), ScalarValue::Int64(Some(i))) => {
+ let wrapper = scalar.to_array();
Review Comment:
`to_array` uses `to_array_of_size` under the hood, but I cannot use the code
above, because it returns an `ColumnarValue::Array`, but in the case with
`ColumnarValue::Scalar` we need to return `ColumnarValue::Scalar`.
I did another draft in
https://github.com/apache/arrow-datafusion/pull/2196/commits/af8c77fcb947137a3d173ead288a2d7067c1be7d
WDYT?
Thanks
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]