-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ARROW-3731: MVP to read parquet in R library #3230
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
22d89dd
hardcode -larrow and -lparquet
jeffwong-nflx 456c5d2
read parquet files
jeffwong-nflx 9e1897f
styling etc ...
romainfrancois ff260c5
header was too commented, renamed to parquet.cpp
romainfrancois e936b44
need parquet on travis too
romainfrancois 7d6e64d
read_parquet() only reading one parquet file, and gains a `as_tibble`…
romainfrancois 56adad2
Merge pull request #2 from romainfrancois/3731/parquet-2
jeffwong-nflx 75ba5c9
add contributor
jeffwong-nflx 8ccaa51
cleanup
jeffwong-nflx 1df3026
don't hard code -larrow and -lparquet
jeffwong-nflx c67fa3d
Merge pull request #3 from jeffwong-nflx/cleanup
jeffwong-nflx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# 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. | ||
|
||
#' Read parquet file from disk | ||
#' | ||
#' @param file a file path | ||
#' @param as_tibble should the [arrow::Table][arrow__Table] be converted to a tibble. | ||
#' @param ... currently ignored | ||
#' | ||
#' @return a [arrow::Table][arrow__Table], or a data frame if `as_tibble` is `TRUE`. | ||
#' | ||
#' @export | ||
read_parquet <- function(file, as_tibble = TRUE, ...) { | ||
tab <- shared_ptr(`arrow::Table`, read_parquet_file(f)) | ||
if (isTRUE(as_tibble)) { | ||
tab <- as_tibble(tab) | ||
} | ||
tab | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// 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 <arrow/api.h> | ||
#include <arrow/io/api.h> | ||
#include <parquet/arrow/reader.h> | ||
#include <parquet/arrow/writer.h> | ||
#include <parquet/exception.h> | ||
|
||
// [[Rcpp::export]] | ||
std::shared_ptr<arrow::Table> read_parquet_file(std::string filename) { | ||
std::shared_ptr<arrow::io::ReadableFile> infile; | ||
PARQUET_THROW_NOT_OK( | ||
arrow::io::ReadableFile::Open(filename, arrow::default_memory_pool(), &infile)); | ||
|
||
std::unique_ptr<parquet::arrow::FileReader> reader; | ||
PARQUET_THROW_NOT_OK( | ||
parquet::arrow::OpenFile(infile, arrow::default_memory_pool(), &reader)); | ||
std::shared_ptr<arrow::Table> table; | ||
PARQUET_THROW_NOT_OK(reader->ReadTable(&table)); | ||
|
||
return table; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know that we need to maintain these bylines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessarily.