zeroshade commented on code in PR #663:
URL: https://github.com/apache/arrow-go/pull/663#discussion_r2808025537


##########
parquet/file/file_writer_test.go:
##########
@@ -669,6 +673,13 @@ func NewColumnIndexObject(colIdx metadata.ColumnIndex) 
(ret ColumnIndexObject) {
 }
 
 func simpleEncode[T int32 | int64 | float32 | float64](val T) []byte {
+       if endian.IsBigEndian {
+               buf := bytes.NewBuffer(nil)
+               if err := binary.Write(buf, binary.LittleEndian, val); err != 
nil {
+                       panic(err)
+               }
+               return buf.Bytes()
+       }

Review Comment:
   there is a `ToLE` function in `internal/utils/` that might be better for 
this. For example:
   
   ```go
   val = utils.ToLE(val)
   return unsafe.Slice((*byte)(unsafe.Pointer(&val)), unsafe.Sizeof(val))
   ```
   
   This would work because on LittleEndian systems, `ToLE(val)` is just defined 
as `return val`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to