diff --git a/dev/release/00-prepare.sh b/dev/release/00-prepare.sh index 5f7c098e00c..c77207198aa 100755 --- a/dev/release/00-prepare.sh +++ b/dev/release/00-prepare.sh @@ -97,6 +97,14 @@ update_versions() { git add DESCRIPTION cd - + cd "${SOURCE_DIR}/../../r/src" + sed -i.bak -E -e \ + "s/^VERSION = .+/VERSION = ${r_version}/" \ + Makevars.win + rm -f Makevars.win.bak + git add Makevars.win + cd - + cd "${SOURCE_DIR}/../../ruby" sed -i.bak -E -e \ "s/^ VERSION = \".+\"/ VERSION = \"${version}\"/g" \ diff --git a/r/.Rbuildignore b/r/.Rbuildignore index be540f7f81a..b51d7bc46ab 100644 --- a/r/.Rbuildignore +++ b/r/.Rbuildignore @@ -7,3 +7,5 @@ LICENSE.md lint.sh Dockerfile .*\.tar\.gz +^windows +clang_format.sh diff --git a/r/.gitignore b/r/.gitignore index 0f405f57136..9532537ff0d 100644 --- a/r/.gitignore +++ b/r/.gitignore @@ -10,4 +10,4 @@ inst/doc .Rproj.user .Rhistory src/Makevars - +windows/ diff --git a/r/NAMESPACE b/r/NAMESPACE index aba8bbc2698..4b799571966 100644 --- a/r/NAMESPACE +++ b/r/NAMESPACE @@ -137,7 +137,6 @@ export(list_of) export(mmap_create) export(mmap_open) export(null) -export(print.integer64) export(read_arrow) export(read_csv_arrow) export(read_feather) @@ -148,7 +147,6 @@ export(read_schema) export(read_table) export(record_batch) export(schema) -export(str.integer64) export(struct) export(table) export(time32) diff --git a/r/R/compression.R b/r/R/compression.R index 083774ae0fe..e10fef1bd2e 100644 --- a/r/R/compression.R +++ b/r/R/compression.R @@ -37,10 +37,14 @@ compression_codec <- function(type = "GZIP") { #' Compressed output stream #' +#' @details This function is not supported in Windows. +#' #' @param stream Underlying raw output stream #' @param codec a codec #' @export CompressedOutputStream <- function(stream, codec = compression_codec("GZIP")){ + if (.Platform$OS.type == "windows") stop("'CompressedOutputStream' is unsupported in Windows.") + UseMethod("CompressedOutputStream") } diff --git a/r/R/reexports-bit64.R b/r/R/reexports-bit64.R index 90a6e458be0..c89d2b1509b 100644 --- a/r/R/reexports-bit64.R +++ b/r/R/reexports-bit64.R @@ -16,9 +16,7 @@ # under the License. #' @importFrom bit64 print.integer64 -#' @export bit64::print.integer64 #' @importFrom bit64 str.integer64 -#' @export bit64::str.integer64 diff --git a/r/man/CompressedOutputStream.Rd b/r/man/CompressedOutputStream.Rd index 85c4d9209ac..d32070ebfd1 100644 --- a/r/man/CompressedOutputStream.Rd +++ b/r/man/CompressedOutputStream.Rd @@ -14,3 +14,6 @@ CompressedOutputStream(stream, codec = compression_codec("GZIP")) \description{ Compressed output stream } +\details{ +This function is not supported in Windows. +} diff --git a/r/src/Makevars.win b/r/src/Makevars.win new file mode 100644 index 00000000000..8a9664a22e0 --- /dev/null +++ b/r/src/Makevars.win @@ -0,0 +1,47 @@ +# 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. + +VERSION = 0.12.0.9000 + +ifeq "$(ARROW_PATH)" "" + RWINLIB = ../windows/arrow-$(VERSION) + ARROW_INCLUDE = $(RWINLIB)/include + ARROW_LIBS = $(RWINLIB)/lib$(subst gcc,,$(COMPILED_BY))$(R_ARCH) + OTHER_LIBS = -L$(RWINLIB)/lib$(R_ARCH) +else + ARROW_INCLUDE = $(ARROW_PATH)/include + ARROW_LIBS = $(ARROW_PATH)/lib +endif + +PKG_CPPFLAGS = -I$(ARROW_INCLUDE) -DARROW_STATIC -DPARQUET_STATIC +CXX_STD = CXX11 + +PKG_LIBS = \ + -L$(ARROW_LIBS) \ + $(OTHER_LIBS) \ + -lparquet -larrow -lthrift -lboost_regex-mt-s -ldouble-conversion -lz -lws2_32 + +#all: clean +all: $(SHLIB) + +$(OBJECTS): winlibs + +winlibs: + "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" $(VERSION) + +clean: + rm -f $(SHLIB) $(OBJECTS) diff --git a/r/src/array__to_vector.cpp b/r/src/array__to_vector.cpp index d4eec29c3db..f4017c0ab5f 100644 --- a/r/src/array__to_vector.cpp +++ b/r/src/array__to_vector.cpp @@ -433,6 +433,8 @@ class Converter_Time : public Converter { return 1000000; case TimeUnit::NANO: return 1000000000; + default: + return 0; } } }; diff --git a/r/src/array_from_vector.cpp b/r/src/array_from_vector.cpp index 9e61e75da8a..83d9f78ae5d 100644 --- a/r/src/array_from_vector.cpp +++ b/r/src/array_from_vector.cpp @@ -565,6 +565,8 @@ inline int64_t get_time_multiplier(TimeUnit::type unit) { return 1000000; case TimeUnit::NANO: return 1000000000; + default: + return 0; } } diff --git a/r/tests/testthat/test-compressed.R b/r/tests/testthat/test-compressed.R index 11574756d2a..c703f0e6158 100644 --- a/r/tests/testthat/test-compressed.R +++ b/r/tests/testthat/test-compressed.R @@ -18,6 +18,8 @@ context("arrow::io::Compressed.*Stream") test_that("can write Buffer to CompressedOutputStream and read back in CompressedInputStream", { + if (.Platform$OS.type == "windows") skip("Unsupported") + buf <- buffer(as.raw(sample(0:255, size = 1024, replace = TRUE))) tf1 <- tempfile() diff --git a/r/tools/winlibs.R b/r/tools/winlibs.R new file mode 100644 index 00000000000..12391c77d63 --- /dev/null +++ b/r/tools/winlibs.R @@ -0,0 +1,26 @@ +# 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. + +# Download static arrow from rwinlib +VERSION <- commandArgs(TRUE) +if(!file.exists(sprintf("../windows/arrow-%s/include/arrow/api.h", VERSION))){ + if(getRversion() < "3.3.0") setInternet2() + download.file(sprintf("https://github.com/rwinlib/arrow/archive/v%s.zip", VERSION), "lib.zip", quiet = TRUE) + dir.create("../windows", showWarnings = FALSE) + unzip("lib.zip", exdir = "../windows") + unlink("lib.zip") +}