You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "zeroshade (via GitHub)" <gi...@apache.org> on 2023/02/08 20:26:05 UTC

[GitHub] [arrow] zeroshade commented on a diff in pull request #34079: GH-34077: [Go] Implement RunEndEncoded Scalar

zeroshade commented on code in PR #34079:
URL: https://github.com/apache/arrow/pull/34079#discussion_r1100645386


##########
go/arrow/scalar/scalar.go:
##########
@@ -664,6 +671,28 @@ func GetScalar(arr arrow.Array, idx int) (Scalar, error) {
 		return NewTime64Scalar(arr.Value(idx), arr.DataType()), nil
 	case *array.Timestamp:
 		return NewTimestampScalar(arr.Value(idx), arr.DataType()), nil
+	case *array.RunEndEncoded:
+		physicalIndex := encoded.FindPhysicalIndex(arr.Data(), arr.Offset()+idx)
+		value, err := GetScalar(arr.Values(), physicalIndex)
+		if err != nil {
+			return nil, err
+		}
+
+		var runLength int64
+
+		runEnds := arr.RunEndsArr()
+		switch ends := runEnds.(type) {
+		case *array.Int16:
+			runLength = int64(ends.Value(physicalIndex))
+		case *array.Int32:
+			runLength = int64(ends.Value(physicalIndex))
+		case *array.Int64:
+			runLength = int64(ends.Value(physicalIndex))
+		}

Review Comment:
   @felipecrv did you discuss the run-end-encoded scalar with @pitrou or anyone else? @lidavidm makes a good point that there's the possibility that we don't actually need a specific RunEndEncoded scalar type.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org