You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tustvold (via GitHub)" <gi...@apache.org> on 2023/04/18 12:40:12 UTC

[GitHub] [arrow-rs] tustvold opened a new pull request, #4098: Remove DataType from PrimitiveArray constructors

tustvold opened a new pull request, #4098:
URL: https://github.com/apache/arrow-rs/pull/4098

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes #.
   
   # Rationale for this change
    
   <!--
   Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
   Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
   -->
   
   This makes the constructors more consistent with the other PrimitiveArray methods which default to `T::DATA_TYPE` requiring the user to manually override it.
   
   # What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   # Are there any user-facing changes?
   
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!---
   If there are any breaking changes to public APIs, please add the `breaking change` label.
   -->
   
   This does change `PrimitiveArray::new` which was included in the last release. Given how new this API is, I don't anticipate any major issues.


-- 
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-rs] tustvold commented on a diff in pull request #4098: Remove DataType from PrimitiveArray constructors

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4098:
URL: https://github.com/apache/arrow-rs/pull/4098#discussion_r1169976013


##########
arrow-array/src/array/primitive_array.rs:
##########
@@ -320,6 +306,19 @@ impl<T: ArrowPrimitiveType> PrimitiveArray<T> {
         (self.data_type, self.values, self.nulls)
     }
 
+    /// Overrides the [`DataType`] of this [`PrimitiveArray`]
+    ///
+    /// Prefer using [`Self::with_timezone`] or [`Self::with_precision_and_scale`] where
+    /// the primitive type is suitably constrained, as these cannot panic
+    ///
+    /// # Panics
+    ///
+    /// Panics if ![Self::is_compatible]
+    pub fn with_data_type(self, data_type: DataType) -> Self {

Review Comment:
   I don't anticipate this getting much use, but it ensures we don't lose any functionality with this change



-- 
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-rs] tustvold merged pull request #4098: Remove DataType from PrimitiveArray constructors

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold merged PR #4098:
URL: https://github.com/apache/arrow-rs/pull/4098


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