mirror of
https://github.com/apache/arrow.git
synced 2026-10-29 17:15:39 +08:00
Failing test for reading DataSource$schema
This commit is contained in:
1 parent
229fc69a9e
commit
eed2e51da4
3 files changed
+10
-6
No files matched your search
+5
-6
@@ -98,12 +98,8 @@ Dataset <- R6Class("Dataset", inherit = Object,
|
||||
schema = function() shared_ptr(Schema, dataset___Dataset__schema(self))
|
||||
)
|
||||
)
|
||||
Dataset$create <- function(sources, schema = NULL) {
|
||||
Dataset$create <- function(sources, schema) {
|
||||
assert_is_list_of(sources, "DataSource")
|
||||
if (is.null(schema)) {
|
||||
# TODO: this should somehow align the schema of multiple sources
|
||||
schema <- sources[[1]]$schema
|
||||
}
|
||||
assert_is(schema, "Schema")
|
||||
shared_ptr(Dataset, dataset___Dataset__create(sources, schema))
|
||||
}
|
||||
@@ -153,7 +149,10 @@ DataSource <- R6Class("DataSource", inherit = Object,
|
||||
active = list(
|
||||
#' @description
|
||||
#' Return the DataSource's `Schema`
|
||||
schema = function() shared_ptr(Schema, dataset___Dataset__schema(self))
|
||||
schema = function() {
|
||||
print("hello")
|
||||
shared_ptr(Schema, dataset___DataSource__schema(self))
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
// under the License.
|
||||
|
||||
#include "./arrow_types.h"
|
||||
#include <iostream>
|
||||
|
||||
#if defined(ARROW_R_WITH_ARROW)
|
||||
|
||||
@@ -83,6 +84,7 @@ std::shared_ptr<ds::DataSource> dataset___DSDiscovery__Finish2(
|
||||
// [[arrow::export]]
|
||||
std::shared_ptr<arrow::Schema> dataset___DataSource__schema(
|
||||
const std::shared_ptr<ds::DataSource>& source) {
|
||||
std::cout<<source->schema()->ToString()<<std::endl;
|
||||
return source->schema();
|
||||
}
|
||||
|
||||
|
||||
@@ -270,6 +270,9 @@ test_that("Assembling a Dataset manually and getting a Table", {
|
||||
|
||||
datasource <- dsd$Finish(schm)
|
||||
expect_is(datasource, "DataSource")
|
||||
expect_is(datasource$schema, "Schema")
|
||||
print(str(datasource$schema))
|
||||
expect_equal(names(schm), names(datasource$schema))
|
||||
|
||||
ds <- Dataset$create(list(datasource), schm)
|
||||
expect_is(ds, "Dataset")
|
||||
|
||||
Reference in new issue
Block a user