Skip to content

Commit 1b7f43f

Browse files
committed
remove some comments
1 parent ce2abcf commit 1b7f43f

File tree

2 files changed

+0
-14
lines changed

2 files changed

+0
-14
lines changed

native/core/src/execution/expressions/strings.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ impl ExpressionBuilder for RlikeBuilder {
100100
}
101101
}
102102

103-
/// Builder for FromJson expressions
104103
pub struct FromJsonBuilder;
105104

106105
impl ExpressionBuilder for FromJsonBuilder {

native/spark-expr/src/json_funcs/from_json.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -133,28 +133,19 @@ fn json_string_to_struct(arr: &Arc<dyn Array>, schema: &DataType) -> Result<Arra
133133
use arrow::array::StringArray;
134134
use arrow::buffer::NullBuffer;
135135

136-
// Input must be string array
137136
let string_array = arr.as_any().downcast_ref::<StringArray>().ok_or_else(|| {
138137
datafusion::common::DataFusionError::Execution("from_json expects string input".to_string())
139138
})?;
140139

141-
// Schema must be struct
142140
let DataType::Struct(fields) = schema else {
143141
return Err(datafusion::common::DataFusionError::Execution(
144142
"from_json requires struct schema".to_string(),
145143
));
146144
};
147145

148-
// Build struct array by parsing each JSON string
149146
let num_rows = string_array.len();
150-
151-
// Create builders for each field
152147
let mut field_builders = create_field_builders(fields, num_rows)?;
153-
154-
// Track which rows should be null at the struct level
155148
let mut struct_nulls = vec![true; num_rows];
156-
157-
// Parse each row
158149
for (row_idx, struct_null) in struct_nulls.iter_mut().enumerate() {
159150
if string_array.is_null(row_idx) {
160151
// Null input -> null struct
@@ -188,15 +179,11 @@ fn json_string_to_struct(arr: &Arc<dyn Array>, schema: &DataType) -> Result<Arra
188179
}
189180
}
190181

191-
// Finish builders
192182
let arrays: Vec<ArrayRef> = field_builders
193183
.into_iter()
194184
.map(finish_builder)
195185
.collect::<Result<Vec<_>>>()?;
196-
197-
// Create null buffer from struct_nulls
198186
let null_buffer = NullBuffer::from(struct_nulls);
199-
200187
Ok(Arc::new(StructArray::new(
201188
fields.clone(),
202189
arrays,

0 commit comments

Comments
 (0)