File tree 3 files changed +12
-3
lines changed
3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -97,13 +97,13 @@ impl From<i64> for JsonPath<'_> {
97
97
}
98
98
99
99
#[ derive( Debug ) ]
100
- enum JsonPathArgs < ' a > {
100
+ pub enum JsonPathArgs < ' a > {
101
101
Array ( & ' a ArrayRef ) ,
102
102
Scalars ( Vec < JsonPath < ' a > > ) ,
103
103
}
104
104
105
105
impl < ' s > JsonPathArgs < ' s > {
106
- fn extract_path ( path_args : & ' s [ ColumnarValue ] ) -> DataFusionResult < Self > {
106
+ pub fn extract_path ( path_args : & ' s [ ColumnarValue ] ) -> DataFusionResult < Self > {
107
107
// If there is a single argument as an array, we know how to handle it
108
108
if let Some ( ( ColumnarValue :: Array ( array) , & [ ] ) ) = path_args. split_first ( ) {
109
109
return Ok ( Self :: Array ( array) ) ;
Original file line number Diff line number Diff line change @@ -101,6 +101,13 @@ impl JsonUnion {
101
101
}
102
102
}
103
103
104
+ /// Get the `DataType` for a `JsonUnion`.
105
+ /// This will be the data type of the result of `json_array->'field'`.
106
+ #[ must_use]
107
+ pub fn json_union_data_type ( ) -> DataType {
108
+ JsonUnion :: data_type ( )
109
+ }
110
+
104
111
/// So we can do `collect::<JsonUnion>()`
105
112
impl FromIterator < Option < JsonUnionField > > for JsonUnion {
106
113
fn from_iter < I : IntoIterator < Item = Option < JsonUnionField > > > ( iter : I ) -> Self {
Original file line number Diff line number Diff line change @@ -20,7 +20,9 @@ mod json_length;
20
20
mod json_object_keys;
21
21
mod rewrite;
22
22
23
- pub use common_union:: { JsonUnionEncoder , JsonUnionValue } ;
23
+ pub use common_union:: { json_union_data_type, JsonUnionEncoder , JsonUnionValue } ;
24
+
25
+ pub use common:: JsonPath ;
24
26
25
27
pub mod functions {
26
28
pub use crate :: json_as_text:: json_as_text;
You can’t perform that action at this time.
0 commit comments