Skip to content

ARROW-3814: [R] RecordBatch$from_arrays() - #3565

Closed
romainfrancois wants to merge 21 commits into
apache:masterfrom
romainfrancois:ARROW-3814/record_batch_from_arrays
Closed

ARROW-3814: [R] RecordBatch$from_arrays()#3565
romainfrancois wants to merge 21 commits into
apache:masterfrom
romainfrancois:ARROW-3814/record_batch_from_arrays

Conversation

@romainfrancois

Copy link
Copy Markdown
Contributor

This started out as an implementation of RecordBatch$from_arrays() (i.e. https://issues.apache.org/jira/browse/ARROW-3814?filter=12344983) but now looks more like this issue: https://issues.apache.org/jira/browse/ARROW-3815?filter=12344983

The idea being that the record batch factory record_batch() would work with ... and schema, where each thing in the ... could be:

  • an arrow::Array
  • an R vector that can be converted to an array using array()

So where we had this before:

record_batch(tibble::tibble(x=1:10, y=1:10))

we would now have:

record_batch(x=1:10, y=1:10)

We would still be able to start from a data frame, via splicing, e.g.:

tbl <- tibble::tibble(x = 1:10, y = 1:10)
record_batch(!!!tbl)

So there would be no need for a RecordBatch$fromArray() method.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I suppose the situation is similar for the table() factory

@romainfrancoisromainfrancois added WIP PR is work in progress Component: R labels Feb 5, 2019
@codecov-io

codecov-io commented Feb 5, 2019

Copy link
Copy Markdown

Codecov Report

Merging #3565 into master will decrease coverage by 11.02%.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@## master #3565 +/- ##
===========================================
- Coverage 87.94% 76.92% -11.03% 
===========================================
Files 737 51 -686 Lines 81709 1976 -79733 Branches 1253 0 -1253 ===========================================
- Hits 71863 1520 -70343 + Misses 9599 456 -9143 + Partials 247 0 -247
Impacted FilesCoverage Δ
src/table.cpp64.17% <0%> (-4.25%)⬇️
src/array_from_vector.cpp78.29% <0%> (-0.05%)⬇️
R/write_arrow.R96.29% <0%> (ø)⬆️
R/feather.R58.33% <0%> (ø)⬆️
cpp/src/arrow/csv/chunker-test.cc
cpp/src/parquet/column_page.h
cpp/src/parquet/bloom_filter-test.cc
cpp/src/arrow/array/builder_decimal.cc
cpp/src/plasma/client.cc
cpp/src/arrow/io/test-common.h
... and 685 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5025126...ab0cd16. Read the comment docs.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

proposal for the table() function, that might be renamed Table() perhaps. The idea is that the function can handle two cases:

  • a variable list of record batches, which then results to a call to arrow::Table::FromRecordBatches :
library(arrow, warn.conflicts=FALSE)
library(purrr)
batch<- record_batch(x=1:2, y=letters[1:2])
# variable number of batchestab<- table(batch, batch, batch)
tab#> arrow::Table
as_tibble(tab)
#> # A tibble: 6 x 2#> x y #> <int> <chr>#> 1 1 a #> 2 2 b #> 3 1 a #> 4 2 b #> 5 1 a #> 6 2 b# splicing supportbatches<- map(1:10, ~record_batch(x=., y=letters[.]))
tab<- table(!!!batches)
tab#> arrow::Table
as_tibble(tab)
#> # A tibble: 10 x 2#> x y #> <int> <chr>#> 1 1 a #> 2 2 b #> 3 3 c #> 4 4 d #> 5 5 e #> 6 6 f #> 7 7 g #> 8 8 h #> 9 9 i #> 10 10 j
  • a named list of R vectors, R arrays or chunked arrays, e.g.
library(arrow, warn.conflicts=FALSE)
a<-array(rnorm(10))
tab<- table(x=1:10, y=letters[1:10], z=a)
tab$schema#> arrow::Schema #> x: int32#> y: string#> z: double
as_tibble(tab)
#> # A tibble: 10 x 3#> x y z#> <int> <chr> <dbl>#> 1 1 a 1.68 #> 2 2 b 1.61 #> 3 3 c 0.879#> 4 4 d 0.315#> 5 5 e 0.877#> 6 6 f -1.28 #> 7 7 g 0.827#> 8 8 h 0.494#> 9 9 i 1.60 #> 10 10 j -1.66# supports splicing too, e.g. tab<- table(
row.number=1:150, # R integer vector -> converted to an Array!!!iris, # columns of iris are spliced, each is converted to an arrayarr=array(rnorm(150)) # an Array already
)
tab$schema#> arrow::Schema #> row.number: int32#> Sepal.Length: double#> Sepal.Width: double#> Petal.Length: double#> Petal.Width: double#> Species: dictionary<values=string, indices=int8, ordered=0>#> arr: double
as_tibble(tab)
#> # A tibble: 150 x 7#> row.number Sepal.Length Sepal.Width Petal.Length Petal.Width Species#> <int> <dbl> <dbl> <dbl> <dbl> <fct> #> 1 1 5.1 3.5 1.4 0.2 setosa #> 2 2 4.9 3 1.4 0.2 setosa #> 3 3 4.7 3.2 1.3 0.2 setosa #> 4 4 4.6 3.1 1.5 0.2 setosa #> 5 5 5 3.6 1.4 0.2 setosa #> 6 6 5.4 3.9 1.7 0.4 setosa #> 7 7 4.6 3.4 1.4 0.3 setosa #> 8 8 5 3.4 1.5 0.2 setosa #> 9 9 4.4 2.9 1.4 0.2 setosa #> 10 10 4.9 3.1 1.5 0.1 setosa #> # … with 140 more rows, and 1 more variable: arr <dbl>

@xhochy
xhochyforce-pushed the ARROW-3814/record_batch_from_arrays branch from 7ab2a73 to 046ce90CompareFebruary 8, 2019 21:25
@xhochy

Copy link
Copy Markdown
Member

Rebased.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

@xhochy was there a special need to rebase ? Just curious.
I usually only need to rebase after an R specific PR is squashed

@xhochy

Copy link
Copy Markdown
Member

I rebased master on the release commit of the JavaScript 0.4.0 release.

We sadly only add the tagging commits to master once the release vote has passed. Then we need to rebase all PRs as we keep merging patches while the release vote runs.

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 046ce90 to cc30604CompareFebruary 13, 2019 08:59
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch 3 times, most recently from ef8b3ef to 0898ddeCompareFebruary 26, 2019 08:39
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 0898dde to 2326d85CompareMarch 6, 2019 13:39
@romainfrancois
romainfrancois requested a review from wesmMarch 6, 2019 16:19
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I think this is ready now.

@wesmwesm removed the WIP PR is work in progress label Mar 6, 2019

@wesmwesm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments but this looks like a nice improvement. I think this can be merged after some small fixes /c comments

Comment threadr/R/feather.R Outdated
Comment threadr/R/write_arrow.R Outdated
Comment threadr/src/recordbatch.cpp Outdated
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

Thanks. I’ll deal with those in the morning.

@wesm

wesm commented Mar 7, 2019

Copy link
Copy Markdown
Member

@romainfrancois this needs to be rebased now after the lint fixes, sorry about that

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 4891ac6 to 8283a94CompareMarch 8, 2019 08:06
Comment threadr/lint.sh Outdated

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we need to pass $1 to run_cpp_lint.py too ?

Removing it here allows to use

./r/lint.sh --fix

and let the tool fix the format

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch 3 times, most recently from d42da88 to f51801dCompareMarch 29, 2019 13:33
@wesm
wesmforce-pushed the ARROW-3814/record_batch_from_arrays branch from f51801d to 7f656eaCompareMay 30, 2019 18:07
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 7f656ea to 74a1e6bCompareMay 31, 2019 09:13
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I think this is good to go, but I'd like to merge #4413 first because currently this pr would fail against the new Dictionary changes from #4316

@wesm

wesm commented May 31, 2019

Copy link
Copy Markdown
Member

Sounds good

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 74a1e6b to ab0cd16CompareJune 3, 2019 07:26
wesm
wesm approved these changes Jun 3, 2019

@wesmwesm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment threadr/lint.sh Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay

expect_equal(s, batch$schema)

s <- schema(x = int32(), y = utf8())
expect_error(record_batch(x = 1:10, y = 1:10, schema = s))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If schema were a column name I guess you would have to pass the arguments differently

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.92%. Comparing base (5025126) to head (ab0cd16).

❗ There is a different number of reports uploaded between BASE (5025126) and HEAD (ab0cd16). Click for more details.

HEAD has 4 uploads less than BASE
FlagBASE (5025126)HEAD (ab0cd16)
51
Additional details and impacted files
@@ Coverage Diff @@## master #3565 +/- ##
===========================================
- Coverage 87.94% 76.92% -11.03% 
===========================================
Files 737 51 -686 Lines 81709 1976 -79733 Branches 1253 0 -1253 ===========================================
- Hits 71863 1520 -70343 + Misses 9599 456 -9143 + Partials 247 0 -247 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@romainfrancois@codecov-io@xhochy@wesm@codecov-commenter
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
ARROW-3814: [R] RecordBatch$from_arrays() by romainfrancois · Pull Request #3565 · apache/arrow · GitHub
Skip to content

ARROW-3814: [R] RecordBatch$from_arrays() - #3565

Closed
romainfrancois wants to merge 21 commits into
apache:masterfrom
romainfrancois:ARROW-3814/record_batch_from_arrays
Closed

ARROW-3814: [R] RecordBatch$from_arrays()#3565
romainfrancois wants to merge 21 commits into
apache:masterfrom
romainfrancois:ARROW-3814/record_batch_from_arrays

Conversation

@romainfrancois

Copy link
Copy Markdown
Contributor

This started out as an implementation of RecordBatch$from_arrays() (i.e. https://issues.apache.org/jira/browse/ARROW-3814?filter=12344983) but now looks more like this issue: https://issues.apache.org/jira/browse/ARROW-3815?filter=12344983

The idea being that the record batch factory record_batch() would work with ... and schema, where each thing in the ... could be:

  • an arrow::Array
  • an R vector that can be converted to an array using array()

So where we had this before:

record_batch(tibble::tibble(x=1:10, y=1:10))

we would now have:

record_batch(x=1:10, y=1:10)

We would still be able to start from a data frame, via splicing, e.g.:

tbl <- tibble::tibble(x = 1:10, y = 1:10)
record_batch(!!!tbl)

So there would be no need for a RecordBatch$fromArray() method.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I suppose the situation is similar for the table() factory

@romainfrancoisromainfrancois added WIP PR is work in progress Component: R labels Feb 5, 2019
@codecov-io

codecov-io commented Feb 5, 2019

Copy link
Copy Markdown

Codecov Report

Merging #3565 into master will decrease coverage by 11.02%.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@## master #3565 +/- ##
===========================================
- Coverage 87.94% 76.92% -11.03% 
===========================================
Files 737 51 -686 Lines 81709 1976 -79733 Branches 1253 0 -1253 ===========================================
- Hits 71863 1520 -70343 + Misses 9599 456 -9143 + Partials 247 0 -247
Impacted FilesCoverage Δ
src/table.cpp64.17% <0%> (-4.25%)⬇️
src/array_from_vector.cpp78.29% <0%> (-0.05%)⬇️
R/write_arrow.R96.29% <0%> (ø)⬆️
R/feather.R58.33% <0%> (ø)⬆️
cpp/src/arrow/csv/chunker-test.cc
cpp/src/parquet/column_page.h
cpp/src/parquet/bloom_filter-test.cc
cpp/src/arrow/array/builder_decimal.cc
cpp/src/plasma/client.cc
cpp/src/arrow/io/test-common.h
... and 685 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5025126...ab0cd16. Read the comment docs.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

proposal for the table() function, that might be renamed Table() perhaps. The idea is that the function can handle two cases:

  • a variable list of record batches, which then results to a call to arrow::Table::FromRecordBatches :
library(arrow, warn.conflicts=FALSE)
library(purrr)
batch<- record_batch(x=1:2, y=letters[1:2])
# variable number of batchestab<- table(batch, batch, batch)
tab#> arrow::Table
as_tibble(tab)
#> # A tibble: 6 x 2#> x y #> <int> <chr>#> 1 1 a #> 2 2 b #> 3 1 a #> 4 2 b #> 5 1 a #> 6 2 b# splicing supportbatches<- map(1:10, ~record_batch(x=., y=letters[.]))
tab<- table(!!!batches)
tab#> arrow::Table
as_tibble(tab)
#> # A tibble: 10 x 2#> x y #> <int> <chr>#> 1 1 a #> 2 2 b #> 3 3 c #> 4 4 d #> 5 5 e #> 6 6 f #> 7 7 g #> 8 8 h #> 9 9 i #> 10 10 j
  • a named list of R vectors, R arrays or chunked arrays, e.g.
library(arrow, warn.conflicts=FALSE)
a<-array(rnorm(10))
tab<- table(x=1:10, y=letters[1:10], z=a)
tab$schema#> arrow::Schema #> x: int32#> y: string#> z: double
as_tibble(tab)
#> # A tibble: 10 x 3#> x y z#> <int> <chr> <dbl>#> 1 1 a 1.68 #> 2 2 b 1.61 #> 3 3 c 0.879#> 4 4 d 0.315#> 5 5 e 0.877#> 6 6 f -1.28 #> 7 7 g 0.827#> 8 8 h 0.494#> 9 9 i 1.60 #> 10 10 j -1.66# supports splicing too, e.g. tab<- table(
row.number=1:150, # R integer vector -> converted to an Array!!!iris, # columns of iris are spliced, each is converted to an arrayarr=array(rnorm(150)) # an Array already
)
tab$schema#> arrow::Schema #> row.number: int32#> Sepal.Length: double#> Sepal.Width: double#> Petal.Length: double#> Petal.Width: double#> Species: dictionary<values=string, indices=int8, ordered=0>#> arr: double
as_tibble(tab)
#> # A tibble: 150 x 7#> row.number Sepal.Length Sepal.Width Petal.Length Petal.Width Species#> <int> <dbl> <dbl> <dbl> <dbl> <fct> #> 1 1 5.1 3.5 1.4 0.2 setosa #> 2 2 4.9 3 1.4 0.2 setosa #> 3 3 4.7 3.2 1.3 0.2 setosa #> 4 4 4.6 3.1 1.5 0.2 setosa #> 5 5 5 3.6 1.4 0.2 setosa #> 6 6 5.4 3.9 1.7 0.4 setosa #> 7 7 4.6 3.4 1.4 0.3 setosa #> 8 8 5 3.4 1.5 0.2 setosa #> 9 9 4.4 2.9 1.4 0.2 setosa #> 10 10 4.9 3.1 1.5 0.1 setosa #> # … with 140 more rows, and 1 more variable: arr <dbl>

@xhochy
xhochyforce-pushed the ARROW-3814/record_batch_from_arrays branch from 7ab2a73 to 046ce90CompareFebruary 8, 2019 21:25
@xhochy

Copy link
Copy Markdown
Member

Rebased.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

@xhochy was there a special need to rebase ? Just curious.
I usually only need to rebase after an R specific PR is squashed

@xhochy

Copy link
Copy Markdown
Member

I rebased master on the release commit of the JavaScript 0.4.0 release.

We sadly only add the tagging commits to master once the release vote has passed. Then we need to rebase all PRs as we keep merging patches while the release vote runs.

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 046ce90 to cc30604CompareFebruary 13, 2019 08:59
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch 3 times, most recently from ef8b3ef to 0898ddeCompareFebruary 26, 2019 08:39
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 0898dde to 2326d85CompareMarch 6, 2019 13:39
@romainfrancois
romainfrancois requested a review from wesmMarch 6, 2019 16:19
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I think this is ready now.

@wesmwesm removed the WIP PR is work in progress label Mar 6, 2019

@wesmwesm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments but this looks like a nice improvement. I think this can be merged after some small fixes /c comments

Comment threadr/R/feather.R Outdated
Comment threadr/R/write_arrow.R Outdated
Comment threadr/src/recordbatch.cpp Outdated
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

Thanks. I’ll deal with those in the morning.

@wesm

wesm commented Mar 7, 2019

Copy link
Copy Markdown
Member

@romainfrancois this needs to be rebased now after the lint fixes, sorry about that

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 4891ac6 to 8283a94CompareMarch 8, 2019 08:06
Comment threadr/lint.sh Outdated

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we need to pass $1 to run_cpp_lint.py too ?

Removing it here allows to use

./r/lint.sh --fix

and let the tool fix the format

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch 3 times, most recently from d42da88 to f51801dCompareMarch 29, 2019 13:33
@wesm
wesmforce-pushed the ARROW-3814/record_batch_from_arrays branch from f51801d to 7f656eaCompareMay 30, 2019 18:07
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 7f656ea to 74a1e6bCompareMay 31, 2019 09:13
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I think this is good to go, but I'd like to merge #4413 first because currently this pr would fail against the new Dictionary changes from #4316

@wesm

wesm commented May 31, 2019

Copy link
Copy Markdown
Member

Sounds good

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 74a1e6b to ab0cd16CompareJune 3, 2019 07:26
wesm
wesm approved these changes Jun 3, 2019

@wesmwesm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment threadr/lint.sh Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay

expect_equal(s, batch$schema)

s <- schema(x = int32(), y = utf8())
expect_error(record_batch(x = 1:10, y = 1:10, schema = s))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If schema were a column name I guess you would have to pass the arguments differently

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.92%. Comparing base (5025126) to head (ab0cd16).

❗ There is a different number of reports uploaded between BASE (5025126) and HEAD (ab0cd16). Click for more details.

HEAD has 4 uploads less than BASE
FlagBASE (5025126)HEAD (ab0cd16)
51
Additional details and impacted files
@@ Coverage Diff @@## master #3565 +/- ##
===========================================
- Coverage 87.94% 76.92% -11.03% 
===========================================
Files 737 51 -686 Lines 81709 1976 -79733 Branches 1253 0 -1253 ===========================================
- Hits 71863 1520 -70343 + Misses 9599 456 -9143 + Partials 247 0 -247 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@romainfrancois@codecov-io@xhochy@wesm@codecov-commenter
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' ARROW-3814: [R] RecordBatch$from_arrays() by romainfrancois · Pull Request #3565 · apache/arrow · GitHub
Skip to content

ARROW-3814: [R] RecordBatch$from_arrays() - #3565

Closed
romainfrancois wants to merge 21 commits into
apache:masterfrom
romainfrancois:ARROW-3814/record_batch_from_arrays
Closed

ARROW-3814: [R] RecordBatch$from_arrays()#3565
romainfrancois wants to merge 21 commits into
apache:masterfrom
romainfrancois:ARROW-3814/record_batch_from_arrays

Conversation

@romainfrancois

Copy link
Copy Markdown
Contributor

This started out as an implementation of RecordBatch$from_arrays() (i.e. https://issues.apache.org/jira/browse/ARROW-3814?filter=12344983) but now looks more like this issue: https://issues.apache.org/jira/browse/ARROW-3815?filter=12344983

The idea being that the record batch factory record_batch() would work with ... and schema, where each thing in the ... could be:

  • an arrow::Array
  • an R vector that can be converted to an array using array()

So where we had this before:

record_batch(tibble::tibble(x=1:10, y=1:10))

we would now have:

record_batch(x=1:10, y=1:10)

We would still be able to start from a data frame, via splicing, e.g.:

tbl <- tibble::tibble(x = 1:10, y = 1:10)
record_batch(!!!tbl)

So there would be no need for a RecordBatch$fromArray() method.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I suppose the situation is similar for the table() factory

@romainfrancoisromainfrancois added WIP PR is work in progress Component: R labels Feb 5, 2019
@codecov-io

codecov-io commented Feb 5, 2019

Copy link
Copy Markdown

Codecov Report

Merging #3565 into master will decrease coverage by 11.02%.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@## master #3565 +/- ##
===========================================
- Coverage 87.94% 76.92% -11.03% 
===========================================
Files 737 51 -686 Lines 81709 1976 -79733 Branches 1253 0 -1253 ===========================================
- Hits 71863 1520 -70343 + Misses 9599 456 -9143 + Partials 247 0 -247
Impacted FilesCoverage Δ
src/table.cpp64.17% <0%> (-4.25%)⬇️
src/array_from_vector.cpp78.29% <0%> (-0.05%)⬇️
R/write_arrow.R96.29% <0%> (ø)⬆️
R/feather.R58.33% <0%> (ø)⬆️
cpp/src/arrow/csv/chunker-test.cc
cpp/src/parquet/column_page.h
cpp/src/parquet/bloom_filter-test.cc
cpp/src/arrow/array/builder_decimal.cc
cpp/src/plasma/client.cc
cpp/src/arrow/io/test-common.h
... and 685 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5025126...ab0cd16. Read the comment docs.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

proposal for the table() function, that might be renamed Table() perhaps. The idea is that the function can handle two cases:

  • a variable list of record batches, which then results to a call to arrow::Table::FromRecordBatches :
library(arrow, warn.conflicts=FALSE)
library(purrr)
batch<- record_batch(x=1:2, y=letters[1:2])
# variable number of batchestab<- table(batch, batch, batch)
tab#> arrow::Table
as_tibble(tab)
#> # A tibble: 6 x 2#> x y #> <int> <chr>#> 1 1 a #> 2 2 b #> 3 1 a #> 4 2 b #> 5 1 a #> 6 2 b# splicing supportbatches<- map(1:10, ~record_batch(x=., y=letters[.]))
tab<- table(!!!batches)
tab#> arrow::Table
as_tibble(tab)
#> # A tibble: 10 x 2#> x y #> <int> <chr>#> 1 1 a #> 2 2 b #> 3 3 c #> 4 4 d #> 5 5 e #> 6 6 f #> 7 7 g #> 8 8 h #> 9 9 i #> 10 10 j
  • a named list of R vectors, R arrays or chunked arrays, e.g.
library(arrow, warn.conflicts=FALSE)
a<-array(rnorm(10))
tab<- table(x=1:10, y=letters[1:10], z=a)
tab$schema#> arrow::Schema #> x: int32#> y: string#> z: double
as_tibble(tab)
#> # A tibble: 10 x 3#> x y z#> <int> <chr> <dbl>#> 1 1 a 1.68 #> 2 2 b 1.61 #> 3 3 c 0.879#> 4 4 d 0.315#> 5 5 e 0.877#> 6 6 f -1.28 #> 7 7 g 0.827#> 8 8 h 0.494#> 9 9 i 1.60 #> 10 10 j -1.66# supports splicing too, e.g. tab<- table(
row.number=1:150, # R integer vector -> converted to an Array!!!iris, # columns of iris are spliced, each is converted to an arrayarr=array(rnorm(150)) # an Array already
)
tab$schema#> arrow::Schema #> row.number: int32#> Sepal.Length: double#> Sepal.Width: double#> Petal.Length: double#> Petal.Width: double#> Species: dictionary<values=string, indices=int8, ordered=0>#> arr: double
as_tibble(tab)
#> # A tibble: 150 x 7#> row.number Sepal.Length Sepal.Width Petal.Length Petal.Width Species#> <int> <dbl> <dbl> <dbl> <dbl> <fct> #> 1 1 5.1 3.5 1.4 0.2 setosa #> 2 2 4.9 3 1.4 0.2 setosa #> 3 3 4.7 3.2 1.3 0.2 setosa #> 4 4 4.6 3.1 1.5 0.2 setosa #> 5 5 5 3.6 1.4 0.2 setosa #> 6 6 5.4 3.9 1.7 0.4 setosa #> 7 7 4.6 3.4 1.4 0.3 setosa #> 8 8 5 3.4 1.5 0.2 setosa #> 9 9 4.4 2.9 1.4 0.2 setosa #> 10 10 4.9 3.1 1.5 0.1 setosa #> # … with 140 more rows, and 1 more variable: arr <dbl>

@xhochy
xhochyforce-pushed the ARROW-3814/record_batch_from_arrays branch from 7ab2a73 to 046ce90CompareFebruary 8, 2019 21:25
@xhochy

Copy link
Copy Markdown
Member

Rebased.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

@xhochy was there a special need to rebase ? Just curious.
I usually only need to rebase after an R specific PR is squashed

@xhochy

Copy link
Copy Markdown
Member

I rebased master on the release commit of the JavaScript 0.4.0 release.

We sadly only add the tagging commits to master once the release vote has passed. Then we need to rebase all PRs as we keep merging patches while the release vote runs.

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 046ce90 to cc30604CompareFebruary 13, 2019 08:59
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch 3 times, most recently from ef8b3ef to 0898ddeCompareFebruary 26, 2019 08:39
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 0898dde to 2326d85CompareMarch 6, 2019 13:39
@romainfrancois
romainfrancois requested a review from wesmMarch 6, 2019 16:19
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I think this is ready now.

@wesmwesm removed the WIP PR is work in progress label Mar 6, 2019

@wesmwesm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments but this looks like a nice improvement. I think this can be merged after some small fixes /c comments

Comment threadr/R/feather.R Outdated
Comment threadr/R/write_arrow.R Outdated
Comment threadr/src/recordbatch.cpp Outdated
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

Thanks. I’ll deal with those in the morning.

@wesm

wesm commented Mar 7, 2019

Copy link
Copy Markdown
Member

@romainfrancois this needs to be rebased now after the lint fixes, sorry about that

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 4891ac6 to 8283a94CompareMarch 8, 2019 08:06
Comment threadr/lint.sh Outdated

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we need to pass $1 to run_cpp_lint.py too ?

Removing it here allows to use

./r/lint.sh --fix

and let the tool fix the format

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch 3 times, most recently from d42da88 to f51801dCompareMarch 29, 2019 13:33
@wesm
wesmforce-pushed the ARROW-3814/record_batch_from_arrays branch from f51801d to 7f656eaCompareMay 30, 2019 18:07
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 7f656ea to 74a1e6bCompareMay 31, 2019 09:13
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I think this is good to go, but I'd like to merge #4413 first because currently this pr would fail against the new Dictionary changes from #4316

@wesm

wesm commented May 31, 2019

Copy link
Copy Markdown
Member

Sounds good

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 74a1e6b to ab0cd16CompareJune 3, 2019 07:26
wesm
wesm approved these changes Jun 3, 2019

@wesmwesm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment threadr/lint.sh Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay

expect_equal(s, batch$schema)

s <- schema(x = int32(), y = utf8())
expect_error(record_batch(x = 1:10, y = 1:10, schema = s))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If schema were a column name I guess you would have to pass the arguments differently

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.92%. Comparing base (5025126) to head (ab0cd16).

❗ There is a different number of reports uploaded between BASE (5025126) and HEAD (ab0cd16). Click for more details.

HEAD has 4 uploads less than BASE
FlagBASE (5025126)HEAD (ab0cd16)
51
Additional details and impacted files
@@ Coverage Diff @@## master #3565 +/- ##
===========================================
- Coverage 87.94% 76.92% -11.03% 
===========================================
Files 737 51 -686 Lines 81709 1976 -79733 Branches 1253 0 -1253 ===========================================
- Hits 71863 1520 -70343 + Misses 9599 456 -9143 + Partials 247 0 -247 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@romainfrancois@codecov-io@xhochy@wesm@codecov-commenter
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' ARROW-3814: [R] RecordBatch$from_arrays() by romainfrancois · Pull Request #3565 · apache/arrow · GitHub
Skip to content

ARROW-3814: [R] RecordBatch$from_arrays() - #3565

Closed
romainfrancois wants to merge 21 commits into
apache:masterfrom
romainfrancois:ARROW-3814/record_batch_from_arrays
Closed

ARROW-3814: [R] RecordBatch$from_arrays()#3565
romainfrancois wants to merge 21 commits into
apache:masterfrom
romainfrancois:ARROW-3814/record_batch_from_arrays

Conversation

@romainfrancois

Copy link
Copy Markdown
Contributor

This started out as an implementation of RecordBatch$from_arrays() (i.e. https://issues.apache.org/jira/browse/ARROW-3814?filter=12344983) but now looks more like this issue: https://issues.apache.org/jira/browse/ARROW-3815?filter=12344983

The idea being that the record batch factory record_batch() would work with ... and schema, where each thing in the ... could be:

  • an arrow::Array
  • an R vector that can be converted to an array using array()

So where we had this before:

record_batch(tibble::tibble(x=1:10, y=1:10))

we would now have:

record_batch(x=1:10, y=1:10)

We would still be able to start from a data frame, via splicing, e.g.:

tbl <- tibble::tibble(x = 1:10, y = 1:10)
record_batch(!!!tbl)

So there would be no need for a RecordBatch$fromArray() method.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I suppose the situation is similar for the table() factory

@romainfrancoisromainfrancois added WIP PR is work in progress Component: R labels Feb 5, 2019
@codecov-io

codecov-io commented Feb 5, 2019

Copy link
Copy Markdown

Codecov Report

Merging #3565 into master will decrease coverage by 11.02%.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@## master #3565 +/- ##
===========================================
- Coverage 87.94% 76.92% -11.03% 
===========================================
Files 737 51 -686 Lines 81709 1976 -79733 Branches 1253 0 -1253 ===========================================
- Hits 71863 1520 -70343 + Misses 9599 456 -9143 + Partials 247 0 -247
Impacted FilesCoverage Δ
src/table.cpp64.17% <0%> (-4.25%)⬇️
src/array_from_vector.cpp78.29% <0%> (-0.05%)⬇️
R/write_arrow.R96.29% <0%> (ø)⬆️
R/feather.R58.33% <0%> (ø)⬆️
cpp/src/arrow/csv/chunker-test.cc
cpp/src/parquet/column_page.h
cpp/src/parquet/bloom_filter-test.cc
cpp/src/arrow/array/builder_decimal.cc
cpp/src/plasma/client.cc
cpp/src/arrow/io/test-common.h
... and 685 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5025126...ab0cd16. Read the comment docs.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

proposal for the table() function, that might be renamed Table() perhaps. The idea is that the function can handle two cases:

  • a variable list of record batches, which then results to a call to arrow::Table::FromRecordBatches :
library(arrow, warn.conflicts=FALSE)
library(purrr)
batch<- record_batch(x=1:2, y=letters[1:2])
# variable number of batchestab<- table(batch, batch, batch)
tab#> arrow::Table
as_tibble(tab)
#> # A tibble: 6 x 2#> x y #> <int> <chr>#> 1 1 a #> 2 2 b #> 3 1 a #> 4 2 b #> 5 1 a #> 6 2 b# splicing supportbatches<- map(1:10, ~record_batch(x=., y=letters[.]))
tab<- table(!!!batches)
tab#> arrow::Table
as_tibble(tab)
#> # A tibble: 10 x 2#> x y #> <int> <chr>#> 1 1 a #> 2 2 b #> 3 3 c #> 4 4 d #> 5 5 e #> 6 6 f #> 7 7 g #> 8 8 h #> 9 9 i #> 10 10 j
  • a named list of R vectors, R arrays or chunked arrays, e.g.
library(arrow, warn.conflicts=FALSE)
a<-array(rnorm(10))
tab<- table(x=1:10, y=letters[1:10], z=a)
tab$schema#> arrow::Schema #> x: int32#> y: string#> z: double
as_tibble(tab)
#> # A tibble: 10 x 3#> x y z#> <int> <chr> <dbl>#> 1 1 a 1.68 #> 2 2 b 1.61 #> 3 3 c 0.879#> 4 4 d 0.315#> 5 5 e 0.877#> 6 6 f -1.28 #> 7 7 g 0.827#> 8 8 h 0.494#> 9 9 i 1.60 #> 10 10 j -1.66# supports splicing too, e.g. tab<- table(
row.number=1:150, # R integer vector -> converted to an Array!!!iris, # columns of iris are spliced, each is converted to an arrayarr=array(rnorm(150)) # an Array already
)
tab$schema#> arrow::Schema #> row.number: int32#> Sepal.Length: double#> Sepal.Width: double#> Petal.Length: double#> Petal.Width: double#> Species: dictionary<values=string, indices=int8, ordered=0>#> arr: double
as_tibble(tab)
#> # A tibble: 150 x 7#> row.number Sepal.Length Sepal.Width Petal.Length Petal.Width Species#> <int> <dbl> <dbl> <dbl> <dbl> <fct> #> 1 1 5.1 3.5 1.4 0.2 setosa #> 2 2 4.9 3 1.4 0.2 setosa #> 3 3 4.7 3.2 1.3 0.2 setosa #> 4 4 4.6 3.1 1.5 0.2 setosa #> 5 5 5 3.6 1.4 0.2 setosa #> 6 6 5.4 3.9 1.7 0.4 setosa #> 7 7 4.6 3.4 1.4 0.3 setosa #> 8 8 5 3.4 1.5 0.2 setosa #> 9 9 4.4 2.9 1.4 0.2 setosa #> 10 10 4.9 3.1 1.5 0.1 setosa #> # … with 140 more rows, and 1 more variable: arr <dbl>

@xhochy
xhochyforce-pushed the ARROW-3814/record_batch_from_arrays branch from 7ab2a73 to 046ce90CompareFebruary 8, 2019 21:25
@xhochy

Copy link
Copy Markdown
Member

Rebased.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

@xhochy was there a special need to rebase ? Just curious.
I usually only need to rebase after an R specific PR is squashed

@xhochy

Copy link
Copy Markdown
Member

I rebased master on the release commit of the JavaScript 0.4.0 release.

We sadly only add the tagging commits to master once the release vote has passed. Then we need to rebase all PRs as we keep merging patches while the release vote runs.

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 046ce90 to cc30604CompareFebruary 13, 2019 08:59
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch 3 times, most recently from ef8b3ef to 0898ddeCompareFebruary 26, 2019 08:39
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 0898dde to 2326d85CompareMarch 6, 2019 13:39
@romainfrancois
romainfrancois requested a review from wesmMarch 6, 2019 16:19
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I think this is ready now.

@wesmwesm removed the WIP PR is work in progress label Mar 6, 2019

@wesmwesm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments but this looks like a nice improvement. I think this can be merged after some small fixes /c comments

Comment threadr/R/feather.R Outdated
Comment threadr/R/write_arrow.R Outdated
Comment threadr/src/recordbatch.cpp Outdated
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

Thanks. I’ll deal with those in the morning.

@wesm

wesm commented Mar 7, 2019

Copy link
Copy Markdown
Member

@romainfrancois this needs to be rebased now after the lint fixes, sorry about that

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 4891ac6 to 8283a94CompareMarch 8, 2019 08:06
Comment threadr/lint.sh Outdated

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we need to pass $1 to run_cpp_lint.py too ?

Removing it here allows to use

./r/lint.sh --fix

and let the tool fix the format

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch 3 times, most recently from d42da88 to f51801dCompareMarch 29, 2019 13:33
@wesm
wesmforce-pushed the ARROW-3814/record_batch_from_arrays branch from f51801d to 7f656eaCompareMay 30, 2019 18:07
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 7f656ea to 74a1e6bCompareMay 31, 2019 09:13
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I think this is good to go, but I'd like to merge #4413 first because currently this pr would fail against the new Dictionary changes from #4316

@wesm

wesm commented May 31, 2019

Copy link
Copy Markdown
Member

Sounds good

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 74a1e6b to ab0cd16CompareJune 3, 2019 07:26
wesm
wesm approved these changes Jun 3, 2019

@wesmwesm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment threadr/lint.sh Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay

expect_equal(s, batch$schema)

s <- schema(x = int32(), y = utf8())
expect_error(record_batch(x = 1:10, y = 1:10, schema = s))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If schema were a column name I guess you would have to pass the arguments differently

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.92%. Comparing base (5025126) to head (ab0cd16).

❗ There is a different number of reports uploaded between BASE (5025126) and HEAD (ab0cd16). Click for more details.

HEAD has 4 uploads less than BASE
FlagBASE (5025126)HEAD (ab0cd16)
51
Additional details and impacted files
@@ Coverage Diff @@## master #3565 +/- ##
===========================================
- Coverage 87.94% 76.92% -11.03% 
===========================================
Files 737 51 -686 Lines 81709 1976 -79733 Branches 1253 0 -1253 ===========================================
- Hits 71863 1520 -70343 + Misses 9599 456 -9143 + Partials 247 0 -247 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@romainfrancois@codecov-io@xhochy@wesm@codecov-commenter
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' ARROW-3814: [R] RecordBatch$from_arrays() by romainfrancois · Pull Request #3565 · apache/arrow · GitHub
Skip to content

ARROW-3814: [R] RecordBatch$from_arrays() - #3565

Closed
romainfrancois wants to merge 21 commits into
apache:masterfrom
romainfrancois:ARROW-3814/record_batch_from_arrays
Closed

ARROW-3814: [R] RecordBatch$from_arrays()#3565
romainfrancois wants to merge 21 commits into
apache:masterfrom
romainfrancois:ARROW-3814/record_batch_from_arrays

Conversation

@romainfrancois

Copy link
Copy Markdown
Contributor

This started out as an implementation of RecordBatch$from_arrays() (i.e. https://issues.apache.org/jira/browse/ARROW-3814?filter=12344983) but now looks more like this issue: https://issues.apache.org/jira/browse/ARROW-3815?filter=12344983

The idea being that the record batch factory record_batch() would work with ... and schema, where each thing in the ... could be:

  • an arrow::Array
  • an R vector that can be converted to an array using array()

So where we had this before:

record_batch(tibble::tibble(x=1:10, y=1:10))

we would now have:

record_batch(x=1:10, y=1:10)

We would still be able to start from a data frame, via splicing, e.g.:

tbl <- tibble::tibble(x = 1:10, y = 1:10)
record_batch(!!!tbl)

So there would be no need for a RecordBatch$fromArray() method.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I suppose the situation is similar for the table() factory

@romainfrancoisromainfrancois added WIP PR is work in progress Component: R labels Feb 5, 2019
@codecov-io

codecov-io commented Feb 5, 2019

Copy link
Copy Markdown

Codecov Report

Merging #3565 into master will decrease coverage by 11.02%.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@## master #3565 +/- ##
===========================================
- Coverage 87.94% 76.92% -11.03% 
===========================================
Files 737 51 -686 Lines 81709 1976 -79733 Branches 1253 0 -1253 ===========================================
- Hits 71863 1520 -70343 + Misses 9599 456 -9143 + Partials 247 0 -247
Impacted FilesCoverage Δ
src/table.cpp64.17% <0%> (-4.25%)⬇️
src/array_from_vector.cpp78.29% <0%> (-0.05%)⬇️
R/write_arrow.R96.29% <0%> (ø)⬆️
R/feather.R58.33% <0%> (ø)⬆️
cpp/src/arrow/csv/chunker-test.cc
cpp/src/parquet/column_page.h
cpp/src/parquet/bloom_filter-test.cc
cpp/src/arrow/array/builder_decimal.cc
cpp/src/plasma/client.cc
cpp/src/arrow/io/test-common.h
... and 685 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5025126...ab0cd16. Read the comment docs.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

proposal for the table() function, that might be renamed Table() perhaps. The idea is that the function can handle two cases:

  • a variable list of record batches, which then results to a call to arrow::Table::FromRecordBatches :
library(arrow, warn.conflicts=FALSE)
library(purrr)
batch<- record_batch(x=1:2, y=letters[1:2])
# variable number of batchestab<- table(batch, batch, batch)
tab#> arrow::Table
as_tibble(tab)
#> # A tibble: 6 x 2#> x y #> <int> <chr>#> 1 1 a #> 2 2 b #> 3 1 a #> 4 2 b #> 5 1 a #> 6 2 b# splicing supportbatches<- map(1:10, ~record_batch(x=., y=letters[.]))
tab<- table(!!!batches)
tab#> arrow::Table
as_tibble(tab)
#> # A tibble: 10 x 2#> x y #> <int> <chr>#> 1 1 a #> 2 2 b #> 3 3 c #> 4 4 d #> 5 5 e #> 6 6 f #> 7 7 g #> 8 8 h #> 9 9 i #> 10 10 j
  • a named list of R vectors, R arrays or chunked arrays, e.g.
library(arrow, warn.conflicts=FALSE)
a<-array(rnorm(10))
tab<- table(x=1:10, y=letters[1:10], z=a)
tab$schema#> arrow::Schema #> x: int32#> y: string#> z: double
as_tibble(tab)
#> # A tibble: 10 x 3#> x y z#> <int> <chr> <dbl>#> 1 1 a 1.68 #> 2 2 b 1.61 #> 3 3 c 0.879#> 4 4 d 0.315#> 5 5 e 0.877#> 6 6 f -1.28 #> 7 7 g 0.827#> 8 8 h 0.494#> 9 9 i 1.60 #> 10 10 j -1.66# supports splicing too, e.g. tab<- table(
row.number=1:150, # R integer vector -> converted to an Array!!!iris, # columns of iris are spliced, each is converted to an arrayarr=array(rnorm(150)) # an Array already
)
tab$schema#> arrow::Schema #> row.number: int32#> Sepal.Length: double#> Sepal.Width: double#> Petal.Length: double#> Petal.Width: double#> Species: dictionary<values=string, indices=int8, ordered=0>#> arr: double
as_tibble(tab)
#> # A tibble: 150 x 7#> row.number Sepal.Length Sepal.Width Petal.Length Petal.Width Species#> <int> <dbl> <dbl> <dbl> <dbl> <fct> #> 1 1 5.1 3.5 1.4 0.2 setosa #> 2 2 4.9 3 1.4 0.2 setosa #> 3 3 4.7 3.2 1.3 0.2 setosa #> 4 4 4.6 3.1 1.5 0.2 setosa #> 5 5 5 3.6 1.4 0.2 setosa #> 6 6 5.4 3.9 1.7 0.4 setosa #> 7 7 4.6 3.4 1.4 0.3 setosa #> 8 8 5 3.4 1.5 0.2 setosa #> 9 9 4.4 2.9 1.4 0.2 setosa #> 10 10 4.9 3.1 1.5 0.1 setosa #> # … with 140 more rows, and 1 more variable: arr <dbl>

@xhochy
xhochyforce-pushed the ARROW-3814/record_batch_from_arrays branch from 7ab2a73 to 046ce90CompareFebruary 8, 2019 21:25
@xhochy

Copy link
Copy Markdown
Member

Rebased.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

@xhochy was there a special need to rebase ? Just curious.
I usually only need to rebase after an R specific PR is squashed

@xhochy

Copy link
Copy Markdown
Member

I rebased master on the release commit of the JavaScript 0.4.0 release.

We sadly only add the tagging commits to master once the release vote has passed. Then we need to rebase all PRs as we keep merging patches while the release vote runs.

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 046ce90 to cc30604CompareFebruary 13, 2019 08:59
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch 3 times, most recently from ef8b3ef to 0898ddeCompareFebruary 26, 2019 08:39
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 0898dde to 2326d85CompareMarch 6, 2019 13:39
@romainfrancois
romainfrancois requested a review from wesmMarch 6, 2019 16:19
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I think this is ready now.

@wesmwesm removed the WIP PR is work in progress label Mar 6, 2019

@wesmwesm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments but this looks like a nice improvement. I think this can be merged after some small fixes /c comments

Comment threadr/R/feather.R Outdated
Comment threadr/R/write_arrow.R Outdated
Comment threadr/src/recordbatch.cpp Outdated
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

Thanks. I’ll deal with those in the morning.

@wesm

wesm commented Mar 7, 2019

Copy link
Copy Markdown
Member

@romainfrancois this needs to be rebased now after the lint fixes, sorry about that

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 4891ac6 to 8283a94CompareMarch 8, 2019 08:06
Comment threadr/lint.sh Outdated

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we need to pass $1 to run_cpp_lint.py too ?

Removing it here allows to use

./r/lint.sh --fix

and let the tool fix the format

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch 3 times, most recently from d42da88 to f51801dCompareMarch 29, 2019 13:33
@wesm
wesmforce-pushed the ARROW-3814/record_batch_from_arrays branch from f51801d to 7f656eaCompareMay 30, 2019 18:07
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 7f656ea to 74a1e6bCompareMay 31, 2019 09:13
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I think this is good to go, but I'd like to merge #4413 first because currently this pr would fail against the new Dictionary changes from #4316

@wesm

wesm commented May 31, 2019

Copy link
Copy Markdown
Member

Sounds good

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 74a1e6b to ab0cd16CompareJune 3, 2019 07:26
wesm
wesm approved these changes Jun 3, 2019

@wesmwesm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment threadr/lint.sh Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay

expect_equal(s, batch$schema)

s <- schema(x = int32(), y = utf8())
expect_error(record_batch(x = 1:10, y = 1:10, schema = s))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If schema were a column name I guess you would have to pass the arguments differently

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.92%. Comparing base (5025126) to head (ab0cd16).

❗ There is a different number of reports uploaded between BASE (5025126) and HEAD (ab0cd16). Click for more details.

HEAD has 4 uploads less than BASE
FlagBASE (5025126)HEAD (ab0cd16)
51
Additional details and impacted files
@@ Coverage Diff @@## master #3565 +/- ##
===========================================
- Coverage 87.94% 76.92% -11.03% 
===========================================
Files 737 51 -686 Lines 81709 1976 -79733 Branches 1253 0 -1253 ===========================================
- Hits 71863 1520 -70343 + Misses 9599 456 -9143 + Partials 247 0 -247 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@romainfrancois@codecov-io@xhochy@wesm@codecov-commenter
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' ARROW-3814: [R] RecordBatch$from_arrays() by romainfrancois · Pull Request #3565 · apache/arrow · GitHub
Skip to content

ARROW-3814: [R] RecordBatch$from_arrays() - #3565

Closed
romainfrancois wants to merge 21 commits into
apache:masterfrom
romainfrancois:ARROW-3814/record_batch_from_arrays
Closed

ARROW-3814: [R] RecordBatch$from_arrays()#3565
romainfrancois wants to merge 21 commits into
apache:masterfrom
romainfrancois:ARROW-3814/record_batch_from_arrays

Conversation

@romainfrancois

Copy link
Copy Markdown
Contributor

This started out as an implementation of RecordBatch$from_arrays() (i.e. https://issues.apache.org/jira/browse/ARROW-3814?filter=12344983) but now looks more like this issue: https://issues.apache.org/jira/browse/ARROW-3815?filter=12344983

The idea being that the record batch factory record_batch() would work with ... and schema, where each thing in the ... could be:

  • an arrow::Array
  • an R vector that can be converted to an array using array()

So where we had this before:

record_batch(tibble::tibble(x=1:10, y=1:10))

we would now have:

record_batch(x=1:10, y=1:10)

We would still be able to start from a data frame, via splicing, e.g.:

tbl <- tibble::tibble(x = 1:10, y = 1:10)
record_batch(!!!tbl)

So there would be no need for a RecordBatch$fromArray() method.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I suppose the situation is similar for the table() factory

@romainfrancoisromainfrancois added WIP PR is work in progress Component: R labels Feb 5, 2019
@codecov-io

codecov-io commented Feb 5, 2019

Copy link
Copy Markdown

Codecov Report

Merging #3565 into master will decrease coverage by 11.02%.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@## master #3565 +/- ##
===========================================
- Coverage 87.94% 76.92% -11.03% 
===========================================
Files 737 51 -686 Lines 81709 1976 -79733 Branches 1253 0 -1253 ===========================================
- Hits 71863 1520 -70343 + Misses 9599 456 -9143 + Partials 247 0 -247
Impacted FilesCoverage Δ
src/table.cpp64.17% <0%> (-4.25%)⬇️
src/array_from_vector.cpp78.29% <0%> (-0.05%)⬇️
R/write_arrow.R96.29% <0%> (ø)⬆️
R/feather.R58.33% <0%> (ø)⬆️
cpp/src/arrow/csv/chunker-test.cc
cpp/src/parquet/column_page.h
cpp/src/parquet/bloom_filter-test.cc
cpp/src/arrow/array/builder_decimal.cc
cpp/src/plasma/client.cc
cpp/src/arrow/io/test-common.h
... and 685 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5025126...ab0cd16. Read the comment docs.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

proposal for the table() function, that might be renamed Table() perhaps. The idea is that the function can handle two cases:

  • a variable list of record batches, which then results to a call to arrow::Table::FromRecordBatches :
library(arrow, warn.conflicts=FALSE)
library(purrr)
batch<- record_batch(x=1:2, y=letters[1:2])
# variable number of batchestab<- table(batch, batch, batch)
tab#> arrow::Table
as_tibble(tab)
#> # A tibble: 6 x 2#> x y #> <int> <chr>#> 1 1 a #> 2 2 b #> 3 1 a #> 4 2 b #> 5 1 a #> 6 2 b# splicing supportbatches<- map(1:10, ~record_batch(x=., y=letters[.]))
tab<- table(!!!batches)
tab#> arrow::Table
as_tibble(tab)
#> # A tibble: 10 x 2#> x y #> <int> <chr>#> 1 1 a #> 2 2 b #> 3 3 c #> 4 4 d #> 5 5 e #> 6 6 f #> 7 7 g #> 8 8 h #> 9 9 i #> 10 10 j
  • a named list of R vectors, R arrays or chunked arrays, e.g.
library(arrow, warn.conflicts=FALSE)
a<-array(rnorm(10))
tab<- table(x=1:10, y=letters[1:10], z=a)
tab$schema#> arrow::Schema #> x: int32#> y: string#> z: double
as_tibble(tab)
#> # A tibble: 10 x 3#> x y z#> <int> <chr> <dbl>#> 1 1 a 1.68 #> 2 2 b 1.61 #> 3 3 c 0.879#> 4 4 d 0.315#> 5 5 e 0.877#> 6 6 f -1.28 #> 7 7 g 0.827#> 8 8 h 0.494#> 9 9 i 1.60 #> 10 10 j -1.66# supports splicing too, e.g. tab<- table(
row.number=1:150, # R integer vector -> converted to an Array!!!iris, # columns of iris are spliced, each is converted to an arrayarr=array(rnorm(150)) # an Array already
)
tab$schema#> arrow::Schema #> row.number: int32#> Sepal.Length: double#> Sepal.Width: double#> Petal.Length: double#> Petal.Width: double#> Species: dictionary<values=string, indices=int8, ordered=0>#> arr: double
as_tibble(tab)
#> # A tibble: 150 x 7#> row.number Sepal.Length Sepal.Width Petal.Length Petal.Width Species#> <int> <dbl> <dbl> <dbl> <dbl> <fct> #> 1 1 5.1 3.5 1.4 0.2 setosa #> 2 2 4.9 3 1.4 0.2 setosa #> 3 3 4.7 3.2 1.3 0.2 setosa #> 4 4 4.6 3.1 1.5 0.2 setosa #> 5 5 5 3.6 1.4 0.2 setosa #> 6 6 5.4 3.9 1.7 0.4 setosa #> 7 7 4.6 3.4 1.4 0.3 setosa #> 8 8 5 3.4 1.5 0.2 setosa #> 9 9 4.4 2.9 1.4 0.2 setosa #> 10 10 4.9 3.1 1.5 0.1 setosa #> # … with 140 more rows, and 1 more variable: arr <dbl>

@xhochy
xhochyforce-pushed the ARROW-3814/record_batch_from_arrays branch from 7ab2a73 to 046ce90CompareFebruary 8, 2019 21:25
@xhochy

Copy link
Copy Markdown
Member

Rebased.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

@xhochy was there a special need to rebase ? Just curious.
I usually only need to rebase after an R specific PR is squashed

@xhochy

Copy link
Copy Markdown
Member

I rebased master on the release commit of the JavaScript 0.4.0 release.

We sadly only add the tagging commits to master once the release vote has passed. Then we need to rebase all PRs as we keep merging patches while the release vote runs.

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 046ce90 to cc30604CompareFebruary 13, 2019 08:59
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch 3 times, most recently from ef8b3ef to 0898ddeCompareFebruary 26, 2019 08:39
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 0898dde to 2326d85CompareMarch 6, 2019 13:39
@romainfrancois
romainfrancois requested a review from wesmMarch 6, 2019 16:19
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I think this is ready now.

@wesmwesm removed the WIP PR is work in progress label Mar 6, 2019

@wesmwesm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments but this looks like a nice improvement. I think this can be merged after some small fixes /c comments

Comment threadr/R/feather.R Outdated
Comment threadr/R/write_arrow.R Outdated
Comment threadr/src/recordbatch.cpp Outdated
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

Thanks. I’ll deal with those in the morning.

@wesm

wesm commented Mar 7, 2019

Copy link
Copy Markdown
Member

@romainfrancois this needs to be rebased now after the lint fixes, sorry about that

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 4891ac6 to 8283a94CompareMarch 8, 2019 08:06
Comment threadr/lint.sh Outdated

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we need to pass $1 to run_cpp_lint.py too ?

Removing it here allows to use

./r/lint.sh --fix

and let the tool fix the format

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch 3 times, most recently from d42da88 to f51801dCompareMarch 29, 2019 13:33
@wesm
wesmforce-pushed the ARROW-3814/record_batch_from_arrays branch from f51801d to 7f656eaCompareMay 30, 2019 18:07
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 7f656ea to 74a1e6bCompareMay 31, 2019 09:13
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I think this is good to go, but I'd like to merge #4413 first because currently this pr would fail against the new Dictionary changes from #4316

@wesm

wesm commented May 31, 2019

Copy link
Copy Markdown
Member

Sounds good

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 74a1e6b to ab0cd16CompareJune 3, 2019 07:26
wesm
wesm approved these changes Jun 3, 2019

@wesmwesm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment threadr/lint.sh Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay

expect_equal(s, batch$schema)

s <- schema(x = int32(), y = utf8())
expect_error(record_batch(x = 1:10, y = 1:10, schema = s))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If schema were a column name I guess you would have to pass the arguments differently

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.92%. Comparing base (5025126) to head (ab0cd16).

❗ There is a different number of reports uploaded between BASE (5025126) and HEAD (ab0cd16). Click for more details.

HEAD has 4 uploads less than BASE
FlagBASE (5025126)HEAD (ab0cd16)
51
Additional details and impacted files
@@ Coverage Diff @@## master #3565 +/- ##
===========================================
- Coverage 87.94% 76.92% -11.03% 
===========================================
Files 737 51 -686 Lines 81709 1976 -79733 Branches 1253 0 -1253 ===========================================
- Hits 71863 1520 -70343 + Misses 9599 456 -9143 + Partials 247 0 -247 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@romainfrancois@codecov-io@xhochy@wesm@codecov-commenter
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' ARROW-3814: [R] RecordBatch$from_arrays() by romainfrancois · Pull Request #3565 · apache/arrow · GitHub
Skip to content

ARROW-3814: [R] RecordBatch$from_arrays() - #3565

Closed
romainfrancois wants to merge 21 commits into
apache:masterfrom
romainfrancois:ARROW-3814/record_batch_from_arrays
Closed

ARROW-3814: [R] RecordBatch$from_arrays()#3565
romainfrancois wants to merge 21 commits into
apache:masterfrom
romainfrancois:ARROW-3814/record_batch_from_arrays

Conversation

@romainfrancois

Copy link
Copy Markdown
Contributor

This started out as an implementation of RecordBatch$from_arrays() (i.e. https://issues.apache.org/jira/browse/ARROW-3814?filter=12344983) but now looks more like this issue: https://issues.apache.org/jira/browse/ARROW-3815?filter=12344983

The idea being that the record batch factory record_batch() would work with ... and schema, where each thing in the ... could be:

  • an arrow::Array
  • an R vector that can be converted to an array using array()

So where we had this before:

record_batch(tibble::tibble(x=1:10, y=1:10))

we would now have:

record_batch(x=1:10, y=1:10)

We would still be able to start from a data frame, via splicing, e.g.:

tbl <- tibble::tibble(x = 1:10, y = 1:10)
record_batch(!!!tbl)

So there would be no need for a RecordBatch$fromArray() method.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I suppose the situation is similar for the table() factory

@romainfrancoisromainfrancois added WIP PR is work in progress Component: R labels Feb 5, 2019
@codecov-io

codecov-io commented Feb 5, 2019

Copy link
Copy Markdown

Codecov Report

Merging #3565 into master will decrease coverage by 11.02%.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@## master #3565 +/- ##
===========================================
- Coverage 87.94% 76.92% -11.03% 
===========================================
Files 737 51 -686 Lines 81709 1976 -79733 Branches 1253 0 -1253 ===========================================
- Hits 71863 1520 -70343 + Misses 9599 456 -9143 + Partials 247 0 -247
Impacted FilesCoverage Δ
src/table.cpp64.17% <0%> (-4.25%)⬇️
src/array_from_vector.cpp78.29% <0%> (-0.05%)⬇️
R/write_arrow.R96.29% <0%> (ø)⬆️
R/feather.R58.33% <0%> (ø)⬆️
cpp/src/arrow/csv/chunker-test.cc
cpp/src/parquet/column_page.h
cpp/src/parquet/bloom_filter-test.cc
cpp/src/arrow/array/builder_decimal.cc
cpp/src/plasma/client.cc
cpp/src/arrow/io/test-common.h
... and 685 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5025126...ab0cd16. Read the comment docs.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

proposal for the table() function, that might be renamed Table() perhaps. The idea is that the function can handle two cases:

  • a variable list of record batches, which then results to a call to arrow::Table::FromRecordBatches :
library(arrow, warn.conflicts=FALSE)
library(purrr)
batch<- record_batch(x=1:2, y=letters[1:2])
# variable number of batchestab<- table(batch, batch, batch)
tab#> arrow::Table
as_tibble(tab)
#> # A tibble: 6 x 2#> x y #> <int> <chr>#> 1 1 a #> 2 2 b #> 3 1 a #> 4 2 b #> 5 1 a #> 6 2 b# splicing supportbatches<- map(1:10, ~record_batch(x=., y=letters[.]))
tab<- table(!!!batches)
tab#> arrow::Table
as_tibble(tab)
#> # A tibble: 10 x 2#> x y #> <int> <chr>#> 1 1 a #> 2 2 b #> 3 3 c #> 4 4 d #> 5 5 e #> 6 6 f #> 7 7 g #> 8 8 h #> 9 9 i #> 10 10 j
  • a named list of R vectors, R arrays or chunked arrays, e.g.
library(arrow, warn.conflicts=FALSE)
a<-array(rnorm(10))
tab<- table(x=1:10, y=letters[1:10], z=a)
tab$schema#> arrow::Schema #> x: int32#> y: string#> z: double
as_tibble(tab)
#> # A tibble: 10 x 3#> x y z#> <int> <chr> <dbl>#> 1 1 a 1.68 #> 2 2 b 1.61 #> 3 3 c 0.879#> 4 4 d 0.315#> 5 5 e 0.877#> 6 6 f -1.28 #> 7 7 g 0.827#> 8 8 h 0.494#> 9 9 i 1.60 #> 10 10 j -1.66# supports splicing too, e.g. tab<- table(
row.number=1:150, # R integer vector -> converted to an Array!!!iris, # columns of iris are spliced, each is converted to an arrayarr=array(rnorm(150)) # an Array already
)
tab$schema#> arrow::Schema #> row.number: int32#> Sepal.Length: double#> Sepal.Width: double#> Petal.Length: double#> Petal.Width: double#> Species: dictionary<values=string, indices=int8, ordered=0>#> arr: double
as_tibble(tab)
#> # A tibble: 150 x 7#> row.number Sepal.Length Sepal.Width Petal.Length Petal.Width Species#> <int> <dbl> <dbl> <dbl> <dbl> <fct> #> 1 1 5.1 3.5 1.4 0.2 setosa #> 2 2 4.9 3 1.4 0.2 setosa #> 3 3 4.7 3.2 1.3 0.2 setosa #> 4 4 4.6 3.1 1.5 0.2 setosa #> 5 5 5 3.6 1.4 0.2 setosa #> 6 6 5.4 3.9 1.7 0.4 setosa #> 7 7 4.6 3.4 1.4 0.3 setosa #> 8 8 5 3.4 1.5 0.2 setosa #> 9 9 4.4 2.9 1.4 0.2 setosa #> 10 10 4.9 3.1 1.5 0.1 setosa #> # … with 140 more rows, and 1 more variable: arr <dbl>

@xhochy
xhochyforce-pushed the ARROW-3814/record_batch_from_arrays branch from 7ab2a73 to 046ce90CompareFebruary 8, 2019 21:25
@xhochy

Copy link
Copy Markdown
Member

Rebased.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

@xhochy was there a special need to rebase ? Just curious.
I usually only need to rebase after an R specific PR is squashed

@xhochy

Copy link
Copy Markdown
Member

I rebased master on the release commit of the JavaScript 0.4.0 release.

We sadly only add the tagging commits to master once the release vote has passed. Then we need to rebase all PRs as we keep merging patches while the release vote runs.

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 046ce90 to cc30604CompareFebruary 13, 2019 08:59
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch 3 times, most recently from ef8b3ef to 0898ddeCompareFebruary 26, 2019 08:39
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 0898dde to 2326d85CompareMarch 6, 2019 13:39
@romainfrancois
romainfrancois requested a review from wesmMarch 6, 2019 16:19
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I think this is ready now.

@wesmwesm removed the WIP PR is work in progress label Mar 6, 2019

@wesmwesm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments but this looks like a nice improvement. I think this can be merged after some small fixes /c comments

Comment threadr/R/feather.R Outdated
Comment threadr/R/write_arrow.R Outdated
Comment threadr/src/recordbatch.cpp Outdated
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

Thanks. I’ll deal with those in the morning.

@wesm

wesm commented Mar 7, 2019

Copy link
Copy Markdown
Member

@romainfrancois this needs to be rebased now after the lint fixes, sorry about that

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 4891ac6 to 8283a94CompareMarch 8, 2019 08:06
Comment threadr/lint.sh Outdated

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we need to pass $1 to run_cpp_lint.py too ?

Removing it here allows to use

./r/lint.sh --fix

and let the tool fix the format

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch 3 times, most recently from d42da88 to f51801dCompareMarch 29, 2019 13:33
@wesm
wesmforce-pushed the ARROW-3814/record_batch_from_arrays branch from f51801d to 7f656eaCompareMay 30, 2019 18:07
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 7f656ea to 74a1e6bCompareMay 31, 2019 09:13
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I think this is good to go, but I'd like to merge #4413 first because currently this pr would fail against the new Dictionary changes from #4316

@wesm

wesm commented May 31, 2019

Copy link
Copy Markdown
Member

Sounds good

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 74a1e6b to ab0cd16CompareJune 3, 2019 07:26
wesm
wesm approved these changes Jun 3, 2019

@wesmwesm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment threadr/lint.sh Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay

expect_equal(s, batch$schema)

s <- schema(x = int32(), y = utf8())
expect_error(record_batch(x = 1:10, y = 1:10, schema = s))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If schema were a column name I guess you would have to pass the arguments differently

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.92%. Comparing base (5025126) to head (ab0cd16).

❗ There is a different number of reports uploaded between BASE (5025126) and HEAD (ab0cd16). Click for more details.

HEAD has 4 uploads less than BASE
FlagBASE (5025126)HEAD (ab0cd16)
51
Additional details and impacted files
@@ Coverage Diff @@## master #3565 +/- ##
===========================================
- Coverage 87.94% 76.92% -11.03% 
===========================================
Files 737 51 -686 Lines 81709 1976 -79733 Branches 1253 0 -1253 ===========================================
- Hits 71863 1520 -70343 + Misses 9599 456 -9143 + Partials 247 0 -247 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@romainfrancois@codecov-io@xhochy@wesm@codecov-commenter
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); ARROW-3814: [R] RecordBatch$from_arrays() by romainfrancois · Pull Request #3565 · apache/arrow · GitHub
Skip to content

ARROW-3814: [R] RecordBatch$from_arrays() - #3565

Closed
romainfrancois wants to merge 21 commits into
apache:masterfrom
romainfrancois:ARROW-3814/record_batch_from_arrays
Closed

ARROW-3814: [R] RecordBatch$from_arrays()#3565
romainfrancois wants to merge 21 commits into
apache:masterfrom
romainfrancois:ARROW-3814/record_batch_from_arrays

Conversation

@romainfrancois

Copy link
Copy Markdown
Contributor

This started out as an implementation of RecordBatch$from_arrays() (i.e. https://issues.apache.org/jira/browse/ARROW-3814?filter=12344983) but now looks more like this issue: https://issues.apache.org/jira/browse/ARROW-3815?filter=12344983

The idea being that the record batch factory record_batch() would work with ... and schema, where each thing in the ... could be:

  • an arrow::Array
  • an R vector that can be converted to an array using array()

So where we had this before:

record_batch(tibble::tibble(x=1:10, y=1:10))

we would now have:

record_batch(x=1:10, y=1:10)

We would still be able to start from a data frame, via splicing, e.g.:

tbl <- tibble::tibble(x = 1:10, y = 1:10)
record_batch(!!!tbl)

So there would be no need for a RecordBatch$fromArray() method.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I suppose the situation is similar for the table() factory

@romainfrancoisromainfrancois added WIP PR is work in progress Component: R labels Feb 5, 2019
@codecov-io

codecov-io commented Feb 5, 2019

Copy link
Copy Markdown

Codecov Report

Merging #3565 into master will decrease coverage by 11.02%.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@## master #3565 +/- ##
===========================================
- Coverage 87.94% 76.92% -11.03% 
===========================================
Files 737 51 -686 Lines 81709 1976 -79733 Branches 1253 0 -1253 ===========================================
- Hits 71863 1520 -70343 + Misses 9599 456 -9143 + Partials 247 0 -247
Impacted FilesCoverage Δ
src/table.cpp64.17% <0%> (-4.25%)⬇️
src/array_from_vector.cpp78.29% <0%> (-0.05%)⬇️
R/write_arrow.R96.29% <0%> (ø)⬆️
R/feather.R58.33% <0%> (ø)⬆️
cpp/src/arrow/csv/chunker-test.cc
cpp/src/parquet/column_page.h
cpp/src/parquet/bloom_filter-test.cc
cpp/src/arrow/array/builder_decimal.cc
cpp/src/plasma/client.cc
cpp/src/arrow/io/test-common.h
... and 685 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5025126...ab0cd16. Read the comment docs.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

proposal for the table() function, that might be renamed Table() perhaps. The idea is that the function can handle two cases:

  • a variable list of record batches, which then results to a call to arrow::Table::FromRecordBatches :
library(arrow, warn.conflicts=FALSE)
library(purrr)
batch<- record_batch(x=1:2, y=letters[1:2])
# variable number of batchestab<- table(batch, batch, batch)
tab#> arrow::Table
as_tibble(tab)
#> # A tibble: 6 x 2#> x y #> <int> <chr>#> 1 1 a #> 2 2 b #> 3 1 a #> 4 2 b #> 5 1 a #> 6 2 b# splicing supportbatches<- map(1:10, ~record_batch(x=., y=letters[.]))
tab<- table(!!!batches)
tab#> arrow::Table
as_tibble(tab)
#> # A tibble: 10 x 2#> x y #> <int> <chr>#> 1 1 a #> 2 2 b #> 3 3 c #> 4 4 d #> 5 5 e #> 6 6 f #> 7 7 g #> 8 8 h #> 9 9 i #> 10 10 j
  • a named list of R vectors, R arrays or chunked arrays, e.g.
library(arrow, warn.conflicts=FALSE)
a<-array(rnorm(10))
tab<- table(x=1:10, y=letters[1:10], z=a)
tab$schema#> arrow::Schema #> x: int32#> y: string#> z: double
as_tibble(tab)
#> # A tibble: 10 x 3#> x y z#> <int> <chr> <dbl>#> 1 1 a 1.68 #> 2 2 b 1.61 #> 3 3 c 0.879#> 4 4 d 0.315#> 5 5 e 0.877#> 6 6 f -1.28 #> 7 7 g 0.827#> 8 8 h 0.494#> 9 9 i 1.60 #> 10 10 j -1.66# supports splicing too, e.g. tab<- table(
row.number=1:150, # R integer vector -> converted to an Array!!!iris, # columns of iris are spliced, each is converted to an arrayarr=array(rnorm(150)) # an Array already
)
tab$schema#> arrow::Schema #> row.number: int32#> Sepal.Length: double#> Sepal.Width: double#> Petal.Length: double#> Petal.Width: double#> Species: dictionary<values=string, indices=int8, ordered=0>#> arr: double
as_tibble(tab)
#> # A tibble: 150 x 7#> row.number Sepal.Length Sepal.Width Petal.Length Petal.Width Species#> <int> <dbl> <dbl> <dbl> <dbl> <fct> #> 1 1 5.1 3.5 1.4 0.2 setosa #> 2 2 4.9 3 1.4 0.2 setosa #> 3 3 4.7 3.2 1.3 0.2 setosa #> 4 4 4.6 3.1 1.5 0.2 setosa #> 5 5 5 3.6 1.4 0.2 setosa #> 6 6 5.4 3.9 1.7 0.4 setosa #> 7 7 4.6 3.4 1.4 0.3 setosa #> 8 8 5 3.4 1.5 0.2 setosa #> 9 9 4.4 2.9 1.4 0.2 setosa #> 10 10 4.9 3.1 1.5 0.1 setosa #> # … with 140 more rows, and 1 more variable: arr <dbl>

@xhochy
xhochyforce-pushed the ARROW-3814/record_batch_from_arrays branch from 7ab2a73 to 046ce90CompareFebruary 8, 2019 21:25
@xhochy

Copy link
Copy Markdown
Member

Rebased.

@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

@xhochy was there a special need to rebase ? Just curious.
I usually only need to rebase after an R specific PR is squashed

@xhochy

Copy link
Copy Markdown
Member

I rebased master on the release commit of the JavaScript 0.4.0 release.

We sadly only add the tagging commits to master once the release vote has passed. Then we need to rebase all PRs as we keep merging patches while the release vote runs.

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 046ce90 to cc30604CompareFebruary 13, 2019 08:59
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch 3 times, most recently from ef8b3ef to 0898ddeCompareFebruary 26, 2019 08:39
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 0898dde to 2326d85CompareMarch 6, 2019 13:39
@romainfrancois
romainfrancois requested a review from wesmMarch 6, 2019 16:19
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I think this is ready now.

@wesmwesm removed the WIP PR is work in progress label Mar 6, 2019

@wesmwesm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments but this looks like a nice improvement. I think this can be merged after some small fixes /c comments

Comment threadr/R/feather.R Outdated
Comment threadr/R/write_arrow.R Outdated
Comment threadr/src/recordbatch.cpp Outdated
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

Thanks. I’ll deal with those in the morning.

@wesm

wesm commented Mar 7, 2019

Copy link
Copy Markdown
Member

@romainfrancois this needs to be rebased now after the lint fixes, sorry about that

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 4891ac6 to 8283a94CompareMarch 8, 2019 08:06
Comment threadr/lint.sh Outdated

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we need to pass $1 to run_cpp_lint.py too ?

Removing it here allows to use

./r/lint.sh --fix

and let the tool fix the format

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch 3 times, most recently from d42da88 to f51801dCompareMarch 29, 2019 13:33
@wesm
wesmforce-pushed the ARROW-3814/record_batch_from_arrays branch from f51801d to 7f656eaCompareMay 30, 2019 18:07
@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 7f656ea to 74a1e6bCompareMay 31, 2019 09:13
@romainfrancois

Copy link
Copy Markdown
ContributorAuthor

I think this is good to go, but I'd like to merge #4413 first because currently this pr would fail against the new Dictionary changes from #4316

@wesm

wesm commented May 31, 2019

Copy link
Copy Markdown
Member

Sounds good

@romainfrancois
romainfrancoisforce-pushed the ARROW-3814/record_batch_from_arrays branch from 74a1e6b to ab0cd16CompareJune 3, 2019 07:26
wesm
wesm approved these changes Jun 3, 2019

@wesmwesm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment threadr/lint.sh Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay

expect_equal(s, batch$schema)

s <- schema(x = int32(), y = utf8())
expect_error(record_batch(x = 1:10, y = 1:10, schema = s))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If schema were a column name I guess you would have to pass the arguments differently

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.92%. Comparing base (5025126) to head (ab0cd16).

❗ There is a different number of reports uploaded between BASE (5025126) and HEAD (ab0cd16). Click for more details.

HEAD has 4 uploads less than BASE
FlagBASE (5025126)HEAD (ab0cd16)
51
Additional details and impacted files
@@ Coverage Diff @@## master #3565 +/- ##
===========================================
- Coverage 87.94% 76.92% -11.03% 
===========================================
Files 737 51 -686 Lines 81709 1976 -79733 Branches 1253 0 -1253 ===========================================
- Hits 71863 1520 -70343 + Misses 9599 456 -9143 + Partials 247 0 -247 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@romainfrancois@codecov-io@xhochy@wesm@codecov-commenter