ianmcook commented on a change in pull request #10327:
URL: https://github.com/apache/arrow/pull/10327#discussion_r632795341



##########
File path: r/R/expression.R
##########
@@ -76,7 +76,15 @@
 Expression <- R6Class("Expression", inherit = ArrowObject,
   public = list(
     ToString = function() compute___expr__ToString(self),
-    type = function(schema) compute___expr__type(self, schema),
+    schema = NULL,
+    bind = function(schema) self$schema <- schema,
+    type = function() {
+      if (is.null(self$schema)) {
+        stop("Must bind() expression to a schema before returning its type", 
call. = FALSE)
+      }
+      compute___expr__type(self, self$schema)
+    },

Review comment:
       @nealrichardson I made this change because we need to call 
`Expression$type()` in contexts where we don't have access to `schema`.
   
   Let me know if you'd prefer to retain `schema` as an _optional_ argument to 
`$type()` so that we can get the type either by specifying it in `schema` or 
passing it to `$bind()` before




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to