JSON 对象#
- group json_object
函数
-
std::unique_ptr<cudf::column> get_json_object(cudf::strings_column_view const &col, cudf::string_scalar const &json_path, get_json_object_options options = get_json_object_options{}, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#
将JSONPath字符串应用于输入字符串列中的所有行。
将JSONPath字符串应用于输入的字符串列,其中列中的每一行都是有效的json字符串。输出按行返回为字符串列。
https://tools.ietf.org/id/draft-goessner-dispatch-jsonpath-00.html 仅实现了以下操作符:$ . [] *
- Throws:
std::invalid_argument – 如果提供了无效的操作符或空名称
- Parameters:
col – 输入的字符串列。每行必须包含一个有效的json字符串
json_path – 应用于每行的JSONPath字符串
options – 控制函数行为的选项
stream – 用于设备内存操作和内核启动的CUDA流
mr – 用于分配设备内存的资源
- Returns:
包含检索到的json对象字符串的新字符串列
-
class get_json_object_options#
- #include <json.hpp>
get_json_object()的设置。公共函数
-
explicit get_json_object_options() = default#
默认构造函数。
-
inline bool get_allow_single_quotes() const#
根据是否允许使用单引号表示字符串返回 true/false。
- Returns:
如果允许单引号则为true,否则为false。
-
inline bool get_strip_quotes_from_single_strings() const#
根据单独返回的字符串值是否去除了引号,返回 true/false。
当设置为true时,如果给定行的返回值是单个字符串(不是对象或字符串数组),则从字符串中去除引号并仅返回字符串本身的内容。示例:
With strip_quotes_from_single_strings OFF: Input = {"a" : "b"} Query = $.a Output = "b" With strip_quotes_from_single_strings ON: Input = {"a" : "b"} Query = $.a Output = b- Returns:
如果单独返回的字符串值去除了引号,则为true。
-
inline bool get_missing_fields_as_nulls() const#
是否将对象中不包含的字段解释为null。
当设置为true时,如果查询一个对象不包含的字段,将返回null。
With missing_fields_as_nulls OFF: Input = {"a" : [{"x": "1", "y": "2"}, {"x": "3"}]} Query = $.a[*].y Output = ["2"] With missing_fields_as_nulls ON: Input = {"a" : [{"x": "1", "y": "2"}, {"x": "3"}]} Query = $.a[*].y Output = ["2", null]- Returns:
如果缺失字段被解释为null,则为true。
-
inline void set_allow_single_quotes(bool _allow_single_quotes)#
设置是否允许字符串使用单引号。
- Parameters:
_allow_single_quotes – 布尔值,表示期望的行为。
-
inline void set_strip_quotes_from_single_strings(bool _strip_quotes_from_single_strings)#
设置是否去除单独返回的字符串值的引号。
- Parameters:
_strip_quotes_from_single_strings – 布尔值,表示所需的行为。
-
inline void set_missing_fields_as_nulls(bool _missing_fields_as_nulls)#
设置是否将缺失字段解释为null。
- Parameters:
_missing_fields_as_nulls – 布尔值,指示所需的行为。
-
explicit get_json_object_options() = default#
-
std::unique_ptr<cudf::column> get_json_object(cudf::strings_column_view const &col, cudf::string_scalar const &json_path, get_json_object_options options = get_json_object_options{}, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#