Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/go-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,10 @@ jobs:
go-version: ${{ matrix.go }}
cache: true
cache-dependency-path: go.sum
- name: Install staticcheck
run: GOTOOLCHAIN='go1.24.9' go install honnef.co/go/tools/cmd/staticcheck@v0.6.1
- name: Run golangci-lint
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7
with:
version: v2.0.2
args: --timeout=10m
- name: Lint
run: staticcheck ./...
- name: Run tests
run: go test -v ./...
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ linters:
- misspell
- nlreturn
- perfsprint
- staticcheck
settings:
errcheck:
exclude-functions:
Expand Down
14 changes: 8 additions & 6 deletions catalog/rest/rest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,8 @@ func (r *RestCatalogSuite) TestListTablesPagination() {
r.Equal(strconv.Itoa(defaultPageSize), pageSize)

var response map[string]any
if pageToken == "" {
switch pageToken {
case "":
response = map[string]any{
"identifiers": []any{
map[string]any{
Expand All @@ -504,7 +505,7 @@ func (r *RestCatalogSuite) TestListTablesPagination() {
},
"next-page-token": "token1",
}
} else if pageToken == "token1" {
case "token1":
r.Equal("token1", pageToken)
response = map[string]any{
"identifiers": []any{
Expand All @@ -519,7 +520,7 @@ func (r *RestCatalogSuite) TestListTablesPagination() {
},
"next-page-token": "token2",
}
} else {
default:
r.Equal("token2", pageToken)
response = map[string]any{
"identifiers": []any{
Expand Down Expand Up @@ -1782,7 +1783,8 @@ func (r *RestCatalogSuite) TestListViewsPagination() {
r.Equal(strconv.Itoa(defaultPageSize), pageSize)

var response map[string]any
if pageToken == "" {
switch pageToken {
case "":
response = map[string]any{
"identifiers": []any{
map[string]any{
Expand All @@ -1796,7 +1798,7 @@ func (r *RestCatalogSuite) TestListViewsPagination() {
},
"next-page-token": "token1",
}
} else if pageToken == "token1" {
case "token1":
r.Equal("token1", pageToken)
response = map[string]any{
"identifiers": []any{
Expand All @@ -1811,7 +1813,7 @@ func (r *RestCatalogSuite) TestListViewsPagination() {
},
"next-page-token": "token2",
}
} else {
default:
r.Equal("token2", pageToken)
response = map[string]any{
"identifiers": []any{
Expand Down
22 changes: 13 additions & 9 deletions exprs.go
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ func (ul *unboundLiteralPredicate) Bind(schema *Schema, caseSensitive bool) (Boo
}

if (ul.op == OpStartsWith || ul.op == OpNotStartsWith) &&
!(bound.Type().Equals(PrimitiveTypes.String) || bound.Type().Equals(PrimitiveTypes.Binary)) {
(!bound.Type().Equals(PrimitiveTypes.String) && !bound.Type().Equals(PrimitiveTypes.Binary)) {
return nil, fmt.Errorf("%w: StartsWith and NotStartsWith must bind to String type, not %s",
ErrType, bound.Type())
}
Expand Down Expand Up @@ -853,15 +853,17 @@ func SetPredicate(op Operation, t UnboundTerm, lits []Literal) BooleanExpression

switch len(lits) {
case 0:
if op == OpIn {
switch op {
case OpIn:
return AlwaysFalse{}
} else if op == OpNotIn {
case OpNotIn:
return AlwaysTrue{}
}
case 1:
if op == OpIn {
switch op {
case OpIn:
return LiteralPredicate(OpEQ, t, lits[0])
} else if op == OpNotIn {
case OpNotIn:
return LiteralPredicate(OpNEQ, t, lits[0])
}
}
Expand Down Expand Up @@ -926,15 +928,17 @@ func createBoundSetPredicate(op Operation, term BoundTerm, lits Set[Literal]) (B

switch typedSet.Len() {
case 0:
if op == OpIn {
switch op {
case OpIn:
return AlwaysFalse{}, nil
} else if op == OpNotIn {
case OpNotIn:
return AlwaysTrue{}, nil
}
case 1:
if op == OpIn {
switch op {
case OpIn:
return createBoundLiteralPredicate(OpEQ, term, typedSet.Members()[0])
} else if op == OpNotIn {
case OpNotIn:
return createBoundLiteralPredicate(OpNEQ, term, typedSet.Members()[0])
}
}
Expand Down
8 changes: 4 additions & 4 deletions io/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (f *blobOpenFile) ReadAt(p []byte, off int64) (n int, err error) {
if f.b.newRangeReader != nil {
rdr, err = f.b.newRangeReader(f.ctx, f.key, off, int64(len(p)))
} else {
rdr, err = f.b.Bucket.NewRangeReader(f.ctx, f.key, off, int64(len(p)), nil)
rdr, err = f.b.NewRangeReader(f.ctx, f.key, off, int64(len(p)), nil)
}
if err != nil {
return 0, err
Expand Down Expand Up @@ -130,7 +130,7 @@ func (bfs *blobFileIO) Remove(name string) error {
return &fs.PathError{Op: "remove", Path: name, Err: err}
}

return bfs.Bucket.Delete(bfs.ctx, name)
return bfs.Delete(bfs.ctx, name)
}

func (bfs *blobFileIO) Create(name string) (FileWriter, error) {
Expand All @@ -144,7 +144,7 @@ func (bfs *blobFileIO) WriteFile(name string, content []byte) error {
return &fs.PathError{Op: "write file", Path: name, Err: err}
}

return bfs.Bucket.WriteAll(bfs.ctx, name, content, nil)
return bfs.WriteAll(bfs.ctx, name, content, nil)
}

// NewWriter returns a Writer that writes to the blob stored at path.
Expand All @@ -165,7 +165,7 @@ func (bfs *blobFileIO) NewWriter(ctx context.Context, path string, overwrite boo
}

if !overwrite {
if exists, err := bfs.Bucket.Exists(ctx, path); exists {
if exists, err := bfs.Exists(ctx, path); exists {
if err != nil {
return nil, &fs.PathError{Op: "new writer", Path: path, Err: err}
}
Expand Down
2 changes: 1 addition & 1 deletion manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ type manifestFileV1 struct {
}

func (m *manifestFileV1) toFile() *manifestFile {
m.manifestFile.version = 1
m.version = 1
m.Content = ManifestContentData
m.SeqNumber, m.MinSeqNumber = initialSequenceNumber, initialSequenceNumber

Expand Down
4 changes: 2 additions & 2 deletions schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ func (s *setFreshIDs) Primitive(p PrimitiveType) Type {
// it is nil then a simple incrementing counter is used starting at 1.
func AssignFreshSchemaIDs(sc *Schema, nextID func() int) (*Schema, error) {
if nextID == nil {
var id int = 0
id := 0
nextID = func() int {
id++

Expand Down Expand Up @@ -1505,7 +1505,7 @@ func sanitizeName(n string) string {
b.Grow(len(n))

first := n[0]
if !(unicode.IsLetter(rune(first)) || first == '_') {
if !unicode.IsLetter(rune(first)) && first != '_' {
b.WriteString(sanitize(rune(first)))
} else {
b.WriteByte(first)
Expand Down
2 changes: 1 addition & 1 deletion table/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -1616,7 +1616,7 @@ func initMetadataV1Deser() *metadataV1 {
meta := metadataV1{
commonMetadata: initCommonMetadataForDeserialization(),
}
meta.commonMetadata.DefaultSortOrderID = 0
meta.DefaultSortOrderID = 0

return &meta
}
Expand Down
1 change: 1 addition & 0 deletions table/metadata_builder_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func builderWithoutChanges(formatVersion int) MetadataBuilder {
panic(err)
}
if err = builder.SetLoc("s3://bucket/test/location"); err != nil {
panic(err)
}
if err = builder.AddSchema(&tableSchema); err != nil {
panic(err)
Expand Down
2 changes: 1 addition & 1 deletion table/table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ func (t *TableWritingTestSuite) SetupSuite() {
}

func (t *TableWritingTestSuite) SetupTest() {
t.location = filepath.ToSlash(strings.Replace(t.T().TempDir(), "#", "", -1))
t.location = filepath.ToSlash(strings.ReplaceAll(t.T().TempDir(), "#", ""))
}

func (t *TableWritingTestSuite) TearDownSuite() {
Expand Down
Loading