This is an automated email from the ASF dual-hosted git repository.
laskoviymishka pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-go.git
The following commit(s) were added to refs/heads/main by this push:
new bc7d18759 refactor: remove unused functions (#2647)
bc7d18759 is described below
commit bc7d187598f7a3d99eb3e65436d5d79821400601
Author: Badal Prasad Singh <[email protected]>
AuthorDate: Thu Nov 19 18:51:33 2026 +0530
refactor: remove unused functions (#2647)
minor
Signed-off-by: badalprasadsingh <[email protected]>
---
catalog/hive/hive_integration_test.go | 9 -----
internal/avro_schemas.go | 8 -----
table/arrow_scanner.go | 4 ---
table/arrow_utils.go | 19 ----------
table/deferred_snapshots.go | 12 -------
table/equality_delete_reader.go | 6 ----
table/internal/parquet_files.go | 34 ------------------
table/internal/utils.go | 15 --------
table/metadata.go | 23 ------------
table/pos_delete_partitioned_fanout_writer_test.go | 41 ----------------------
table/scanner.go | 9 -----
table/table.go | 4 ---
12 files changed, 184 deletions(-)
diff --git a/catalog/hive/hive_integration_test.go
b/catalog/hive/hive_integration_test.go
index e2e2d3857..d72dcac76 100644
--- a/catalog/hive/hive_integration_test.go
+++ b/catalog/hive/hive_integration_test.go
@@ -43,7 +43,6 @@ import (
//
// 2. Set the required environment variables:
// export TEST_HIVE_URI=thrift://localhost:9083
-// export TEST_HIVE_DATABASE=test_db
// export TEST_TABLE_LOCATION=/tmp/iceberg/warehouse
//
// 3. Run the tests:
@@ -57,14 +56,6 @@ func getTestHiveURI() string {
return uri
}
-func getTestDatabase() string {
- db := os.Getenv("TEST_HIVE_DATABASE")
- if db == "" {
- return "test_iceberg_db"
- }
- return db
-}
-
func getTestTableLocation() string {
loc := os.Getenv("TEST_TABLE_LOCATION")
if loc == "" {
diff --git a/internal/avro_schemas.go b/internal/avro_schemas.go
index 5d24293ec..44b6f6ed2 100644
--- a/internal/avro_schemas.go
+++ b/internal/avro_schemas.go
@@ -70,10 +70,6 @@ func DecimalNode(precision, scale int) avro.SchemaNode {
}
}
-func DecimalSchema(precision, scale int) *avro.Schema {
- return mustSchema(DecimalNode(precision, scale))
-}
-
func FixedNode(size int) avro.SchemaNode {
return avro.SchemaNode{
Type: atype.Fixed,
@@ -82,10 +78,6 @@ func FixedNode(size int) avro.SchemaNode {
}
}
-func FixedSchema(size int) *avro.Schema {
- return mustSchema(FixedNode(size))
-}
-
// Schema nodes for reuse in composition.
var (
NullNode = avro.SchemaNode{Type: atype.Null}
diff --git a/table/arrow_scanner.go b/table/arrow_scanner.go
index 61f7d835c..48a37680b 100644
--- a/table/arrow_scanner.go
+++ b/table/arrow_scanner.go
@@ -1076,10 +1076,6 @@ func readPositionDeleteBitmapsForPaths(
return bitmaps, nil
}
-func readDeletes(ctx context.Context, fs iceio.IO, dataFile iceberg.DataFile)
(map[string]*arrow.Chunked, error) {
- return readDeletesForPaths(ctx, fs, dataFile, nil)
-}
-
func readDeletesForPaths(ctx context.Context, fs iceio.IO, dataFile
iceberg.DataFile,
targets map[string]struct{},
) (_ map[string]*arrow.Chunked, err error) {
diff --git a/table/arrow_utils.go b/table/arrow_utils.go
index fa6152ae3..34db73820 100644
--- a/table/arrow_utils.go
+++ b/table/arrow_utils.go
@@ -1513,16 +1513,6 @@ func checkSchemaCompat(requested, provided
*iceberg.Schema) error {
return compat
}
-func checkArrowSchemaCompat(requested *iceberg.Schema, provided *arrow.Schema,
downcastNanoToMicro bool) error {
- mapping := requested.NameMapping()
- providedSchema, err := ArrowSchemaToIceberg(provided,
downcastNanoToMicro, mapping)
- if err != nil {
- return err
- }
-
- return checkSchemaCompat(requested, providedSchema)
-}
-
func checkArrowSchemaCompatWithProperties(requested *iceberg.Schema, provided
*arrow.Schema, downcastNanoToMicro bool, props iceberg.Properties) error {
providedSchema, err := ArrowSchemaToIcebergWithOptions(provided,
ArrowToIcebergOptions{
DowncastNsTimestamp: downcastNanoToMicro,
@@ -2738,15 +2728,6 @@ func (c convertToIceberg) geoArrowCRSToIcebergCRS(meta
geoarrow.Metadata) (strin
return projJSONCRSFromTable(fieldID, meta.CRS, c.tableSchema,
c.tableProperties)
}
-func geoArrowMetadataToIcebergType(meta geoarrow.Metadata) (iceberg.Type,
error) {
- crs, err := geoArrowCRSToIcebergCRS(meta)
- if err != nil {
- return nil, err
- }
-
- return geoArrowMetadataToIcebergTypeWithCRS(meta, crs)
-}
-
func geoArrowMetadataToIcebergTypeWithCRS(meta geoarrow.Metadata, crs string)
(iceberg.Type, error) {
// Missing GeoArrow edges use the planar default, matching arrow-rs
// geoarrow.wkb reads. PyIceberg-authored geography files may omit
edges,
diff --git a/table/deferred_snapshots.go b/table/deferred_snapshots.go
index 963ccde35..10cc2fe3d 100644
--- a/table/deferred_snapshots.go
+++ b/table/deferred_snapshots.go
@@ -22,7 +22,6 @@ import (
"encoding/json"
"errors"
"fmt"
- "maps"
"strconv"
"sync"
)
@@ -53,17 +52,6 @@ type deferredSnapshotOverlay struct {
applied []Snapshot
}
-func (o *deferredSnapshotOverlay) clone() *deferredSnapshotOverlay {
- if o == nil {
- return nil
- }
-
- return &deferredSnapshotOverlay{
- additions: cloneSnapshots(o.additions),
- removed: maps.Clone(o.removed),
- }
-}
-
func (o *deferredSnapshotOverlay) isRemoved(id int64) bool {
if o == nil {
return false
diff --git a/table/equality_delete_reader.go b/table/equality_delete_reader.go
index a1865de03..465a3b3fc 100644
--- a/table/equality_delete_reader.go
+++ b/table/equality_delete_reader.go
@@ -288,12 +288,6 @@ func resolveArrowField(refs arrowFieldRefsByID, fieldID
int, fieldName, filePath
return arrowFieldRef{}, fmt.Errorf("equality field ID %d (%s) not found
in %s", fieldID, fieldName, location)
}
-func arrowArrayAtField(record arrow.RecordBatch, ref arrowFieldRef, fieldID
int, fieldName, filePath string) (arrow.Array, error) {
- result, _, err := arrowArraysAtField(record, ref, fieldID, fieldName,
filePath)
-
- return result, err
-}
-
func arrowArraysAtField(record arrow.RecordBatch, ref arrowFieldRef, fieldID
int, fieldName, filePath string) (arrow.Array, []arrow.Array, error) {
location := filePath
if location == "" {
diff --git a/table/internal/parquet_files.go b/table/internal/parquet_files.go
index 0ef2b8536..a88730b49 100644
--- a/table/internal/parquet_files.go
+++ b/table/internal/parquet_files.go
@@ -249,40 +249,6 @@ func (p parquetFormat) createStatsAgg(typ
iceberg.PrimitiveType, physicalTypeStr
}
}
-func (parquetFormat) PrimitiveTypeToPhysicalType(typ iceberg.PrimitiveType)
string {
- switch typ.(type) {
- case iceberg.BooleanType:
- return "BOOLEAN"
- case iceberg.Int32Type:
- return "INT32"
- case iceberg.Int64Type:
- return "INT64"
- case iceberg.Float32Type:
- return "FLOAT"
- case iceberg.Float64Type:
- return "DOUBLE"
- case iceberg.DateType:
- return "INT32"
- case iceberg.TimeType:
- return "INT64"
- case iceberg.TimestampType, iceberg.TimestampTzType,
- iceberg.TimestampNsType, iceberg.TimestampTzNsType:
- return "INT64"
- case iceberg.StringType:
- return "BYTE_ARRAY"
- case iceberg.UUIDType:
- return "FIXED_LEN_BYTE_ARRAY"
- case iceberg.FixedType:
- return "FIXED_LEN_BYTE_ARRAY"
- case iceberg.BinaryType:
- return "BYTE_ARRAY"
- case iceberg.DecimalType:
- return "FIXED_LEN_BYTE_ARRAY"
- default:
- panic(fmt.Errorf("expected primitive type, got: %s", typ))
- }
-}
-
// ResolveParquetStatsColumnPaths maps Iceberg field names to the physical
// Parquet paths in a data file. The schema used for writing may have sanitized
// names or be a projection of the table schema. Java ignores these settings
for
diff --git a/table/internal/utils.go b/table/internal/utils.go
index 12ea54060..90c79364f 100644
--- a/table/internal/utils.go
+++ b/table/internal/utils.go
@@ -171,21 +171,6 @@ func BigEndianToDecimal(buf []byte) (decimal.Decimal128,
error) {
return decimal128.New(hi, uint64(lo)), nil
}
-func PartitionRecordValue(field iceberg.PartitionField, val iceberg.Literal,
schema *iceberg.Schema) (iceberg.Optional[iceberg.Literal], error) {
- var ret iceberg.Optional[iceberg.Literal]
- if val == nil {
- return ret, nil
- }
-
- f, ok := schema.FindFieldByIDRef(field.FirstSourceID(),
iceberginternal.SchemaRef{})
- if !ok {
- return ret, fmt.Errorf("%w: could not find source field in
schema for %s",
- iceberg.ErrInvalidSchema, field.String())
- }
-
- return partitionRecordValue(val, f.Type)
-}
-
func partitionRecordValue(val iceberg.Literal, sourceType iceberg.Type)
(iceberg.Optional[iceberg.Literal], error) {
var ret iceberg.Optional[iceberg.Literal]
if val == nil {
diff --git a/table/metadata.go b/table/metadata.go
index 230142cfb..089aecc21 100644
--- a/table/metadata.go
+++ b/table/metadata.go
@@ -2256,29 +2256,6 @@ func preflightMetadataBytes(b []byte)
(map[string]json.RawMessage, int, error) {
return metadata, formatVersion, nil
}
-func requirePartitionSpecIDs(b []byte) error {
- var metadata map[string]json.RawMessage
- if err := json.Unmarshal(b, &metadata); err != nil {
- return fmt.Errorf("%w: %w", ErrInvalidMetadata, err)
- }
-
- return requirePartitionSpecIDsFromMetadata(metadata)
-}
-
-func requirePartitionSpecIDsFromMetadata(metadata map[string]json.RawMessage)
error {
- rawSpecs, ok := metadata["partition-specs"]
- if !ok {
- return nil
- }
-
- var specs []rawPartitionSpec
- if err := json.Unmarshal(rawSpecs, &specs); err != nil {
- return fmt.Errorf("%w: invalid partition-specs: %w",
ErrInvalidMetadata, err)
- }
-
- return validatePartitionSpecIDs(specs)
-}
-
type rawPartitionSpec struct {
ID *int `json:"spec-id"`
Fields []map[string]json.RawMessage `json:"fields"`
diff --git a/table/pos_delete_partitioned_fanout_writer_test.go
b/table/pos_delete_partitioned_fanout_writer_test.go
index e1378b8a8..6a1c6a11f 100644
--- a/table/pos_delete_partitioned_fanout_writer_test.go
+++ b/table/pos_delete_partitioned_fanout_writer_test.go
@@ -579,17 +579,6 @@ func withFileFormatMatching() dataFileMatcherOption {
}
}
-func withPathMatching() dataFileMatcherOption {
- return func(m *dataFileMatcher) {
- m.matchers = append(m.matchers, func(expected iceberg.DataFile,
actual iceberg.DataFile) bool {
- return expected.FilePath() == actual.FilePath()
- })
- m.formatters = append(m.formatters, func(val iceberg.DataFile)
string {
- return "FilePath: " + val.FilePath()
- })
- }
-}
-
func withSpecIDMatching() dataFileMatcherOption {
return func(m *dataFileMatcher) {
m.matchers = append(m.matchers, func(expected iceberg.DataFile,
actual iceberg.DataFile) bool {
@@ -645,36 +634,6 @@ func withColumnSizesMatching() dataFileMatcherOption {
}
}
-func withContentOffsetMatching() dataFileMatcherOption {
- return func(m *dataFileMatcher) {
- m.matchers = append(m.matchers, func(expected iceberg.DataFile,
actual iceberg.DataFile) bool {
- return comparePointerAndValue(expected.ContentOffset(),
actual.ContentOffset())
- })
- m.formatters = append(m.formatters, func(val iceberg.DataFile)
string {
- if val.ContentSizeInBytes() == nil {
- return "ContentOffset: nil"
- }
-
- return fmt.Sprintf("ContentOffset: %d",
*val.ContentOffset())
- })
- }
-}
-
-func withContentSizeInBytesMatching() dataFileMatcherOption {
- return func(m *dataFileMatcher) {
- m.matchers = append(m.matchers, func(expected iceberg.DataFile,
actual iceberg.DataFile) bool {
- return
comparePointerAndValue(expected.ContentSizeInBytes(),
actual.ContentSizeInBytes())
- })
- m.formatters = append(m.formatters, func(val iceberg.DataFile)
string {
- if val.ContentSizeInBytes() == nil {
- return "ContentSizeInBytes: nil"
- }
-
- return fmt.Sprintf("ContentSizeInBytes: %d",
*val.ContentSizeInBytes())
- })
- }
-}
-
func withSortOrderIDMatching() dataFileMatcherOption {
return func(m *dataFileMatcher) {
m.matchers = append(m.matchers, func(expected iceberg.DataFile,
actual iceberg.DataFile) bool {
diff --git a/table/scanner.go b/table/scanner.go
index ca9538a91..d41aaf9f8 100644
--- a/table/scanner.go
+++ b/table/scanner.go
@@ -437,15 +437,6 @@ func streamManifest(ctx context.Context, manifestIO io.IO,
manifest iceberg.Mani
true, false, visit)
}
-func streamManifestWithOptions(ctx context.Context, manifestIO io.IO, manifest
iceberg.ManifestFile,
- partitionFilter, metricsEval func(iceberg.DataFile) (bool, error),
discardDeleted, discardExisting bool,
- visit func(iceberg.ManifestEntry) error,
-) error {
- return streamManifestWithReadOptions(ctx,
- manifestIO, manifest, partitionFilter, metricsEval, nil, false,
- discardDeleted, discardExisting, visit)
-}
-
func streamManifestWithReadOptions(ctx context.Context, manifestIO io.IO,
manifest iceberg.ManifestFile,
partitionFilter, metricsEval func(iceberg.DataFile) (bool, error),
projection *iceberg.ManifestEntryProjection,
diff --git a/table/table.go b/table/table.go
index a19e6040e..85e29173a 100644
--- a/table/table.go
+++ b/table/table.go
@@ -438,10 +438,6 @@ func (t Table) Delete(ctx context.Context, filter
iceberg.BooleanExpression, sna
return txn.Commit(ctx)
}
-func (t Table) manifestSet(ctx context.Context, snapshot Snapshot)
(snapshotManifestSet, error) {
- return t.manifestSetWithFSF(ctx, snapshot, t.fsF)
-}
-
func (t Table) manifestSetWithFSF(
ctx context.Context,
snapshot Snapshot,