fsaintjacques commented on a change in pull request #7614:
URL: https://github.com/apache/arrow/pull/7614#discussion_r449068026



##########
File path: r/src/array_from_vector.cpp
##########
@@ -351,15 +351,20 @@ std::shared_ptr<Array> 
MakeFactorArrayImpl(Rcpp::IntegerVector_ factor,
 
 std::shared_ptr<Array> MakeFactorArray(Rcpp::IntegerVector_ factor,
                                        const std::shared_ptr<arrow::DataType>& 
type) {
-  SEXP levels = factor.attr("levels");
-  int n = Rf_length(levels);
-  if (n < 128) {
+  auto* dict_type = checked_cast<arrow::DictionaryType*>(type.get());

Review comment:
       Small nit, we tend to prefer `const &` instead of pointer. This 
indicates to the reader that you won't mutate the object.
   
   ```suggestion
     auto dict_type = checked_cast<const arrow::DictionaryType&>(*type);
   ```




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