跳到內容

record_batch() 從一個或多個欄位建構 RecordBatch,而 as_record_batch() 將單一物件轉換為 Arrow RecordBatch

用法

as_record_batch(x, ..., schema = NULL)

# S3 method for class 'RecordBatch'
as_record_batch(x, ..., schema = NULL)

# S3 method for class 'Table'
as_record_batch(x, ..., schema = NULL)

# S3 method for class 'arrow_dplyr_query'
as_record_batch(x, ...)

# S3 method for class 'data.frame'
as_record_batch(x, ..., schema = NULL)

參數

x

要轉換為 Arrow RecordBatch 的物件

...

傳遞給 S3 方法

schema

一個 Schema,或 NULL (預設值) 以從 ... 中的資料推斷結構描述。當提供 Arrow IPC 緩衝區時,schema 是必要的。

一個 RecordBatch

範例

# use as_record_batch() for a single object
as_record_batch(data.frame(col1 = 1, col2 = "two"))
#> RecordBatch
#> 1 rows x 2 columns
#> $col1 <double>
#> $col2 <string>
#> 
#> See $metadata for additional Schema metadata

# use record_batch() to create from columns
record_batch(col1 = 1, col2 = "two")
#> RecordBatch
#> 1 rows x 2 columns
#> $col1 <double>
#> $col2 <string>