Skip to content

Commit 665581f

Browse files
committed
expose JsonUnion DataType and JsonPath
1 parent 5c5ae9d commit 665581f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/common.rs

+5
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ fn dict_key_type(d: &DataType) -> Option<DataType> {
6868
None
6969
}
7070

71+
/// Parsed representation of a JSON path element.
7172
#[derive(Debug)]
7273
pub enum JsonPath<'s> {
7374
Key(&'s str),
@@ -103,6 +104,10 @@ pub enum JsonPathArgs<'a> {
103104
}
104105

105106
impl<'s> JsonPathArgs<'s> {
107+
/// Extract the JSON path from the arguments to a json function.
108+
/// The path can be:
109+
/// - A single array argument (`json_get(json_data, keys_column)`)
110+
/// - One or more scalar arguments (`json_get(json_data, 'foo', 0)`)
106111
pub fn extract_path(path_args: &'s [ColumnarValue]) -> DataFusionResult<Self> {
107112
// If there is a single argument as an array, we know how to handle it
108113
if let Some((ColumnarValue::Array(array), &[])) = path_args.split_first() {

0 commit comments

Comments
 (0)