fix(substrait): emit decimal literals as 16-byte little-endian (#1130)

DecimalLiteral.MarshalBinary returns big-endian min-byte; Substrait's
expr.NewLiteral needs 16-byte little-endian and was silently returning
nil for everything else, panicking downstream. Convert before emit and
add whitebox tests covering small/zero/16-byte-negative values.
5 files changed
tree: 4b7ee657e91b0fa48426b6735240623199b53f08
  1. .github/
  2. catalog/
  3. cmd/
  4. codec/
  5. config/
  6. dev/
  7. internal/
  8. io/
  9. puffin/
  10. table/
  11. utils/
  12. view/
  13. website/
  14. .asf.yaml
  15. .gitattributes
  16. .gitignore
  17. .golangci.yml
  18. .pre-commit-config.yaml
  19. CONTRIBUTING.md
  20. data_file_codec.go
  21. data_file_codec_test.go
  22. errors.go
  23. exprs.go
  24. exprs_test.go
  25. go.mod
  26. go.sum
  27. LICENSE
  28. literals.go
  29. literals_test.go
  30. Makefile
  31. manifest.go
  32. manifest_test.go
  33. metadata_columns.go
  34. name_mapping.go
  35. name_mapping_test.go
  36. NOTICE
  37. operation_string.go
  38. partitions.go
  39. partitions_bench_test.go
  40. partitions_test.go
  41. predicates.go
  42. README.md
  43. schema.go
  44. schema_conversions.go
  45. schema_conversions_test.go
  46. schema_test.go
  47. transforms.go
  48. transforms_test.go
  49. types.go
  50. types_test.go
  51. utils.go
  52. visitors.go
  53. visitors_test.go
README.md

Iceberg Golang

Go Reference

iceberg is a Golang implementation of the Iceberg table spec.

Build From Source

Prerequisites

  • Go 1.25 or later

Build

$ git clone https://github.com/apache/iceberg-go.git
$ cd iceberg-go/cmd/iceberg && go build .

Running Tests

Use the Makefile so commands stay in sync with CI (e.g. golangci-lint version).

Unit tests

make test

Linting

make lint

Install the linter first

make lint-install
# or: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v2.8.0

Integration tests

Prerequisites: Docker, Docker Compose

  1. Start the Docker containers using docker compose:

    make integration-setup
    
  2. Export the required environment variables:

    export AWS_S3_ENDPOINT=http://$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' minio):9000
    export AWS_REGION=us-east-1
    export SPARK_CONTAINER_ID=$(docker ps -qf 'name=spark-iceberg')
    export DOCKER_API_VER=$(docker version -f '{{.Server.APIVersion}}')
    
  3. Run the integration tests:

    make integration-test
    

    Or run a single suite: make integration-scanner, make integration-io, make integration-rest, make integration-spark.

Feature Support / Roadmap

FileSystem Support

Filesystem TypeSupported
S3X
Google Cloud StorageX
Azure Blob StorageX
Local FilesystemX

Metadata

OperationSupported
Get SchemaX
Get SnapshotsX
Get Sort OrdersX
Get Partition SpecsX
Get ManifestsX
Create New ManifestsX
Plan Scanx
Plan Scan for Snapshotx

Catalog Support

OperationRESTHiveGlueSQLHadoop
Load TableXXXXX
List TablesXXXXX
Create TableXXXXX
Register TableXXX
Update Current SnapshotXXXXX
Create New SnapshotXXXXX
Rename TableXXXX
Drop TableXXXXX
Alter TableXXXXX
Check Table ExistsXXXXX
Set Table PropertiesXXXXX
List NamespacesXXXXX
Create NamespaceXXXXX
Check Namespace ExistsXXXXX
Drop NamespaceXXXXX
Update Namespace PropertiesXXXX
Create ViewXXX
Load ViewXX
List ViewXXX
Drop ViewXXX
Check View ExistsXXX

Read/Write Data Support

  • Data can currently be read as an Arrow Table or as a stream of Arrow record batches.

Supported Write Operations

As long as the FileSystem is supported and the Catalog supports altering the table, the following tracks the current write support:

OperationSupported
Append StreamX
Append Data FilesX
Rewrite Files
Rewrite manifests
Overwrite FilesX
Copy-On-Write DeleteX
Write Pos DeleteX
Write Eq Delete
Row Delta

CLI Usage

Run go build ./cmd/iceberg from the root of this repository to build the CLI executable, alternately you can run go install github.com/apache/iceberg-go/cmd/iceberg@latest to install it to the bin directory of your GOPATH.

The iceberg CLI usage is very similar to pyiceberg CLI
You can pass the catalog URI with --uri argument.

Example: You can start the Iceberg REST API docker image which runs on default in port 8181

docker pull apache/iceberg-rest-fixture:latest
docker run -p 8181:8181 apache/iceberg-rest-fixture:latest

and run the iceberg CLI pointing to the REST API server.

 ./iceberg --uri http://0.0.0.0:8181 list
┌─────┐
| IDs |
| --- |
└─────┘

Create Namespace

./iceberg --uri http://0.0.0.0:8181 create namespace taxitrips

List Namespace

 ./iceberg --uri http://0.0.0.0:8181 list
┌───────────┐
| IDs       |
| --------- |
| taxitrips |
└───────────┘


Get in Touch