forked from apache/arrow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARROW-3741: [R] Add support for arrow::compute::Cast to convert Arrow…
… arrays from one type to anothe ``` r library(arrow) a <- array(1:10, NA) a$type() #> arrow::Int32 #> int32 b <- a$cast(int16()) b$type() #> arrow::Int16 #> int16 ``` <sup>Created on 2018-11-14 by the [reprex package](https://reprex.tidyverse.org) (v0.2.1.9000)</sup> Author: Romain Francois <[email protected]> Closes apache#2959 from romainfrancois/ARROW-3741/Cast and squashes the following commits: 053bd35 <Romain Francois> provision test for cast to half float 085886b <Romain Francois> fix similar to @javierluraschi fix on apache#2955 05f8758 <Romain Francois> Table$cast(schema) f02e744 <Romain Francois> RecordBatch$cast(schema) 7cb78ca <Romain Francois> ChunkedArray$cast() 26ef538 <Romain Francois> expose Schema$names as an active d41423b <Romain Francois> making STOP_IF_NULL an inline function so that it is only used on pointers. ffa8c7c <Romain Francois> + tests a96defa <Romain Francois> testing the right thing in `STOP_IF_NULL`, same as apache@e8a7b23 from apache#2953 70898ed <Romain Francois> Array$cast
- Loading branch information
1 parent
8c52f4c
commit 7281731
Showing
19 changed files
with
428 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,7 @@ Collate: | |
'Table.R' | ||
'array.R' | ||
'buffer.R' | ||
'compute.R' | ||
'dictionary.R' | ||
'feather.R' | ||
'io.R' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
#' @include array.R | ||
|
||
`arrow::compute::CastOptions` <- R6Class("arrow::compute::CastOptions", inherit = `arrow::Object`) | ||
|
||
#' Cast options | ||
#' | ||
#' @param safe enforce safe conversion | ||
#' @param allow_int_overflow allow int conversion, `!safe` by default | ||
#' @param allow_time_truncate allow time truncate, `!safe` by default | ||
#' @param allow_float_truncate allow float truncate, `!safe` by default | ||
#' | ||
#' @export | ||
cast_options <- function( | ||
safe = TRUE, | ||
allow_int_overflow = !safe, | ||
allow_time_truncate = !safe, | ||
allow_float_truncate = !safe | ||
){ | ||
shared_ptr(`arrow::compute::CastOptions`, | ||
compute___CastOptions__initialize(allow_int_overflow, allow_time_truncate, allow_float_truncate) | ||
) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.