-
Notifications
You must be signed in to change notification settings - Fork 5
feat: Support int32 to uint64 in reverseTransformArray #728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,6 +68,8 @@ func reverseTransformArray(dt arrow.DataType, arr arrow.Array) arrow.Array { | |
| return reverseTransformTime64(dt.(*arrow.Time64Type), arr) | ||
| case *array.Date32: | ||
| return reverseTransformFromDate32(dt, arr) | ||
| case *array.Int32: | ||
| return reverseTransformFromInt32(dt, arr) | ||
| case *array.Uint32: | ||
| return reverseTransformFromUint32(dt, arr) | ||
| case *array.Struct: | ||
|
|
@@ -102,6 +104,27 @@ func reverseTransformArray(dt arrow.DataType, arr arrow.Array) arrow.Array { | |
| } | ||
| } | ||
|
|
||
| func reverseTransformFromInt32(dt arrow.DataType, arr *array.Int32) arrow.Array { | ||
| switch dt { | ||
| case arrow.PrimitiveTypes.Uint64: | ||
| builder := array.NewUint64Builder(memory.DefaultAllocator) | ||
| for i := 0; i < arr.Len(); i++ { | ||
| if arr.IsNull(i) { | ||
| builder.AppendNull() | ||
| continue | ||
| } | ||
| v := arr.Value(i) | ||
| if v < 0 { | ||
| panic(fmt.Errorf("negative int32 value %d at index %d cannot be converted to uint64", v, i)) | ||
|
Comment on lines
+110
to
+118
|
||
| } | ||
| builder.Append(uint64(v)) | ||
| } | ||
| return builder.NewArray() | ||
| default: | ||
| panic(fmt.Errorf("unsupported conversion from %s to %s", arr.DataType(), dt)) | ||
| } | ||
| } | ||
|
|
||
| func reverseTransformFromUint32(dt arrow.DataType, arr *array.Uint32) arrow.Array { | ||
| switch dt { | ||
| case arrow.PrimitiveTypes.Uint64: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.