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



##########
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:
       Done in 285f82606786d4ff850dbacc515c59466caada6d
   
   I also did a little test and found out that it's 2x as fast to get the type 
ID by calling a C++ function dedicated for that purpose compared to calling the 
existing type function and getting the ID from it, so I implemented it that way.




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