@@ -360,14 +360,11 @@ func encodeHashChunkRowIdx(typeCtx types.Context, row chunk.Row, tp *types.Field
360
360
b = unsafe .Slice ((* byte )(unsafe .Pointer (& v )), sizeUint64 )
361
361
} else {
362
362
flag = compactBytesFlag
363
- enumVal := row .GetEnum (idx )
364
- str := enumVal .Name
365
- if str == "" {
366
- enum , err := types .ParseEnumValue (tp .GetElems (), enumVal .Value )
367
- if err == nil {
368
- // str will be empty string if v out of definition of enum.
369
- str = enum .Name
370
- }
363
+ v := row .GetEnum (idx ).Value
364
+ str := ""
365
+ if enum , err := types .ParseEnumValue (tp .GetElems (), v ); err == nil {
366
+ // str will be empty string if v out of definition of enum.
367
+ str = enum .Name
371
368
}
372
369
b = ConvertByCollation (hack .Slice (str ), tp )
373
370
}
@@ -579,14 +576,11 @@ func HashChunkSelected(typeCtx types.Context, h []hash.Hash64, chk *chunk.Chunk,
579
576
b = unsafe .Slice ((* byte )(unsafe .Pointer (& v )), sizeUint64 )
580
577
} else {
581
578
buf [0 ] = compactBytesFlag
582
- enumVal := column .GetEnum (i )
583
- str := enumVal .Name
584
- if str == "" {
585
- enum , err := types .ParseEnumValue (tp .GetElems (), enumVal .Value )
586
- if err == nil {
587
- // str will be empty string if v out of definition of enum.
588
- str = enum .Name
589
- }
579
+ v := column .GetEnum (i ).Value
580
+ str := ""
581
+ if enum , err := types .ParseEnumValue (tp .GetElems (), v ); err == nil {
582
+ // str will be empty string if v out of definition of enum.
583
+ str = enum .Name
590
584
}
591
585
b = ConvertByCollation (hack .Slice (str ), tp )
592
586
}
0 commit comments