1515use databend_common_exception:: ErrorCode ;
1616use databend_common_exception:: Result ;
1717use databend_common_expression:: types:: number:: F32 ;
18- use databend_common_expression:: types:: string:: StringColumnBuilder ;
1918use databend_common_expression:: types:: DataType ;
2019use databend_common_expression:: types:: DecimalDataType ;
2120use databend_common_expression:: types:: DecimalSize ;
@@ -226,35 +225,17 @@ impl InternalColumn {
226225 }
227226 }
228227
229- BlockEntry :: new (
230- DataType :: Number ( NumberDataType :: UInt64 ) ,
231- Value :: Column ( UInt64Type :: from_data ( row_ids) ) ,
232- )
228+ UInt64Type :: from_data ( row_ids) . into ( )
233229 }
234230 InternalColumnType :: BlockName => {
235- let mut builder = StringColumnBuilder :: with_capacity ( 1 ) ;
236- builder. put_and_commit ( & meta. block_location ) ;
237- BlockEntry :: new (
238- DataType :: String ,
239- Value :: Scalar ( Scalar :: String ( builder. build_scalar ( ) ) ) ,
240- )
231+ BlockEntry :: from_arg_scalar :: < StringType > ( meta. block_location . clone ( ) )
241232 }
242233 InternalColumnType :: SegmentName => {
243- let mut builder = StringColumnBuilder :: with_capacity ( 1 ) ;
244- builder. put_and_commit ( & meta. segment_location ) ;
245- BlockEntry :: new (
246- DataType :: String ,
247- Value :: Scalar ( Scalar :: String ( builder. build_scalar ( ) ) ) ,
248- )
249- }
250- InternalColumnType :: SnapshotName => {
251- let mut builder = StringColumnBuilder :: with_capacity ( 1 ) ;
252- builder. put_and_commit ( meta. snapshot_location . clone ( ) . unwrap_or ( "" . to_string ( ) ) ) ;
253- BlockEntry :: new (
254- DataType :: String ,
255- Value :: Scalar ( Scalar :: String ( builder. build_scalar ( ) ) ) ,
256- )
234+ BlockEntry :: from_arg_scalar :: < StringType > ( meta. segment_location . clone ( ) )
257235 }
236+ InternalColumnType :: SnapshotName => BlockEntry :: from_arg_scalar :: < StringType > (
237+ meta. snapshot_location . clone ( ) . unwrap_or_default ( ) ,
238+ ) ,
258239 InternalColumnType :: BaseRowId => {
259240 let uuid =
260241 try_extract_uuid_str_from_path ( & meta. block_location ) . unwrap_or_else ( |e| {
@@ -275,10 +256,7 @@ impl InternalColumn {
275256 row_ids. push ( row_id) ;
276257 }
277258 }
278- BlockEntry :: new (
279- DataType :: String ,
280- Value :: Column ( StringType :: from_data ( row_ids) ) ,
281- )
259+ StringType :: from_data ( row_ids) . into ( )
282260 }
283261 InternalColumnType :: BaseBlockIds => {
284262 assert ! ( meta. base_block_ids. is_some( ) ) ;
@@ -295,10 +273,7 @@ impl InternalColumn {
295273 for ( idx, _) in matched_rows. iter ( ) {
296274 bitmap. set ( * idx, true ) ;
297275 }
298- BlockEntry :: new (
299- DataType :: Boolean ,
300- Value :: Column ( Column :: Boolean ( bitmap. into ( ) ) ) ,
301- )
276+ Column :: Boolean ( bitmap. into ( ) ) . into ( )
302277 }
303278 InternalColumnType :: SearchScore => {
304279 assert ! ( meta. matched_rows. is_some( ) ) ;
@@ -311,10 +286,7 @@ impl InternalColumn {
311286 * val = F32 :: from ( * score. unwrap ( ) ) ;
312287 }
313288 }
314- BlockEntry :: new (
315- DataType :: Number ( NumberDataType :: Float32 ) ,
316- Value :: Column ( Float32Type :: from_data ( scores) ) ,
317- )
289+ Float32Type :: from_data ( scores) . into ( )
318290 }
319291 InternalColumnType :: FileName | InternalColumnType :: FileRowNumber => {
320292 todo ! ( "generate_column_values not support for file related" )
0 commit comments