跳过内容

在 nanoarrow 中,“模式”指的是 Arrow C 数据接口中定义的 struct ArrowSchema。此数据结构可用于表示 arrow::schema()arrow::field()arrow::DataType。请注意,在 nanoarrow 中,arrow::schema() 和不可为空的 arrow::struct() 的表示方式相同。

用法

as_nanoarrow_schema(x, ...)

infer_nanoarrow_schema(x, ...)

nanoarrow_schema_parse(x, recursive = FALSE)

nanoarrow_schema_modify(x, new_values, validate = TRUE)

参数

x

要转换为模式的对象

...

传递给 S3 方法

recursive

使用 TRUE 在解析模式时包含 children 成员。

new_values

要分配的新模式组件

validate

使用 FALSE 跳过模式验证

返回值

“nanoarrow_schema”类的对象

示例

infer_nanoarrow_schema(integer())
#> <nanoarrow_schema int32>
#>  $ format    : chr "i"
#>  $ name      : chr ""
#>  $ metadata  : list()
#>  $ flags     : int 2
#>  $ children  : list()
#>  $ dictionary: NULL
infer_nanoarrow_schema(data.frame(x = integer()))
#> <nanoarrow_schema struct>
#>  $ format    : chr "+s"
#>  $ name      : chr ""
#>  $ metadata  : list()
#>  $ flags     : int 0
#>  $ children  :List of 1
#>   ..$ x:<nanoarrow_schema int32>
#>   .. ..$ format    : chr "i"
#>   .. ..$ name      : chr "x"
#>   .. ..$ metadata  : list()
#>   .. ..$ flags     : int 2
#>   .. ..$ children  : list()
#>   .. ..$ dictionary: NULL
#>  $ dictionary: NULL