You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/05/05 12:16:51 UTC

[GitHub] [arrow-datafusion] ovr opened a new pull request, #2454: feat: Support CompoundIdentifier access as GetIndexedField

ovr opened a new pull request, #2454:
URL: https://github.com/apache/arrow-datafusion/pull/2454

   # Which issue does this PR close?
   
   I didn't create a new issue for it.
   
    # Rationale for this change
   
   Right now, DF supports GetIndexed access with MapAccessExpr which is not correct for compatibility with PostgreSQL.
   
   For example:
   
   ```sql
   // DF supports it, but It doesn't work with PostgreSQL
   SELECT (information_schema._pg_expandarray(ARRAY [1,2,3,4]))["x"];
   
   // This PR introduce this, which is supported with PostgreSQL
   SELECT (information_schema._pg_expandarray(ARRAY [1,2,3,4])).x;
   ```
   
   # What changes are included in this PR?
   
   From subject.
   


-- 
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


[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #2454: feat: Support CompoundIdentifier as GetIndexedField access

Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #2454:
URL: https://github.com/apache/arrow-datafusion/pull/2454#discussion_r867058066


##########
datafusion/core/src/sql/planner.rs:
##########
@@ -1608,11 +1608,19 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
                 } else {
                     match (var_names.pop(), var_names.pop()) {
                         (Some(name), Some(relation)) if var_names.is_empty() => {
-                            // table.column identifier
-                            Ok(Expr::Column(Column {
-                                relation: Some(relation),
-                                name,
-                            }))
+                            if let Some(field) = schema.fields().iter().find(|f| f.name().eq(&relation)) {
+                                // Access to a field of a column which is a structure, example: SELECT my_struct.key

Review Comment:
   makes sense to me 👍  Nice work @ovr 



-- 
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


[GitHub] [arrow-datafusion] alamb merged pull request #2454: feat: Support CompoundIdentifier as GetIndexedField access

Posted by GitBox <gi...@apache.org>.
alamb merged PR #2454:
URL: https://github.com/apache/arrow-datafusion/pull/2454


-- 
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