diff --git a/velox/functions/sparksql/SIMDJsonFunctions.h b/velox/functions/sparksql/SIMDJsonFunctions.h index fc751672bd60..9c03fe429087 100644 --- a/velox/functions/sparksql/SIMDJsonFunctions.h +++ b/velox/functions/sparksql/SIMDJsonFunctions.h @@ -93,7 +93,7 @@ struct SIMDGetJsonObjectFunction { double numberResult; error = rawResult.get_double().get(numberResult); if (!error) { - ss << numberResult; + ss << rawResult; result.append(ss.str()); } return error; diff --git a/velox/functions/sparksql/tests/JsonFunctionsTest.cpp b/velox/functions/sparksql/tests/JsonFunctionsTest.cpp index ecdb8a47d00c..e6ec9d7e50b3 100644 --- a/velox/functions/sparksql/tests/JsonFunctionsTest.cpp +++ b/velox/functions/sparksql/tests/JsonFunctionsTest.cpp @@ -39,6 +39,9 @@ TEST_F(JsonFunctionTest, getJsonObject) { EXPECT_EQ(getJsonObject(R"({"my": {"hello": 3.5}})", "$.my.hello"), "3.5"); EXPECT_EQ(getJsonObject(R"({"my": {"hello": true}})", "$.my.hello"), "true"); EXPECT_EQ(getJsonObject(R"({"hello": ""})", "$.hello"), ""); + EXPECT_EQ( + "0.0215434648799772", + getJsonObject(R"({"score":0.0215434648799772})", "$.score")); EXPECT_EQ( getJsonObject(R"({"name": "Alice", "age": 5, "id": "001"})", "$.age"), "5");