Skip to content

Commit fb07e4d

Browse files
committed
Save
1 parent c8b4cb1 commit fb07e4d

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,15 @@ impl ExpressionBuilder for FromJsonBuilder {
112112
) -> Result<Arc<dyn PhysicalExpr>, ExecutionError> {
113113
let expr = extract_expr!(spark_expr, FromJson);
114114
let child = planner.create_expr(
115-
expr.child
116-
.as_ref()
117-
.ok_or_else(|| ExecutionError::GeneralError("FromJson missing child".to_string()))?,
115+
expr.child.as_ref().ok_or_else(|| {
116+
ExecutionError::GeneralError("FromJson missing child".to_string())
117+
})?,
118118
input_schema,
119119
)?;
120-
let schema = to_arrow_datatype(
121-
expr.schema
122-
.as_ref()
123-
.ok_or_else(|| ExecutionError::GeneralError("FromJson missing schema".to_string()))?,
124-
);
120+
let schema =
121+
to_arrow_datatype(expr.schema.as_ref().ok_or_else(|| {
122+
ExecutionError::GeneralError("FromJson missing schema".to_string())
123+
})?);
125124
Ok(Arc::new(FromJson::new(child, schema, &expr.timezone)))
126125
}
127126
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,11 @@ mod tests {
501501

502502
// All rows should have non-null structs with null field values
503503
for i in 0..4 {
504-
assert!(!struct_array.is_null(i), "Row {} struct should not be null", i);
504+
assert!(
505+
!struct_array.is_null(i),
506+
"Row {} struct should not be null",
507+
i
508+
);
505509
assert!(a_array.is_null(i), "Row {} field a should be null", i);
506510
assert!(b_array.is_null(i), "Row {} field b should be null", i);
507511
}

spark/src/test/scala/org/apache/comet/CometJsonExpressionSuite.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ class CometJsonExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelpe
3333
override protected def test(testName: String, testTags: Tag*)(testFun: => Any)(implicit
3434
pos: Position): Unit = {
3535
super.test(testName, testTags: _*) {
36-
withSQLConf(
37-
CometConf.getExprAllowIncompatConfigKey(classOf[JsonToStructs]) -> "true") {
36+
withSQLConf(CometConf.getExprAllowIncompatConfigKey(classOf[JsonToStructs]) -> "true") {
3837
testFun
3938
}
4039
}

0 commit comments

Comments
 (0)