From df7223cd67271ef8ab1df30171a516bae96a0bc2 Mon Sep 17 00:00:00 2001 From: lwz9103 Date: Thu, 28 Nov 2024 17:15:01 +0800 Subject: [PATCH] [GLUTEN-8074][CH] Fix CI --- .../gluten/execution/GlutenClickHouseDecimalSuite.scala | 2 +- cpp-ch/local-engine/Parser/SerializedPlanParser.cpp | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenClickHouseDecimalSuite.scala b/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenClickHouseDecimalSuite.scala index 65fd20eab982..9988d5372943 100644 --- a/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenClickHouseDecimalSuite.scala +++ b/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenClickHouseDecimalSuite.scala @@ -407,7 +407,7 @@ class GlutenClickHouseDecimalSuite test("GLUTEN-8074 Fix adjust output constant column") { val sql = s""" - |select bround(1002.5786, -3), + |select bround(1002.5786, 3), | bround(-10.8, 0), | bround(13.888888888889, 5) |from $decimalTable diff --git a/cpp-ch/local-engine/Parser/SerializedPlanParser.cpp b/cpp-ch/local-engine/Parser/SerializedPlanParser.cpp index 7e591742c81e..777d0feaaa16 100644 --- a/cpp-ch/local-engine/Parser/SerializedPlanParser.cpp +++ b/cpp-ch/local-engine/Parser/SerializedPlanParser.cpp @@ -165,12 +165,10 @@ void SerializedPlanParser::adjustOutput(const DB::QueryPlanPtr & query_plan, con { const DB::ContextPtr context = DB::CurrentThread::get().getQueryContext(); const FunctionOverloadResolverPtr & cast_resolver = FunctionFactory::instance().get("CAST", context); - const DataTypePtr string_type = DB::DataTypeFactory::instance().get("String"); + const DataTypePtr string_type = std::make_shared(); ColumnWithTypeAndName to_type_column = {string_type->createColumnConst(1, final_type->getName()), string_type, "__cast_const__"}; FunctionBasePtr cast_function = cast_resolver->build({origin_column, to_type_column}); - ColumnPtr cast_col = cast_function->execute({origin_column, to_type_column}, final_type, 1); - Field cast_field; - cast_col->get(0, cast_field); + Field cast_field = ColumnConst::create(cast_function->execute({origin_column, to_type_column}, final_type, 1), 1)->getField(); ColumnWithTypeAndName final_column(final_type->createColumnConst(0, cast_field), final_type, origin_column.name); final_columns.emplace_back(std::move(final_column)); }