Skip to content
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

Resync with influxdata/flux 0.194.4 #14

Open
wants to merge 52 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
a5f310a
build(deps): bump golang.org/x/net from 0.7.0 to 0.17.0 (#5434)
dependabot[bot] Oct 12, 2023
43ad07e
fix(flux-core): infinite loop protection in the parser (#5436)
mhilton Oct 25, 2023
1a84183
build(deps): bump google.golang.org/grpc from 1.44.0 to 1.56.3 (#5437)
dependabot[bot] Oct 26, 2023
ba1befe
chore(docs): update math.copysign example with negative values (#5441)
sanderson Nov 13, 2023
8d1d6c8
fix(libflux): build error on >= rust-1.72.0 (#5440)
stkw0 Nov 15, 2023
6cce840
chore: update build tools (#5443)
mhilton Nov 21, 2023
8d76a72
chore(deps): update github.com/mattn/go-sqlite3 (#5444)
mhilton Nov 21, 2023
1217386
build(deps): bump golang.org/x/net in /internal/tools (#5446)
dependabot[bot] Nov 21, 2023
09a46ab
build(deps): bump github.com/sassoftware/go-rpmutils in /internal/too…
dependabot[bot] Nov 21, 2023
e9408dd
build(deps): bump google.golang.org/grpc in /internal/tools (#5447)
dependabot[bot] Nov 21, 2023
aaf3d3b
chore: update goreleaser (#5449)
mhilton Nov 21, 2023
505186b
build(deps): bump github.com/sigstore/cosign/v2 in /internal/tools (#…
dependabot[bot] Nov 21, 2023
b440835
chore(docs): fix typos through stdlib documentation (#5454)
sanderson Nov 28, 2023
aafedb5
build(deps): bump github.com/go-git/go-git/v5 in /internal/tools (#5457)
dependabot[bot] Jan 2, 2024
a9bba5e
build(deps): bump golang.org/x/crypto from 0.14.0 to 0.17.0 (#5455)
dependabot[bot] Jan 2, 2024
e831467
build(deps): bump golang.org/x/crypto in /internal/tools (#5456)
dependabot[bot] Jan 2, 2024
89fdfcb
build(deps): bump github.com/cloudflare/circl from 1.3.5 to 1.3.7 in …
dependabot[bot] Jan 8, 2024
0d09dd6
build(deps): bump gopkg.in/go-jose/go-jose.v2 in /internal/tools (#5465)
dependabot[bot] Mar 8, 2024
e72c92d
build(deps): bump google.golang.org/protobuf from 1.30.0 to 1.33.0 (#…
dependabot[bot] Mar 14, 2024
1325183
build(deps): bump google.golang.org/protobuf in /internal/tools (#5467)
dependabot[bot] Mar 14, 2024
6438357
build(deps): bump github.com/docker/docker in /internal/tools (#5470)
dependabot[bot] Mar 21, 2024
80c6f42
build(deps): bump github.com/sigstore/cosign/v2 from 2.2.1 to 2.2.4 i…
dependabot[bot] Apr 15, 2024
664cfc3
build(deps): bump golang.org/x/net in /internal/tools (#5472)
dependabot[bot] Apr 19, 2024
03d39ce
build(deps): bump golang.org/x/net from 0.17.0 to 0.23.0 (#5473)
dependabot[bot] Apr 19, 2024
91d1fc8
chore: Update README.md (#5476)
helenosheaa May 3, 2024
37f33ad
chore: Fix Windows CI (#5481)
powersj May 17, 2024
918c26c
chore: fix build-ci-image job (#5480)
jeffreyssmith2nd May 17, 2024
bea9586
feat(execute): allocate memory for string content. (#5482)
mhilton May 21, 2024
96ae92b
feat(array): less leaky string array (#5483)
mhilton May 23, 2024
68c831c
fix(libflux): build on rust 1.78 (#5484)
mhilton May 24, 2024
32f7947
feat: return to internal string references (#5486)
mhilton Jun 5, 2024
165b17e
feat: upgrade github.com/benbjohnson/immutable (#5488)
mhilton Jun 5, 2024
fc18931
fix: update github.com/SAP/go-hdb (#5487)
mhilton Jun 5, 2024
7b5a590
chore: update transitive Arrow dependencies (#5489)
jacobmarble Jun 6, 2024
da04c3f
fix(stdlib): join path correctly in influxdb source (#5490)
mhilton Jun 7, 2024
2b7d8f8
build(deps): bump github.com/Azure/azure-sdk-for-go/sdk/azidentity (#…
dependabot[bot] Jun 12, 2024
6412246
fix: null string to bytes conversions (#5492)
mhilton Jun 13, 2024
27fa85d
fix(stdlib/influxdata/wideto): panic with null string key (#5493)
mhilton Jun 13, 2024
5048e02
build(deps): bump github.com/hashicorp/go-retryablehttp from 0.7.5 to…
dependabot[bot] Jun 27, 2024
83f0400
fix(libflux): only compile `flux-core` with `strict` if enabled in `f…
davidkna Jul 8, 2024
96f20b0
build(deps): bump google.golang.org/grpc from 1.64.0 to 1.64.1 (#5497)
dependabot[bot] Jul 10, 2024
1d4faa4
build(deps): bump github.com/docker/docker from 24.0.9+incompatible t…
dependabot[bot] Jul 30, 2024
b624a57
build(deps): bump google.golang.org/grpc from 1.64.0 to 1.64.1 in /in…
dependabot[bot] Jul 30, 2024
6a33162
build(deps): bump github.com/docker/docker in /internal/tools (#5501)
dependabot[bot] Aug 13, 2024
6ffcb71
fix: Revert "feat(execute): allocate memory for string content. (#548…
mhilton Aug 13, 2024
c2433e6
fix: Make fewer copies when building a string array (#5503)
mhilton Aug 13, 2024
da19e08
build(deps): update rust version (#5505)
mhilton Sep 9, 2024
b5a2f38
docs: update comments to clarify behaviour (#5506)
btasker Oct 4, 2024
4f84744
build(deps): bump github.com/golang-jwt/jwt/v4 in /internal/tools (#5…
dependabot[bot] Nov 15, 2024
041192a
feat: make `endpoint` report the upstream status code (#5510)
btasker Nov 27, 2024
d452b50
chore: upgrade pkg-config (#5513)
btasker Nov 29, 2024
ec16ca2
build(deps): bump golang.org/x/crypto from 0.24.0 to 0.31.0 (#5519)
dependabot[bot] Dec 12, 2024
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
12 changes: 8 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ jobs:
keys:
- flux-gomod-{{checksum "go.sum"}}
# Run tests
- run: make test-bench
- run:
command: make test-bench
no_output_timeout: 20m
# No need to save the pkg/mod cache since the other job does it
test-build-reproducibility:
docker:
Expand All @@ -105,9 +107,10 @@ jobs:
git clone https://github.com/influxdata/rustup.install.git "${TMP}/rustup.install"
cd "${TMP}/rustup.install"
git checkout bump-v1.25.1
choco install -dvf ./rustup.install.nuspec
choco pack --pre ./rustup.install.nuspec
choco install rustup.install --source="C:\Users\circleci\AppData\Local\Temp\rustup.install"
cd -
choco upgrade golang --version=1.18 --allow-downgrade
choco upgrade golang --version=1.21 --allow-downgrade

choco install \
grep \
Expand Down Expand Up @@ -185,7 +188,8 @@ jobs:

build-ci-image:
machine:
image: ubuntu-2204:2022.04.1
image: ubuntu-2204:current
resource_class: medium
steps:
- checkout
- run:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile_build
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
# and verification, we can list the rust container as a prior build stage, and
# then pull in the artifacts we need. There is an added benefit that tagged versions
# also include minor releases, so 1.2 includes 1.2.1 and so on, for bugfix releases.
FROM rust:1.68 as RUSTBUILD
FROM rust:1.78 as RUSTBUILD

FROM golang:1.19 as PKGCONFIG
FROM golang:1.21 as PKGCONFIG
COPY go.mod go.sum /go/src/github.com/influxdata/flux/
RUN cd /go/src/github.com/influxdata/flux && \
go build -o /usr/local/bin/cgo-pkgbuild github.com/influxdata/pkg-config

FROM golang:1.19
FROM golang:1.21

# Install common packages
RUN apt-get update && \
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:warning: InfluxData still support Flux, but we are not doing active development on it or adding any new features to it. We still do security patches and will address any critical defects through the maintenance period. Our focus now is on features related to our latest database engine, InfluxDB 3.0, and its associated products (Cloud Serverless, Cloud Dedicated, Clustered, Edge). There is a community owned fork of [Flux](https://github.com/InfluxCommunity/flux) where active development is happening.

# Flux - Influx data language

[![CircleCI](https://circleci.com/gh/influxdata/flux/tree/master.svg?style=svg)](https://circleci.com/gh/influxdata/flux/tree/master)
Expand Down
156 changes: 32 additions & 124 deletions array/array.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ package array

import (
"strconv"
"sync/atomic"

"github.com/apache/arrow/go/v7/arrow"
"github.com/apache/arrow/go/v7/arrow/array"
arrowmem "github.com/apache/arrow/go/v7/arrow/memory"

"github.com/influxdata/flux/codes"
"github.com/influxdata/flux/internal/errors"
"github.com/influxdata/flux/memory"
Expand Down Expand Up @@ -103,10 +102,23 @@ type Builder interface {
NewArray() Array
}

type binaryArray interface {
NullN() int
NullBitmapBytes() []byte
IsNull(i int) bool
IsValid(i int) bool
Data() arrow.ArrayData
Len() int
ValueBytes() []byte
ValueLen(i int) int
ValueOffset(i int) int
ValueString(i int) string
Retain()
Release()
}

type String struct {
length int
data *array.Binary
value *stringValue
binaryArray
}

// NewStringFromBinaryArray creates an instance of String from
Expand All @@ -118,140 +130,36 @@ type String struct {
func NewStringFromBinaryArray(data *array.Binary) *String {
data.Retain()
return &String{
data: data,
binaryArray: data,
}
}

func (a *String) DataType() DataType {
return StringType
}
func (a *String) NullN() int {
if a.data != nil {
return a.data.NullN()
}
return 0
}
func (a *String) NullBitmapBytes() []byte {
if a.data != nil {
return a.data.NullBitmapBytes()
}
return nil
}
func (a *String) IsNull(i int) bool {
if a.data != nil {
return a.data.IsNull(i)
}
return false
}
func (a *String) IsValid(i int) bool {
if a.data != nil {
return a.data.IsValid(i)
}
return true
}
func (a *String) Data() arrow.ArrayData {
if a.data != nil {
return a.data.Data()
}
return nil
}
func (a *String) Len() int {
if a.data != nil {
return a.data.Len()
}
return a.length
}
func (a *String) Retain() {
if a.data != nil {
a.data.Retain()
return
}
a.value.Retain()
}
func (a *String) Release() {
if a.data != nil {
a.data.Release()
return
}
a.value.Release()
}

func (a *String) Slice(i, j int) Array {
if a.data != nil {
data := array.NewSliceData(a.data.Data(), int64(i), int64(j))
defer data.Release()
return &String{
data: array.NewBinaryData(data),
}
slice, ok := a.binaryArray.(interface{ Slice(i, j int) binaryArray })
if ok {
return &String{binaryArray: slice.Slice(i, j)}
}
a.value.Retain()
data := array.NewSliceData(a.binaryArray.Data(), int64(i), int64(j))
defer data.Release()
return &String{
value: a.value,
length: j - i,
binaryArray: array.NewBinaryData(data),
}
}

// ValueBytes returns a byte slice containing the value of this string
// at index i. This slice points to the contents of the data buffer and
// is only valid for the lifetime of the array.
func (a *String) ValueBytes(i int) []byte {
if a.data != nil {
return a.data.Value(i)
}
return a.value.Bytes()
}

// Value returns a string copy of the value stored at index i. The
// returned value will outlive the array and is safe to use like any
// other go string. The memory backing the string will be allocated by
// the runtime, rather than any provided allocator.
// Value returns a string view of the bytes in the array. The string
// is only valid for the lifetime of the array. Care should be taken not
// to store this string without also retaining the array.
func (a *String) Value(i int) string {
return string(a.ValueBytes(i))
}
func (a *String) ValueLen(i int) int {
if a.data != nil {
return a.data.ValueLen(i)
}
return a.value.Len()
}
func (a *String) IsConstant() bool {
return a.data == nil
}

type stringValue struct {
rc int64
data []byte

mem arrowmem.Allocator
return a.ValueString(i)
}

func (v *stringValue) Retain() {
if v == nil {
return
}
atomic.AddInt64(&v.rc, 1)
}

func (v *stringValue) Release() {
if v == nil {
return
}
if atomic.AddInt64(&v.rc, -1) == 0 {
v.mem.Free(v.data)
}
}

func (v *stringValue) Bytes() []byte {
if v == nil {
return nil
}
return v.data
}

func (v *stringValue) Len() int {
if v == nil {
return 0
}
return len(v.data)
func (a *String) IsConstant() bool {
ic, ok := a.binaryArray.(interface{ IsConstant() bool })
return ok && ic.IsConstant()
}

type sliceable interface {
Expand Down
28 changes: 20 additions & 8 deletions array/array_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,30 @@ func TestString(t *testing.T) {
for _, tc := range []struct {
name string
build func(b *array.StringBuilder)
bsz int
sz int
want []interface{}
}{
{
name: "Constant",
build: func(b *array.StringBuilder) {
for i := 0; i < 10; i++ {
b.Append("a")
b.Append("abcdefghij")
}
},
sz: 1,
bsz: 64, // 64 bytes data.
sz: 64, // The minimum size of a buffer is 64 bytes
want: []interface{}{
"a", "a", "a", "a", "a",
"a", "a", "a", "a", "a",
"abcdefghij",
"abcdefghij",
"abcdefghij",
"abcdefghij",
"abcdefghij",
"abcdefghij",
"abcdefghij",
"abcdefghij",
"abcdefghij",
"abcdefghij",
},
},
{
Expand All @@ -41,7 +51,8 @@ func TestString(t *testing.T) {
b.Append("b")
}
},
sz: 192,
bsz: 192,
sz: 192,
want: []interface{}{
"a", "a", "a", "a", "a",
"b", "b", "b", "b", "b",
Expand All @@ -58,7 +69,8 @@ func TestString(t *testing.T) {
b.Append(v)
}
},
sz: 192,
bsz: 192,
sz: 192,
want: []interface{}{
"a", "b", "c", "d", "e",
nil, "g", "h", "i", "j",
Expand Down Expand Up @@ -90,7 +102,7 @@ func TestString(t *testing.T) {
if want, got := len(tc.want)+2, b.Cap(); want != got {
t.Errorf("unexpected builder cap -want/+got:\n\t- %d\n\t+ %d", want, got)
}
assert.Equal(t, tc.sz, mem.CurrentAlloc(), "unexpected memory allocation.")
assert.Equal(t, tc.bsz, mem.CurrentAlloc(), "unexpected memory allocation.")

arr := b.NewStringArray()
defer arr.Release()
Expand Down Expand Up @@ -165,7 +177,7 @@ func TestStringBuilder_NewArray(t *testing.T) {
}

arr := b.NewArray()
assert.Equal(t, 1, mem.CurrentAlloc(), "unexpected memory allocation.")
assert.Equal(t, 64, mem.CurrentAlloc(), "unexpected memory allocation.")
arr.Release()
mem.AssertSize(t, 0)

Expand Down
24 changes: 12 additions & 12 deletions array/binary.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ func StringAdd(l, r *String, mem memory.Allocator) (*String, error) {
b.Resize(n)
for i := 0; i < n; i++ {
if l.IsValid(i) && r.IsValid(i) {
lb := l.ValueBytes(i)
rb := r.ValueBytes(i)
buf := make([]byte, len(lb)+len(rb))
copy(buf, lb)
copy(buf[len(lb):], rb)
ls := l.Value(i)
rs := r.Value(i)
buf := make([]byte, len(ls)+len(rs))
copy(buf, ls)
copy(buf[len(ls):], rs)
b.AppendBytes(buf)

} else {
Expand All @@ -177,10 +177,10 @@ func StringAddLConst(l string, r *String, mem memory.Allocator) (*String, error)
b.Resize(n)
for i := 0; i < n; i++ {
if r.IsValid(i) {
rb := r.ValueBytes(i)
buf := make([]byte, len(l)+len(rb))
rs := r.Value(i)
buf := make([]byte, len(l)+len(rs))
copy(buf, l)
copy(buf[len(l):], rb)
copy(buf[len(l):], rs)
b.AppendBytes(buf)

} else {
Expand All @@ -198,10 +198,10 @@ func StringAddRConst(l *String, r string, mem memory.Allocator) (*String, error)
b.Resize(n)
for i := 0; i < n; i++ {
if l.IsValid(i) {
lb := l.ValueBytes(i)
buf := make([]byte, len(lb)+len(r))
copy(buf, lb)
copy(buf[len(lb):], r)
ls := l.Value(i)
buf := make([]byte, len(ls)+len(r))
copy(buf, ls)
copy(buf[len(ls):], r)
b.AppendBytes(buf)

} else {
Expand Down
Loading