From 89617661b91a1aae3eab73c9e1fc199e76698ad6 Mon Sep 17 00:00:00 2001 From: pyalex Date: Wed, 16 Mar 2022 14:57:42 -0700 Subject: [PATCH 01/10] work in progress Signed-off-by: pyalex --- .github/workflows/pr_integration_tests.yml | 4 +- .github/workflows/unit_tests.yml | 4 +- Makefile | 22 +- go.mod | 17 +- go.sum | 400 +++++++++- go/cmd/server/server.go | 59 +- go/embedded/online_features.go | 113 +++ go/internal/feast/featurestore.go | 753 +++++++++--------- go/internal/feast/featurestore_test.go | 182 ++++- go/internal/feast/repoconfig.go | 4 +- go/utils/typeconversion.go | 99 +++ sdk/python/MANIFEST.in | 3 +- sdk/python/feast/embedded_go/lib/__init__.py | 0 .../embedded_go/online_features_service.py | 120 +++ sdk/python/feast/feature_store.py | 37 +- sdk/python/go_build.py | 37 - .../requirements/py3.7-ci-requirements.txt | 2 + .../requirements/py3.8-ci-requirements.txt | 2 + .../requirements/py3.9-ci-requirements.txt | 2 + sdk/python/setup.cfg | 5 +- sdk/python/setup.py | 52 +- sdk/python/tests/conftest.py | 32 - .../feature_repos/repo_configuration.py | 4 - .../online_store/test_universal_online.py | 197 +---- 24 files changed, 1476 insertions(+), 674 deletions(-) create mode 100644 go/embedded/online_features.go create mode 100644 go/utils/typeconversion.go create mode 100644 sdk/python/feast/embedded_go/lib/__init__.py create mode 100644 sdk/python/feast/embedded_go/online_features_service.py delete mode 100644 sdk/python/go_build.py diff --git a/.github/workflows/pr_integration_tests.yml b/.github/workflows/pr_integration_tests.yml index 196800fa3e..0de48c8c00 100644 --- a/.github/workflows/pr_integration_tests.yml +++ b/.github/workflows/pr_integration_tests.yml @@ -151,9 +151,7 @@ jobs: - name: Install pip-tools run: pip install pip-tools - name: Install dependencies - run: | - make compile-protos-go - make install-python-ci-dependencies + run: make install-python-ci-dependencies - name: Setup Redis Cluster run: | docker pull vishnunair/docker-redis-cluster:latest diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 696a186ed8..70a8510a10 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -45,9 +45,7 @@ jobs: - name: Install pip-tools run: pip install pip-tools - name: Install dependencies - run: | - make compile-protos-go - make install-python-ci-dependencies + run: make install-python-ci-dependencies - name: Test Python env: SNOWFLAKE_CI_DEPLOYMENT: ${{ secrets.SNOWFLAKE_CI_DEPLOYMENT }} diff --git a/Makefile b/Makefile index a9d8a88840..64c7092bc1 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ build: protos build-java build-docker build-html # Python SDK -install-python-ci-dependencies: install-go-proto-dependencies +install-python-ci-dependencies: install-go-proto-dependencies install-go-ci-dependencies cd sdk/python && python -m piptools sync requirements/py$(PYTHON)-ci-requirements.txt cd sdk/python && COMPILE_GO=true python setup.py develop @@ -76,14 +76,9 @@ test-python-universal-local: test-python-universal: FEAST_USAGE=False IS_TEST=True python -m pytest -n 8 --integration --universal sdk/python/tests -test-python-go-server: - go build -o ${ROOT_DIR}/sdk/python/feast/binaries/server github.com/feast-dev/feast/go/cmd/server +test-python-go-server: compile-go-lib FEAST_USAGE=False IS_TEST=True python -m pytest -n 8 --integration --goserver sdk/python/tests -test-python-go-server-lifecycle: - go build -o ${ROOT_DIR}/sdk/python/feast/binaries/server github.com/feast-dev/feast/go/cmd/server - FEAST_USAGE=False IS_TEST=True python -m pytest -n 8 --integration --goserverlifecycle sdk/python/tests - format-python: # Sort cd ${ROOT_DIR}/sdk/python; python -m isort feast/ tests/ @@ -123,21 +118,26 @@ build-java: build-java-no-tests: ${MVN} --no-transfer-progress -Dmaven.javadoc.skip=true -Dgpg.skip -DskipUTs=true -DskipITs=true -Drevision=${REVISION} clean package -# Go SDK +# Go SDK & embedded install-go-proto-dependencies: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26.0 go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1.0 +install-go-ci-dependencies: + go get golang.org/x/tools/cmd/goimports + go get github.com/go-python/gopy + go install github.com/go-python/gopy + install-protoc-dependencies: pip install grpcio-tools==1.34.0 compile-protos-go: install-go-proto-dependencies install-protoc-dependencies cd sdk/python && python setup.py build_go_protos -compile-go-feature-server: compile-protos-go - go mod tidy - go build -o ${ROOT_DIR}/sdk/python/feast/binaries/server github.com/feast-dev/feast/go/cmd/server +compile-go-lib: install-go-proto-dependencies install-go-ci-dependencies + python -m install pybindgen + python sdk/python/setup.py build_go_lib test-go: compile-protos-go go test ./... diff --git a/go.mod b/go.mod index fa623c0ecf..0cb92efeae 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,9 @@ module github.com/feast-dev/feast go 1.17 require ( + github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 github.com/ghodss/yaml v1.0.0 + github.com/go-python/gopy v0.4.0 github.com/go-redis/redis/v8 v8.11.4 github.com/golang/protobuf v1.5.2 github.com/google/uuid v1.1.2 @@ -17,12 +19,21 @@ require ( github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/google/flatbuffers v2.0.0+incompatible // indirect github.com/google/go-cmp v0.5.7 // indirect + github.com/klauspost/compress v1.13.6 // indirect + github.com/kr/pretty v0.1.0 // indirect + github.com/pierrec/lz4/v4 v4.1.9 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 // indirect - golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect - golang.org/x/text v0.3.6 // indirect + golang.org/x/exp v0.0.0-20211028214138-64b4c8e87d1a // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 // indirect + golang.org/x/text v0.3.7 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/genproto v0.0.0-20220118154757-00ab72f36ad5 // indirect + gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) + +replace github.com/go-python/gopy v0.4.0 => github.com/pyalex/gopy v0.4.1-0.20220315220227-146bcd99e9f5 diff --git a/go.sum b/go.sum index 08ecb65693..4a428ee19e 100644 --- a/go.sum +++ b/go.sum @@ -1,14 +1,47 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20201218220906-28db891af037/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= +github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 h1:q4dksr6ICHXqG5hm0ZW5IHyeEJXoIJSOZeBLmWPNeIQ= +github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40/go.mod h1:Q7yQnSMnLvcXlZ8RV+jwz/6y1rQTqbX6C82SndT52Zs= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= +github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= +github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -17,29 +50,74 @@ github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-fonts/dejavu v0.1.0/go.mod h1:4Wt4I4OU2Nq9asgDCteaAaWZOV24E+0/Pwo0gppep4g= +github.com/go-fonts/latin-modern v0.2.0/go.mod h1:rQVLdDMK+mK1xscDwsqM5J8U2jrRa3T0ecnM9pNujks= +github.com/go-fonts/liberation v0.1.1/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= +github.com/go-fonts/stix v0.1.0/go.mod h1:w/c1f0ldAUlJmLBvlbkvVXLAD+tAMqobIIQpmnUIzUY= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-latex/latex v0.0.0-20210118124228-b3d85cf34e07/go.mod h1:CO1AlKB2CSIqUrmQPqA0gdRIlnLEY0gK5JGjh37zN5U= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-redis/redis/v8 v8.11.4 h1:kHoYkfZP6+pe04aFTnhDH6GDROa5yJdHJVNxV3F46Tg= github.com/go-redis/redis/v8 v8.11.4/go.mod h1:2Z2wHZXdQpCDXEGzqMockDpNyYvi2l4Pxt6RJr792+w= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= @@ -53,6 +131,14 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/gonuts/commander v0.1.0/go.mod h1:qkb5mSlcWodYgo7vs8ulLnXhfinhZsZcm6+H/z1JjgY= +github.com/gonuts/flag v0.1.0/go.mod h1:ZTmTGtrSPejTo/SRNhCqwLTmiAgyBdCkLYhHrAoBdz4= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/flatbuffers v2.0.0+incompatible h1:dicJ2oXwypfwUGnB2/TYWYEKiuk9eYQlQO/AnOHl5mI= +github.com/google/flatbuffers v2.0.0+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -62,110 +148,401 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= +github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= +github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= +github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= +github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.16.0 h1:6gjqkI8iiRHMvdccRJM8rVKjCWk6ZIm6FTm3ddIe4/c= github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= +github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= +github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= +github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= +github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= +github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= +github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= +github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= +github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= +github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pierrec/lz4/v4 v4.1.8/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/pierrec/lz4/v4 v4.1.9 h1:xkrjwpOP5xg1k4Nn4GX4a4YFGhscyQL/3EddJ1Xxqm8= +github.com/pierrec/lz4/v4 v4.1.9/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/pyalex/gopy v0.4.1-0.20220315220227-146bcd99e9f5 h1:+N63y8ub8/tUt4Z+U0WkoLpqX08biafsKfr1ZVe3Uus= +github.com/pyalex/gopy v0.4.1-0.20220315220227-146bcd99e9f5/go.mod h1:ZO6vpitQ61NVoQP/2yOubPS6ET5pP3CAWCiMYn5eqCc= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/rs/zerolog v1.21.0/go.mod h1:ZPhntP/xmq1nnND05hhpAh2QMhSsA4UN3MGZ6O2J3hM= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo= +go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU= +go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw= +go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc= +go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= +golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3/go.mod h1:NOZ3BPKG0ec/BKJQgnvsSFpcKLM5xXVWnvZS97DWHgE= +golang.org/x/exp v0.0.0-20211028214138-64b4c8e87d1a h1:9kUIHyUjWEuW2MdtaYvvEXTDs2eNylNVAt/ui66QGOg= +golang.org/x/exp v0.0.0-20211028214138-64b4c8e87d1a/go.mod h1:a3o/VtDNHN+dCVLEpzjjUHOzR+Ln3DHX056ZPzoZGGA= +golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20200618115811-c13761719519/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20210216034530-4410531fe030/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mobile v0.0.0-20201217150744-e6ae53a27f4f/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.1-0.20210830214625-1b1db11ec8f4/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 h1:DzZ89McO9/gWPsQXS/FVKAlG02ZjaQ6AlZRBimEYOd0= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 h1:2B5p2L5IfGiD7+b9BOoRMC6DgObAVZV+Fsp050NqXik= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190927191325-030b2cf1153e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= +gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= +gonum.org/v1/gonum v0.9.3 h1:DnoIG+QAMaF5NvxnGe/oKsgKcAc6PcUyl8q0VetfQ8s= +gonum.org/v1/gonum v0.9.3/go.mod h1:TZumC3NeyVQskjXqmyWt4S3bINhy7B4eYwW69EbyX+0= +gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= +gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= +gonum.org/v1/plot v0.9.0/go.mod h1:3Pcqqmp6RHvJI72kgb8fThyUnav364FOsdDo2aGW5lY= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/genproto v0.0.0-20220118154757-00ab72f36ad5 h1:zzNejm+EgrbLfDZ6lu9Uud2IVvHySPl8vQzf04laR5Q= google.golang.org/genproto v0.0.0-20220118154757-00ab72f36ad5/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= @@ -182,11 +559,20 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -195,5 +581,11 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/go/cmd/server/server.go b/go/cmd/server/server.go index 05748e6cf8..859c7c2d0a 100644 --- a/go/cmd/server/server.go +++ b/go/cmd/server/server.go @@ -4,6 +4,9 @@ import ( "context" "github.com/feast-dev/feast/go/internal/feast" "github.com/feast-dev/feast/go/protos/feast/serving" + "github.com/feast-dev/feast/go/protos/feast/types" + "github.com/feast-dev/feast/go/utils" + "github.com/golang/protobuf/ptypes/timestamp" ) type servingServiceServer struct { @@ -22,5 +25,59 @@ func (s *servingServiceServer) GetFeastServingInfo(ctx context.Context, request } func (s *servingServiceServer) GetOnlineFeatures(ctx context.Context, request *serving.GetOnlineFeaturesRequest) (*serving.GetOnlineFeaturesResponse, error) { - return s.fs.GetOnlineFeatures(ctx, request) + featureRefs, err := s.fs.ExtractFeatureRefs(request.GetKind(), request.GetFullFeatureNames()) + if err != nil { + return nil, err + } + featuresOrService, err := s.fs.ParseFeatures(request.GetKind()) + if err != nil { + return nil, err + } + + featureVectors, err := s.fs.GetOnlineFeatures( + ctx, + featureRefs, + featuresOrService.FeatureService, + request.GetEntities(), + request.GetFullFeatureNames()) + + resp := &serving.GetOnlineFeaturesResponse{ + Results: make([]*serving.GetOnlineFeaturesResponse_FeatureVector, 0), + Metadata: &serving.GetOnlineFeaturesResponseMetadata{ + FeatureNames: &serving.FeatureList{Val: make([]string, 0)}, + }, + } + for name, values := range request.Entities { + resp.Metadata.FeatureNames.Val = append(resp.Metadata.FeatureNames.Val, name) + + vec := &serving.GetOnlineFeaturesResponse_FeatureVector{ + Values: make([]*types.Value, 0), + Statuses: make([]serving.FieldStatus, 0), + EventTimestamps: make([]*timestamp.Timestamp, 0), + } + resp.Results = append(resp.Results, vec) + + for _, v := range values.Val { + vec.Values = append(vec.Values, v) + vec.Statuses = append(vec.Statuses, serving.FieldStatus_PRESENT) + vec.EventTimestamps = append(vec.EventTimestamps, ×tamp.Timestamp{}) + } + } + + for _, vector := range featureVectors { + resp.Metadata.FeatureNames.Val = append(resp.Metadata.FeatureNames.Val, vector.Name) + + values, err := utils.ArrowValuesToProtoValues(vector.Values) + if err != nil { + return nil, err + } + + resp.Results = append(resp.Results, &serving.GetOnlineFeaturesResponse_FeatureVector{ + Values: values, + Statuses: vector.Statuses, + EventTimestamps: vector.Timestamps, + }) + } + + return resp, nil } diff --git a/go/embedded/online_features.go b/go/embedded/online_features.go new file mode 100644 index 0000000000..04a6aec823 --- /dev/null +++ b/go/embedded/online_features.go @@ -0,0 +1,113 @@ +package embedded + +import ( + "context" + "github.com/apache/arrow/go/arrow" + "github.com/apache/arrow/go/arrow/array" + "github.com/apache/arrow/go/arrow/cdata" + "github.com/feast-dev/feast/go/internal/feast" + "github.com/feast-dev/feast/go/protos/feast/types" + "github.com/feast-dev/feast/go/utils" + "log" +) + +type OnlineFeatureService struct { + fs *feast.FeatureStore +} + +type OnlineFeatureServiceConfig struct { + RepoPath string + RepoConfig string +} + +type DataTable struct { + DataPtr uintptr + SchemaPtr uintptr +} + +func NewOnlineFeatureService(conf *OnlineFeatureServiceConfig) *OnlineFeatureService { + repoConfig, err := feast.NewRepoConfigFromJSON(conf.RepoPath, conf.RepoConfig) + if err != nil { + log.Fatalln(err) + } + + fs, err := feast.NewFeatureStore(repoConfig) + if err != nil { + log.Fatalln(err) + } + defer fs.DestructOnlineStore() + return &OnlineFeatureService{fs: fs} +} + +func (s *OnlineFeatureService) GetOnlineFeatures( + featureRefs []string, + featureServiceName string, + entities DataTable, + fullFeatureNames bool, + projectName string, + output DataTable) error { + + entitiesRecord, err := readArrowRecord(entities) + if err != nil { + return err + } + + numRows := entitiesRecord.Column(0).Len() + + entitiesProto, err := recordToProto(entitiesRecord) + if err != nil { + return err + } + + var featureService *feast.FeatureService + if featureServiceName != "" { + featureService, err = s.fs.GetFeatureService(featureServiceName, projectName) + } + + resp, err := s.fs.GetOnlineFeatures( + context.Background(), + featureRefs, + featureService, + entitiesProto, + fullFeatureNames) + + if err != nil { + return err + } + + outputFields := entitiesRecord.Schema().Fields() + outputColumns := entitiesRecord.Columns() + for _, featureVector := range resp { + outputFields = append(outputFields, + arrow.Field{Name: featureVector.Name, Type: featureVector.Values.DataType()}) + outputColumns = append(outputColumns, featureVector.Values) + } + + result := array.NewRecord(arrow.NewSchema(outputFields, nil), outputColumns, int64(numRows)) + + cdata.ExportArrowRecordBatch(result, + cdata.ArrayFromPtr(output.DataPtr), + cdata.SchemaFromPtr(output.SchemaPtr)) + + return nil +} + +func readArrowRecord(data DataTable) (array.Record, error) { + return cdata.ImportCRecordBatch( + cdata.ArrayFromPtr(data.DataPtr), + cdata.SchemaFromPtr(data.SchemaPtr)) +} + +func recordToProto(rec array.Record) (map[string]*types.RepeatedValue, error) { + r := make(map[string]*types.RepeatedValue) + schema := rec.Schema() + for idx, column := range rec.Columns() { + field := schema.Field(idx) + values, err := utils.ArrowValuesToProtoValues(column) + if err != nil { + return nil, err + } + r[field.Name] = &types.RepeatedValue{Val: values} + } + return r, nil +} diff --git a/go/internal/feast/featurestore.go b/go/internal/feast/featurestore.go index 11be8ee94c..3d8f34d702 100644 --- a/go/internal/feast/featurestore.go +++ b/go/internal/feast/featurestore.go @@ -2,13 +2,19 @@ package feast import ( "context" + "crypto/sha256" "errors" "fmt" "sort" "strings" + "github.com/apache/arrow/go/arrow" + "github.com/apache/arrow/go/arrow/array" + "github.com/apache/arrow/go/arrow/memory" "github.com/feast-dev/feast/go/protos/feast/serving" "github.com/feast-dev/feast/go/protos/feast/types" + "github.com/feast-dev/feast/go/utils" + "github.com/golang/protobuf/proto" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/durationpb" @@ -21,17 +27,24 @@ type FeatureStore struct { onlineStore OnlineStore } -type entityKeyRow struct { - entityKey *types.EntityKey - rowIndices []int -} - -// A Features struct specifies a list of features to be retrieved from the online store. These features +// A Features struct specifies a list of Features to be retrieved from the online store. These Features // can be specified either as a list of string feature references or as a feature service. String // feature references must have format "feature_view:feature", e.g. "customer_fv:daily_transactions". type Features struct { - features []string - featureService *FeatureService + Features []string + FeatureService *FeatureService +} + +type FeatureVector struct { + Name string + Values array.Interface + Statuses []serving.FieldStatus + Timestamps []*timestamppb.Timestamp +} + +type featuresAndView struct { + view *FeatureView + features []string } type GroupedFeaturesPerEntitySet struct { @@ -40,14 +53,11 @@ type GroupedFeaturesPerEntitySet struct { featureViewNames []string // A list of requested featureName if fullFeatureNames = False or a list of featureViewNameAlias__featureName that share this // entity set - featureResponseMeta []string + aliasedFeatureNames []string // Entity set as a list of EntityKeys to pass to OnlineRead entityKeys []*types.EntityKey - // Indices for each requested feature in a featureView to return to OnlineResponse that match with the corresponding row in entityKeys - // Dim(indices[i]) = number of requested rows + // Reversed mapping to project result of retrieval from storage to response indices [][]int - // Map from featureIndex to the set of indices it shares with other requested features in the same feature view / feature projection - indicesMapper map[int]int } // NewFeatureStore constructs a feature store fat client using the @@ -72,41 +82,43 @@ func NewFeatureStore(config *RepoConfig) (*FeatureStore, error) { } // TODO: Review all functions that use ODFV and Request FV since these have not been tested -func (fs *FeatureStore) GetOnlineFeatures(ctx context.Context, request *serving.GetOnlineFeaturesRequest) (*serving.GetOnlineFeaturesResponse, error) { - fullFeatureNames := request.GetFullFeatureNames() - features, err := fs.parseFeatures(request.GetKind()) - if err != nil { - return nil, err - } +func (fs *FeatureStore) GetOnlineFeatures( + ctx context.Context, + featureRefs []string, + featureService *FeatureService, + entityProtos map[string]*types.RepeatedValue, + fullFeatureNames bool) ([]*FeatureVector, error) { - featureRefs, err := fs.getFeatureRefs(features) - if err != nil { - return nil, err - } - entityProtos := request.GetEntities() numRows, err := fs.validateEntityValues(entityProtos) if err != nil { return nil, err } - err = fs.validateFeatureRefs(featureRefs, fullFeatureNames) + + var fvs map[string]*FeatureView + var requestedFeatureViews []*featuresAndView + var requestedRequestFeatureViews []*RequestFeatureView + var requestedOnDemandFeatureViews []*OnDemandFeatureView + if featureService != nil { + fvs, requestedFeatureViews, requestedRequestFeatureViews, requestedOnDemandFeatureViews, err = + fs.getFeatureViewsToUseByService(featureService, false) + } else { + fvs, requestedFeatureViews, requestedRequestFeatureViews, requestedOnDemandFeatureViews, err = + fs.getFeatureViewsToUseByFeatureRefs(featureRefs, false) + } + + err = validateFeatureRefs(requestedFeatureViews, fullFeatureNames) if err != nil { return nil, err } - fvs, requestedFeatureViews, requestedRequestFeatureViews, requestedOnDemandFeatureViews, err := fs.getFeatureViewsToUse(features, false) - if len(requestedRequestFeatureViews)+len(requestedOnDemandFeatureViews) > 0 { return nil, status.Errorf(codes.InvalidArgument, "on demand feature views are currently not supported") } + entityNameToJoinKeyMap, expectedJoinKeysSet, err := fs.getEntityMaps(requestedFeatureViews) if err != nil { return nil, err } - entityNameToJoinKeyMap, err := fs.getEntityMaps(requestedFeatureViews) - if err != nil { - return nil, err - } - // TODO (Ly): This should return empty now // Expect no ODFV or Request FV passed in GetOnlineFearuresRequest neededRequestData, neededRequestODFVFeatures, err := fs.getNeededRequestData(requestedRequestFeatureViews, requestedOnDemandFeatureViews) @@ -118,18 +130,18 @@ func (fs *FeatureStore) GetOnlineFeatures(ctx context.Context, request *serving. // to use for ODFV // Remove comments for requestDataFeatures when ODFV is supported // requestDataFeatures := make(map[string]*types.RepeatedValue) // TODO (Ly): Should be empty now until ODFV and Request FV are supported - responseEntities := make(map[string]*types.RepeatedValue) - for entityName, vals := range entityProtos { - if _, ok := neededRequestODFVFeatures[entityName]; ok { - responseEntities[entityName] = vals - // requestDataFeatures[entityName] = vals - } else if _, ok = neededRequestData[entityName]; ok { - // requestDataFeatures[entityName] = vals + mappedEntityProtos := make(map[string]*types.RepeatedValue) + for joinKeyOrFeature, vals := range entityProtos { + if _, ok := neededRequestODFVFeatures[joinKeyOrFeature]; ok { + mappedEntityProtos[joinKeyOrFeature] = vals + // requestDataFeatures[joinKeyOrFeature] = vals + } else if _, ok = neededRequestData[joinKeyOrFeature]; ok { + // requestDataFeatures[joinKeyOrFeature] = vals } else { - if joinKey, ok := entityNameToJoinKeyMap[entityName]; !ok { - return nil, fmt.Errorf("entityNotFoundException: %s\n%v", entityName, entityNameToJoinKeyMap) + if _, ok := expectedJoinKeysSet[joinKeyOrFeature]; !ok { + return nil, fmt.Errorf("JoinKey is not expected in this request: %s\n%v", joinKeyOrFeature, expectedJoinKeysSet) } else { - responseEntities[joinKey] = vals + mappedEntityProtos[joinKeyOrFeature] = vals } } } @@ -141,29 +153,12 @@ func (fs *FeatureStore) GetOnlineFeatures(ctx context.Context, request *serving. // return nil, err // } - numOfReturnedFeatures := len(responseEntities) + len(featureRefs) - onlineFeatureResponse := &serving.GetOnlineFeaturesResponse{Metadata: &serving.GetOnlineFeaturesResponseMetadata{ - FeatureNames: &serving.FeatureList{Val: make([]string, numOfReturnedFeatures)}, - }, - Results: make([]*serving.GetOnlineFeaturesResponse_FeatureVector, numRows), - } - - // Allocate memory for each GetOnlineFeaturesResponse_FeatureVector - for index := 0; index < numRows; index++ { - onlineFeatureResponse.Results[index] = &serving.GetOnlineFeaturesResponse_FeatureVector{Values: make([]*types.Value, numOfReturnedFeatures), - Statuses: make([]serving.FieldStatus, numOfReturnedFeatures), - EventTimestamps: make([]*timestamppb.Timestamp, numOfReturnedFeatures), - } - } - // Add provided entities + ODFV schema entities to response - fs.populateResponseEntities(onlineFeatureResponse, responseEntities) - offset := len(responseEntities) featureViews := make([]*FeatureView, len(requestedFeatureViews)) index := 0 - for featureView := range requestedFeatureViews { - featureViews[index] = featureView + for _, featuresAndView := range requestedFeatureViews { + featureViews[index] = featuresAndView.view index += 1 } @@ -181,57 +176,62 @@ func (fs *FeatureStore) GetOnlineFeatures(ctx context.Context, request *serving. for index := 0; index < numRows; index++ { dummyEntityColumn.Val[index] = &DUMMY_ENTITY } - responseEntities[DUMMY_ENTITY_ID] = dummyEntityColumn + mappedEntityProtos[DUMMY_ENTITY_ID] = dummyEntityColumn } - groupedRefs, err := fs.groupFeatureRefs(requestedFeatureViews, responseEntities, entityNameToJoinKeyMap, fullFeatureNames) + groupedRefs, err := groupFeatureRefs(requestedFeatureViews, mappedEntityProtos, entityNameToJoinKeyMap, fullFeatureNames) if err != nil { return nil, err } - + result := make([]*FeatureVector, 0) + arrowMemory := memory.NewGoAllocator() for _, groupRef := range groupedRefs { featureData, err := fs.readFromOnlineStore(ctx, groupRef.entityKeys, groupRef.featureViewNames, groupRef.featureNames) if err != nil { return nil, err } - fs.populateResponseFromFeatureData(featureData, + + vectors, err := fs.transposeResponseIntoColumns(featureData, groupRef, - onlineFeatureResponse, fvs, - offset, + arrowMemory, + numRows, ) - offset += len(groupRef.featureNames) + if err != nil { + return nil, err + } + result = append(result, vectors...) } // TODO (Ly): ODFV, skip augmentResponseWithOnDemandTransforms - return onlineFeatureResponse, nil + return result, nil } func (fs *FeatureStore) DestructOnlineStore() { fs.onlineStore.Destruct() } -// parseFeatures parses the kind field of a GetOnlineFeaturesRequest protobuf message +// ParseFeatures parses the kind field of a GetOnlineFeaturesRequest protobuf message // and populates a Features struct with the result. -func (fs *FeatureStore) parseFeatures(kind interface{}) (*Features, error) { +func (fs *FeatureStore) ParseFeatures(kind interface{}) (*Features, error) { if featureList, ok := kind.(*serving.GetOnlineFeaturesRequest_Features); ok { - return &Features{features: featureList.Features.GetVal(), featureService: nil}, nil + return &Features{Features: featureList.Features.GetVal(), FeatureService: nil}, nil } if featureServiceRequest, ok := kind.(*serving.GetOnlineFeaturesRequest_FeatureService); ok { featureService, err := fs.registry.getFeatureService(fs.config.Project, featureServiceRequest.FeatureService) if err != nil { return nil, err } - return &Features{features: nil, featureService: featureService}, nil + return &Features{Features: nil, FeatureService: featureService}, nil } return nil, errors.New("cannot parse kind from GetOnlineFeaturesRequest") } // getFeatureRefs extracts a list of feature references from a Features struct. func (fs *FeatureStore) getFeatureRefs(features *Features) ([]string, error) { - if features.featureService != nil { + if features.FeatureService != nil { var featureViewName string featureRefs := make([]string, 0) - for _, featureProjection := range features.featureService.projections { + for _, featureProjection := range features.FeatureService.projections { featureViewName = featureProjection.nameToUse() for _, feature := range featureProjection.features { featureRefs = append(featureRefs, fmt.Sprintf("%s:%s", featureViewName, feature.name)) @@ -239,14 +239,27 @@ func (fs *FeatureStore) getFeatureRefs(features *Features) ([]string, error) { } return featureRefs, nil } else { - return features.features, nil + return features.Features, nil } } +func (fs *FeatureStore) ExtractFeatureRefs(kind interface{}, fullFeatureNames bool) ([]string, error) { + features, err := fs.ParseFeatures(kind) + if err != nil { + return nil, err + } + + featureRefs, err := fs.getFeatureRefs(features) + + return featureRefs, nil +} + +func (fs *FeatureStore) GetFeatureService(name string, project string) (*FeatureService, error) { + return fs.registry.getFeatureService(project, name) +} + /* - If features passed into GetOnlineFeaturesRequest as a list of feature references, - return all FeatureView, OnDemandFeatureView, RequestFeatureView from the registry - Otherwise, a FeatureService was passed, return a list of copies of FeatureViewProjection + Return a list of copies of FeatureViewProjection copied from FeatureView, OnDemandFeatureView, RequestFeatureView existed in the registry TODO (Ly): Since the implementation of registry has changed, a better approach here is just @@ -254,7 +267,7 @@ func (fs *FeatureStore) getFeatureRefs(features *Features) ([]string, error) { retrieving all feature views. Similar argument to FeatureService applies. */ -func (fs *FeatureStore) getFeatureViewsToUse(features *Features, hideDummyEntity bool) (map[string]*FeatureView, map[*FeatureView][]string, []*RequestFeatureView, []*OnDemandFeatureView, error) { +func (fs *FeatureStore) getFeatureViewsToUseByService(featureService *FeatureService, hideDummyEntity bool) (map[string]*FeatureView, []*featuresAndView, []*RequestFeatureView, []*OnDemandFeatureView, error) { fvs := make(map[string]*FeatureView) requestFvs := make(map[string]*RequestFeatureView) odFvs := make(map[string]*OnDemandFeatureView) @@ -283,59 +296,104 @@ func (fs *FeatureStore) getFeatureViewsToUse(features *Features, hideDummyEntity odFvs[onDemandFeatureView.base.name] = onDemandFeatureView } - if features.featureService != nil { - featureService := features.featureService - - fvsToUse := make(map[*FeatureView][]string) - requestFvsToUse := make([]*RequestFeatureView, 0) - odFvsToUse := make([]*OnDemandFeatureView, 0) + fvsToUse := make([]*featuresAndView, 0) + requestFvsToUse := make([]*RequestFeatureView, 0) + odFvsToUse := make([]*OnDemandFeatureView, 0) - for _, featureProjection := range featureService.projections { - // Create copies of FeatureView that may contains the same *FeatureView but - // each differentiated by a *FeatureViewProjection - featureViewName := featureProjection.name - if fv, ok := fvs[featureViewName]; ok { - base, err := fv.base.withProjection(featureProjection) - if err != nil { - return nil, nil, nil, nil, err - } - newFv := fv.NewFeatureViewFromBase(base) - fvsToUse[newFv] = make([]string, len(newFv.base.features)) - for index, feature := range newFv.base.features { - fvsToUse[newFv][index] = feature.name - } - } else if requestFv, ok := requestFvs[featureViewName]; ok { - base, err := requestFv.base.withProjection(featureProjection) - if err != nil { - return nil, nil, nil, nil, err - } - requestFvsToUse = append(requestFvsToUse, requestFv.NewRequestFeatureViewFromBase(base)) - } else if odFv, ok := odFvs[featureViewName]; ok { - base, err := odFv.base.withProjection(featureProjection) - if err != nil { - return nil, nil, nil, nil, err - } - odFvsToUse = append(odFvsToUse, odFv.NewOnDemandFeatureViewFromBase(base)) - } else { - return nil, nil, nil, nil, fmt.Errorf("the provided feature service %s contains a reference to a feature view"+ - "%s which doesn't exist, please make sure that you have created the feature view"+ - "%s and that you have registered it by running \"apply\"", featureService.name, featureViewName, featureViewName) + for _, featureProjection := range featureService.projections { + // Create copies of FeatureView that may contains the same *FeatureView but + // each differentiated by a *FeatureViewProjection + featureViewName := featureProjection.name + if fv, ok := fvs[featureViewName]; ok { + base, err := fv.base.withProjection(featureProjection) + if err != nil { + return nil, nil, nil, nil, err + } + newFv := fv.NewFeatureViewFromBase(base) + features := make([]string, len(newFv.base.features)) + for index, feature := range newFv.base.features { + features[index] = feature.name + } + fvsToUse = append(fvsToUse, &featuresAndView{ + view: newFv, + features: features, + }) + } else if requestFv, ok := requestFvs[featureViewName]; ok { + base, err := requestFv.base.withProjection(featureProjection) + if err != nil { + return nil, nil, nil, nil, err } + requestFvsToUse = append(requestFvsToUse, requestFv.NewRequestFeatureViewFromBase(base)) + } else if odFv, ok := odFvs[featureViewName]; ok { + base, err := odFv.base.withProjection(featureProjection) + if err != nil { + return nil, nil, nil, nil, err + } + odFvsToUse = append(odFvsToUse, odFv.NewOnDemandFeatureViewFromBase(base)) + } else { + return nil, nil, nil, nil, fmt.Errorf("the provided feature service %s contains a reference to a feature view"+ + "%s which doesn't exist, please make sure that you have created the feature view"+ + "%s and that you have registered it by running \"apply\"", featureService.name, featureViewName, featureViewName) } - return fvs, fvsToUse, requestFvsToUse, odFvsToUse, nil + } + return fvs, fvsToUse, requestFvsToUse, odFvsToUse, nil +} + +/* + Return all FeatureView, OnDemandFeatureView, RequestFeatureView from the registry +*/ +func (fs *FeatureStore) getFeatureViewsToUseByFeatureRefs(features []string, hideDummyEntity bool) (map[string]*FeatureView, []*featuresAndView, []*RequestFeatureView, []*OnDemandFeatureView, error) { + fvs := make(map[string]*FeatureView) + requestFvs := make(map[string]*RequestFeatureView) + odFvs := make(map[string]*OnDemandFeatureView) + + featureViews, err := fs.listFeatureViews(hideDummyEntity) + if err != nil { + return nil, nil, nil, nil, err + } + for _, featureView := range featureViews { + fvs[featureView.base.name] = featureView } - fvsToUse := make(map[*FeatureView][]string) + requestFeatureViews, err := fs.registry.listRequestFeatureViews(fs.config.Project) + if err != nil { + return nil, nil, nil, nil, err + } + for _, requestFeatureView := range requestFeatureViews { + requestFvs[requestFeatureView.base.name] = requestFeatureView + } + + onDemandFeatureViews, err := fs.registry.listOnDemandFeatureViews(fs.config.Project) + if err != nil { + return nil, nil, nil, nil, err + } + for _, onDemandFeatureView := range onDemandFeatureViews { + odFvs[onDemandFeatureView.base.name] = onDemandFeatureView + } + + fvsToUse := make([]*featuresAndView, 0) requestFvsToUse := make([]*RequestFeatureView, 0) odFvsToUse := make([]*OnDemandFeatureView, 0) - for _, featureRef := range features.features { + for _, featureRef := range features { featureViewName, featureName, err := parseFeatureReference(featureRef) if err != nil { return nil, nil, nil, nil, err } if fv, ok := fvs[featureViewName]; ok { - fvsToUse[fv] = append(fvsToUse[fv], featureName) + found := false + for _, group := range fvsToUse { + if group.view == fv { + group.features = append(group.features, featureName) + found = true + } + } + if !found { + fvsToUse = append(fvsToUse, &featuresAndView{ + view: fv, + features: []string{featureName}, + }) + } } else if requestFv, ok := requestFvs[featureViewName]; ok { requestFvsToUse = append(requestFvsToUse, requestFv) } else if odFv, ok := odFvs[featureViewName]; ok { @@ -349,50 +407,41 @@ func (fs *FeatureStore) getFeatureViewsToUse(features *Features, hideDummyEntity return fvs, fvsToUse, requestFvsToUse, odFvsToUse, nil } -func (fs *FeatureStore) getEntityMaps(requestedFeatureViews map[*FeatureView][]string) (map[string]string, error) { - +func (fs *FeatureStore) getEntityMaps(requestedFeatureViews []*featuresAndView) (map[string]string, map[string]interface{}, error) { entityNameToJoinKeyMap := make(map[string]string) - var entityNames map[string]struct{} - var entityName string - var joinKeyMap map[string]string - var featureView *FeatureView + expectedJoinKeysSet := make(map[string]interface{}) entities, err := fs.listEntities(false) if err != nil { - return nil, err + return nil, nil, err } + entitiesByName := make(map[string]*Entity) for _, entity := range entities { - entityNameToJoinKeyMap[entity.name] = entity.joinKey + entitiesByName[entity.name] = entity } - for featureView = range requestedFeatureViews { - - entityNames = featureView.entities - joinKeyMap = featureView.base.projection.joinKeyMap - for entityName = range entityNames { + for _, featuresAndView := range requestedFeatureViews { + featureView := featuresAndView.view + var joinKeyToAliasMap map[string]string + if featureView.base.projection != nil && featureView.base.projection.joinKeyMap != nil { + joinKeyToAliasMap = featureView.base.projection.joinKeyMap + } else { + joinKeyToAliasMap = map[string]string{} + } - entity, err := fs.registry.getEntity(fs.config.Project, entityName) - if err != nil { - return nil, err - } - entityName := entity.name - joinKey := entity.joinKey + for entityName := range featureView.entities { + joinKey := entitiesByName[entityName].joinKey + entityNameToJoinKeyMap[entityName] = joinKey - // TODO (Ly): Review: weird that both uses the same map? - // from python's sdk - if entityNameMapped, ok := joinKeyMap[joinKey]; ok { - entityName = entityNameMapped - } - if joinKeyMapped, ok := joinKeyMap[joinKey]; ok { - joinKey = joinKeyMapped + if alias, ok := joinKeyToAliasMap[joinKey]; ok { + expectedJoinKeysSet[alias] = nil + } else { + expectedJoinKeysSet[joinKey] = nil } - entityNameToJoinKeyMap[entityName] = joinKey - // TODO (Ly): Review: Can we skip entity_type_map - // in go's version? } } - return entityNameToJoinKeyMap, nil + return entityNameToJoinKeyMap, expectedJoinKeysSet, nil } func (fs *FeatureStore) validateEntityValues(joinKeyValues map[string]*types.RepeatedValue) (int, error) { @@ -408,54 +457,52 @@ func (fs *FeatureStore) validateEntityValues(joinKeyValues map[string]*types.Rep return numRows, nil } -func (fs *FeatureStore) validateFeatureRefs(featureRefs []string, fullFeatureNames bool) error { +func validateFeatureRefs(requestedFeatures []*featuresAndView, fullFeatureNames bool) error { featureRefCounter := make(map[string]int) - if fullFeatureNames { - for _, featureRef := range featureRefs { - featureRefCounter[featureRef]++ - } - for featureName, occurrences := range featureRefCounter { - if occurrences == 1 { - delete(featureRefCounter, featureName) - } - } - if len(featureRefCounter) >= 1 { - collidedFeatureRefs := make([]string, len(featureRefCounter)) - index := 0 - for collidedFeatureRef := range featureRefCounter { - collidedFeatureRefs[index] = collidedFeatureRef - index++ + featureRefs := make([]string, 0) + for _, viewAndFeatures := range requestedFeatures { + for _, feature := range viewAndFeatures.features { + projectedViewName := viewAndFeatures.view.base.name + if viewAndFeatures.view.base.projection != nil { + projectedViewName = viewAndFeatures.view.base.projection.nameToUse() } - return featureNameCollisionError{collidedFeatureRefs, fullFeatureNames} + + featureRefs = append(featureRefs, + fmt.Sprintf("%s:%s", projectedViewName, feature)) } - } else { - for _, featureRef := range featureRefs { - _, featureName, err := parseFeatureReference(featureRef) - if err != nil { - return err - } + } + + for _, featureRef := range featureRefs { + if fullFeatureNames { + featureRefCounter[featureRef]++ + } else { + _, featureName, _ := parseFeatureReference(featureRef) featureRefCounter[featureName]++ } - for featureName, occurrences := range featureRefCounter { - if occurrences == 1 { - delete(featureRefCounter, featureName) - } + + } + for featureName, occurrences := range featureRefCounter { + if occurrences == 1 { + delete(featureRefCounter, featureName) } - if len(featureRefCounter) >= 1 { - collidedFeatureRefs := make([]string, 0) - for _, featureRef := range featureRefs { - _, featureName, err := parseFeatureReference(featureRef) - if err != nil { - return err - } - if _, ok := featureRefCounter[featureName]; ok { - collidedFeatureRefs = append(collidedFeatureRefs, featureRef) + } + if len(featureRefCounter) >= 1 { + collidedFeatureRefs := make([]string, 0) + for collidedFeatureRef := range featureRefCounter { + if fullFeatureNames { + collidedFeatureRefs = append(collidedFeatureRefs, collidedFeatureRef) + } else { + for _, featureRef := range featureRefs { + _, featureName, _ := parseFeatureReference(featureRef) + if featureName == collidedFeatureRef { + collidedFeatureRefs = append(collidedFeatureRefs, featureRef) + } } - } - return featureNameCollisionError{collidedFeatureRefs, fullFeatureNames} } + return featureNameCollisionError{collidedFeatureRefs, fullFeatureNames} } + return nil } @@ -507,24 +554,6 @@ func (fs *FeatureStore) checkOutsideTtl(featureTimestamp *timestamppb.Timestamp, return currentTimestamp.GetSeconds()-featureTimestamp.GetSeconds() > ttl.Seconds } -func (fs *FeatureStore) populateResponseEntities(response *serving.GetOnlineFeaturesResponse, responseEntities map[string]*types.RepeatedValue) { - timeStamp := timestamppb.Now() - featureIndex := 0 - for entityName, values := range responseEntities { - response.Metadata.FeatureNames.Val[featureIndex] = entityName - - for rowIndex, value := range values.GetVal() { - featureVector := response.Results[rowIndex] - featureTimeStamp := timestamppb.Timestamp{Seconds: timeStamp.Seconds, Nanos: timeStamp.Nanos} - featureValue := types.Value{Val: value.Val} - featureVector.Values[featureIndex] = &featureValue - featureVector.Statuses[featureIndex] = serving.FieldStatus_PRESENT - featureVector.EventTimestamps[featureIndex] = &featureTimeStamp - } - featureIndex += 1 - } -} - func (fs *FeatureStore) readFromOnlineStore(ctx context.Context, entityRows []*types.EntityKey, requestedFeatureViewNames []string, requestedFeatureNames []string, @@ -537,13 +566,13 @@ func (fs *FeatureStore) readFromOnlineStore(ctx context.Context, entityRows []*t return fs.onlineStore.OnlineRead(ctx, entityRowsValue, requestedFeatureViewNames, requestedFeatureNames) } -func (fs *FeatureStore) populateResponseFromFeatureData(featureData2D [][]FeatureData, +func (fs *FeatureStore) transposeResponseIntoColumns(featureData2D [][]FeatureData, groupRef *GroupedFeaturesPerEntitySet, - onlineFeaturesResponse *serving.GetOnlineFeaturesResponse, fvs map[string]*FeatureView, - offset int) { + arrowAllocator memory.Allocator, + numRows int) ([]*FeatureVector, error) { - numFeatures := len(groupRef.featureResponseMeta) + numFeatures := len(groupRef.aliasedFeatureNames) var value *types.Value var status serving.FieldStatus @@ -551,12 +580,19 @@ func (fs *FeatureStore) populateResponseFromFeatureData(featureData2D [][]Featur var featureData *FeatureData var fv *FeatureView var featureViewName string - var indicesToUse []int + + vectors := make([]*FeatureVector, 0) for featureIndex := 0; featureIndex < numFeatures; featureIndex++ { - indicesToUse = groupRef.indices[groupRef.indicesMapper[featureIndex]] - onlineFeaturesResponse.Metadata.FeatureNames.Val[offset+featureIndex] = groupRef.featureResponseMeta[featureIndex] - for rowIndex, rowEntityIndex := range indicesToUse { + currentVector := &FeatureVector{ + Name: groupRef.aliasedFeatureNames[featureIndex], + Statuses: make([]serving.FieldStatus, numRows), + Timestamps: make([]*timestamppb.Timestamp, numRows), + } + vectors = append(vectors, currentVector) + protoValues := make([]*types.Value, numRows) + + for rowEntityIndex, outputIndexes := range groupRef.indices { if featureData2D[rowEntityIndex] == nil { value = nil status = serving.FieldStatus_NOT_FOUND @@ -577,12 +613,40 @@ func (fs *FeatureStore) populateResponseFromFeatureData(featureData2D [][]Featur status = serving.FieldStatus_PRESENT } } - onlineFeaturesResponse.Results[rowIndex].Values[offset+featureIndex] = value - onlineFeaturesResponse.Results[rowIndex].Statuses[offset+featureIndex] = status - onlineFeaturesResponse.Results[rowIndex].EventTimestamps[offset+featureIndex] = eventTimeStamp + for _, rowIndex := range outputIndexes { + protoValues[rowIndex] = value + currentVector.Statuses[rowIndex] = status + currentVector.Timestamps[rowIndex] = eventTimeStamp + } + } + var fieldType arrow.DataType + var err error + + for _, val := range protoValues { + if val != nil { + fieldType, err = utils.ProtoTypeToArrowType(val) + if err != nil { + return nil, err + } + break + } + } + + if fieldType != nil { + builder := array.NewBuilder(arrowAllocator, fieldType) + err = utils.ProtoValuesToArrowArray(builder, protoValues) + if err != nil { + return nil, err + } + + currentVector.Values = builder.NewArray() + } else { + currentVector.Values = array.NewNull(numRows) } } + return vectors, nil + } // TODO (Ly): Complete this function + ODFV @@ -616,39 +680,6 @@ func (fs *FeatureStore) augmentResponseWithOnDemandTransforms(onlineFeaturesResp } } -func (fs *FeatureStore) dropUnneededColumns(onlineFeaturesResponse *serving.GetOnlineFeaturesResponse, - requestedResultRowNames map[string]struct{}) { - metaDataLen := len(onlineFeaturesResponse.Metadata.FeatureNames.Val) - neededMask := make([]bool, metaDataLen) - for index, featureName := range onlineFeaturesResponse.Metadata.FeatureNames.Val { - - if _, ok := requestedResultRowNames[featureName]; !ok { - neededMask[index] = false - } else { - neededMask[index] = true - } - } - firstIndex := 0 - for index := 0; index < metaDataLen; index++ { - if neededMask[index] { - for rowIndex := 0; rowIndex < len(onlineFeaturesResponse.Results); rowIndex++ { - onlineFeaturesResponse.Results[rowIndex].Values[firstIndex] = onlineFeaturesResponse.Results[rowIndex].Values[index] - onlineFeaturesResponse.Results[rowIndex].Statuses[firstIndex] = onlineFeaturesResponse.Results[rowIndex].Statuses[index] - onlineFeaturesResponse.Results[rowIndex].EventTimestamps[firstIndex] = onlineFeaturesResponse.Results[rowIndex].EventTimestamps[index] - onlineFeaturesResponse.Metadata.FeatureNames.Val[firstIndex] = onlineFeaturesResponse.Metadata.FeatureNames.Val[index] - - } - firstIndex += 1 - } - } - for rowIndex := 0; rowIndex < len(onlineFeaturesResponse.Results); rowIndex++ { - onlineFeaturesResponse.Results[rowIndex].Values = onlineFeaturesResponse.Results[rowIndex].Values[:firstIndex] - onlineFeaturesResponse.Results[rowIndex].Statuses = onlineFeaturesResponse.Results[rowIndex].Statuses[:firstIndex] - onlineFeaturesResponse.Results[rowIndex].EventTimestamps = onlineFeaturesResponse.Results[rowIndex].EventTimestamps[:firstIndex] - onlineFeaturesResponse.Metadata.FeatureNames.Val = onlineFeaturesResponse.Metadata.FeatureNames.Val[:firstIndex] - } -} - func (fs *FeatureStore) listFeatureViews(hideDummyEntity bool) ([]*FeatureView, error) { featureViews, err := fs.registry.listFeatureViews(fs.config.Project) if err != nil { @@ -676,65 +707,11 @@ func (fs *FeatureStore) listEntities(hideDummyEntity bool) ([]*Entity, error) { return entities, nil } -func (fs *FeatureStore) getFvEntityValues(fv *FeatureView, - joinKeyValues map[string]*types.RepeatedValue, - entityNameToJoinKeyMap map[string]string) map[string]*types.RepeatedValue { - - fvJoinKeys := make(map[string]struct{}) - for entityName := range fv.entities { - fvJoinKeys[entityNameToJoinKeyMap[entityName]] = struct{}{} - } - - aliasToJoinKeyMap := make(map[string]string) - for k, v := range fv.base.projection.joinKeyMap { - aliasToJoinKeyMap[v] = k - } - - entityValues := make(map[string]*types.RepeatedValue) - - for k, v := range joinKeyValues { - entityKey := k - if _, ok := aliasToJoinKeyMap[k]; ok { - entityKey = aliasToJoinKeyMap[k] - } - if _, ok := fvJoinKeys[entityKey]; ok { - entityValues[entityKey] = v - } - } - - return entityValues -} - -/* entityValues are rows of the same feature view */ - -func serializeEntityKeySet(entityValues []*types.EntityKey) string { - if len(entityValues) == 0 { - return "" - } - joinKeys := make([]string, len(entityValues[0].JoinKeys)) - for _, entityKey := range entityValues { - for index, joinKey := range entityKey.JoinKeys { - joinKeys[index] = joinKey - } - break - } - byteEntitySet := []byte{} - sort.Strings(joinKeys) - for _, key := range joinKeys { - byteEntitySet = append(byteEntitySet, []byte(key)...) - byteEntitySet = append(byteEntitySet, byte(0)) - } - return string(byteEntitySet) -} - -func (fs *FeatureStore) getEntityKeysFromFeatureView(fv *FeatureView, - joinKeyValues map[string]*types.RepeatedValue, - entityNameToJoinKeyMap map[string]string) []*types.EntityKey { - fvEntityValues := fs.getFvEntityValues(fv, joinKeyValues, entityNameToJoinKeyMap) - keys := make([]string, len(fvEntityValues)) +func entityKeysToProtos(joinKeyValues map[string]*types.RepeatedValue) []*types.EntityKey { + keys := make([]string, len(joinKeyValues)) index := 0 var numRows int - for k, v := range fvEntityValues { + for k, v := range joinKeyValues { keys[index] = k index += 1 numRows = len(v.Val) @@ -748,94 +725,130 @@ func (fs *FeatureStore) getEntityKeysFromFeatureView(fv *FeatureView, } for colIndex, key := range keys { - for index, value := range fvEntityValues[key].GetVal() { + for index, value := range joinKeyValues[key].GetVal() { entityKeys[index].EntityValues[colIndex] = value } } return entityKeys } -func (fs *FeatureStore) getUniqueEntities(entityKeys []*types.EntityKey, -) ([]*types.EntityKey, [][]int, error) { - - rowise := make(map[string]*entityKeyRow) - // start here - for index, entityKey := range entityKeys { - key, err := serializeEntityKey(entityKey) - if err != nil { - return nil, nil, err - } - keyStr := string(*key) - if ekRow, ok := rowise[keyStr]; ok { - ekRow.rowIndices = append(ekRow.rowIndices, index) - } else { - ekRow = &entityKeyRow{entityKey: entityKeys[index], rowIndices: make([]int, 1)} - rowise[keyStr] = ekRow - ekRow.rowIndices[0] = index - } - } - numUniqueRows := len(rowise) - uniqueEntityKeys := make([]*types.EntityKey, numUniqueRows) - indices := make([][]int, numUniqueRows) - index := 0 - for _, ekRow := range rowise { - uniqueEntityKeys[index] = ekRow.entityKey - indices[index] = ekRow.rowIndices - index += 1 - } - return uniqueEntityKeys, indices, nil -} - /* Group feature views that share the same set of join keys. For each group, we store only unique rows and save indices to retrieve those rows for each requested feature */ -func (fs *FeatureStore) groupFeatureRefs(requestedFeatureViews map[*FeatureView][]string, +func groupFeatureRefs(requestedFeatureViews []*featuresAndView, joinKeyValues map[string]*types.RepeatedValue, entityNameToJoinKeyMap map[string]string, fullFeatureNames bool, ) (map[string]*GroupedFeaturesPerEntitySet, error, ) { - fvFeatures := make(map[string]*GroupedFeaturesPerEntitySet) - uniqueRowsPerEntitySet := make(map[string]map[string]int) - var featureIndex int - for fv, featureNames := range requestedFeatureViews { - entityKeys := fs.getEntityKeysFromFeatureView(fv, joinKeyValues, entityNameToJoinKeyMap) - indices := make([]int, len(entityKeys)) - entityKeySet := serializeEntityKeySet(entityKeys) - if _, ok := uniqueRowsPerEntitySet[entityKeySet]; !ok { - uniqueRowsPerEntitySet[entityKeySet] = make(map[string]int) - } - if _, ok := fvFeatures[entityKeySet]; !ok { - // Feature names should be unique per feature view to pass validateFeatureRefs - fvFeatures[entityKeySet] = &GroupedFeaturesPerEntitySet{indicesMapper: make(map[int]int)} - } - for index, entityKey := range entityKeys { - serializedRow, err := serializeEntityKey(entityKey) + groups := make(map[string]*GroupedFeaturesPerEntitySet) + + for _, featuresAndView := range requestedFeatureViews { + joinKeys := make([]string, 0) + fv := featuresAndView.view + featureNames := featuresAndView.features + for entity, _ := range fv.entities { + joinKeys = append(joinKeys, entityNameToJoinKeyMap[entity]) + } + + groupKeyBuilder := make([]string, 0) + joinKeysValuesProjection := make(map[string]*types.RepeatedValue) + + joinKeyToAliasMap := make(map[string]string) + if fv.base.projection != nil && fv.base.projection.joinKeyMap != nil { + joinKeyToAliasMap = fv.base.projection.joinKeyMap + } + + for _, joinKey := range joinKeys { + var joinKeyOrAlias string + + if alias, ok := joinKeyToAliasMap[joinKey]; ok { + groupKeyBuilder = append(groupKeyBuilder, fmt.Sprintf("%s[%s]", joinKey, alias)) + joinKeyOrAlias = alias + } else { + groupKeyBuilder = append(groupKeyBuilder, joinKey) + joinKeyOrAlias = joinKey + } + + if _, ok := joinKeyValues[joinKeyOrAlias]; !ok { + return nil, fmt.Errorf("key %s is missing in provided entity rows", joinKey) + } + joinKeysValuesProjection[joinKey] = joinKeyValues[joinKeyOrAlias] + } + + sort.Strings(groupKeyBuilder) + groupKey := strings.Join(groupKeyBuilder, ",") + + aliasedFeatureNames := make([]string, 0) + featureViewNames := make([]string, 0) + var viewNameToUse string + if fv.base.projection != nil { + viewNameToUse = fv.base.projection.nameToUse() + } else { + viewNameToUse = fv.base.name + } + + for _, featureName := range featureNames { + aliasedFeatureNames = append(aliasedFeatureNames, + getFeatureResponseMeta(viewNameToUse, featureName, fullFeatureNames)) + featureViewNames = append(featureViewNames, fv.base.name) + } + + if _, ok := groups[groupKey]; !ok { + joinKeysProto := entityKeysToProtos(joinKeysValuesProjection) + uniqueEntityRows, mappingIndices, err := getUniqueEntityRows(joinKeysProto) if err != nil { return nil, err } - rowKey := string(*serializedRow) - if _, ok := uniqueRowsPerEntitySet[entityKeySet][rowKey]; !ok { - uniqueRowsPerEntitySet[entityKeySet][rowKey] = len(uniqueRowsPerEntitySet[entityKeySet]) - fvFeatures[entityKeySet].entityKeys = append(fvFeatures[entityKeySet].entityKeys, entityKey) + + groups[groupKey] = &GroupedFeaturesPerEntitySet{ + featureNames: featureNames, + featureViewNames: featureViewNames, + aliasedFeatureNames: aliasedFeatureNames, + indices: mappingIndices, + entityKeys: uniqueEntityRows, } - indices[index] = uniqueRowsPerEntitySet[entityKeySet][rowKey] + + } else { + groups[groupKey].featureNames = append(groups[groupKey].featureNames, featureNames...) + groups[groupKey].aliasedFeatureNames = append(groups[groupKey].aliasedFeatureNames, aliasedFeatureNames...) + groups[groupKey].featureViewNames = append(groups[groupKey].featureViewNames, featureViewNames...) } + } + return groups, nil +} - for _, featureName := range featureNames { - featureIndex = len(fvFeatures[entityKeySet].featureNames) - fvFeatures[entityKeySet].featureNames = append(fvFeatures[entityKeySet].featureNames, featureName) - fvFeatures[entityKeySet].featureViewNames = append(fvFeatures[entityKeySet].featureViewNames, fv.base.name) - fvFeatures[entityKeySet].featureResponseMeta = append(fvFeatures[entityKeySet].featureResponseMeta, - getFeatureResponseMeta(fv.base.projection.nameToUse(), featureName, fullFeatureNames)) - fvFeatures[entityKeySet].indicesMapper[featureIndex] = len(fvFeatures[entityKeySet].indices) +func getUniqueEntityRows(joinKeysProto []*types.EntityKey) ([]*types.EntityKey, [][]int, error) { + uniqueValues := make(map[[sha256.Size]byte]*types.EntityKey, 0) + positions := make(map[[sha256.Size]byte][]int, 0) + + for index, entityKey := range joinKeysProto { + serializedRow, err := proto.Marshal(entityKey) + if err != nil { + return nil, nil, err + } + + rowHash := sha256.Sum256(serializedRow) + if _, ok := uniqueValues[rowHash]; !ok { + uniqueValues[rowHash] = entityKey + positions[rowHash] = []int{index} + } else { + positions[rowHash] = append(positions[rowHash], index) } - fvFeatures[entityKeySet].indices = append(fvFeatures[entityKeySet].indices, indices) } - return fvFeatures, nil + + mappingIndices := make([][]int, len(uniqueValues)) + uniqueEntityRows := make([]*types.EntityKey, 0) + for rowHash, row := range uniqueValues { + nextIdx := len(uniqueEntityRows) + + mappingIndices[nextIdx] = positions[rowHash] + uniqueEntityRows = append(uniqueEntityRows, row) + } + return uniqueEntityRows, mappingIndices, nil } func (fs *FeatureStore) getFeatureView(project, featureViewName string, hideDummyEntity bool) (*FeatureView, error) { diff --git a/go/internal/feast/featurestore_test.go b/go/internal/feast/featurestore_test.go index 0eaa4960e8..e3422c4447 100644 --- a/go/internal/feast/featurestore_test.go +++ b/go/internal/feast/featurestore_test.go @@ -2,7 +2,6 @@ package feast import ( "context" - "github.com/feast-dev/feast/go/protos/feast/serving" "github.com/feast-dev/feast/go/protos/feast/types" "github.com/stretchr/testify/assert" "path/filepath" @@ -50,22 +49,191 @@ func TestGetOnlineFeaturesRedis(t *testing.T) { }, } - featureViewNames := []string{"driver_hourly_stats:conv_rate", + featureNames := []string{"driver_hourly_stats:conv_rate", "driver_hourly_stats:acc_rate", "driver_hourly_stats:avg_daily_trips", } - featureList := serving.FeatureList{Val: featureViewNames} - featureListRequest := serving.GetOnlineFeaturesRequest_Features{Features: &featureList} entities := map[string]*types.RepeatedValue{"driver_id": {Val: []*types.Value{{Val: &types.Value_Int64Val{Int64Val: 1001}}, {Val: &types.Value_Int64Val{Int64Val: 1002}}, {Val: &types.Value_Int64Val{Int64Val: 1003}}}}, } - request := serving.GetOnlineFeaturesRequest{Kind: &featureListRequest, Entities: entities, FullFeatureNames: true} fs, err := NewFeatureStore(&config) assert.Nil(t, err) ctx := context.Background() - response, err := fs.GetOnlineFeatures(ctx, &request) + response, err := fs.GetOnlineFeatures(ctx, featureNames, nil, entities, true) assert.Nil(t, err) - assert.NotEmpty(t, response.Results) + assert.Len(t, response, 4) +} + +func TestGroupingFeatureRefs(t *testing.T) { + viewA := &FeatureView{ + base: &BaseFeatureView{ + name: "viewA", + projection: &FeatureViewProjection{ + nameAlias: "aliasViewA", + }, + }, + entities: map[string]struct{}{"driver": {}, "customer": {}}, + } + viewB := &FeatureView{ + base: &BaseFeatureView{name: "viewB"}, + entities: map[string]struct{}{"driver": {}, "customer": {}}, + } + viewC := &FeatureView{ + base: &BaseFeatureView{name: "viewC"}, + entities: map[string]struct{}{"driver": {}}, + } + viewD := &FeatureView{ + base: &BaseFeatureView{name: "viewD"}, + entities: map[string]struct{}{"customer": {}}, + } + refGroups, _ := groupFeatureRefs( + []*featuresAndView{ + {view: viewA, features: []string{"featureA", "featureB"}}, + {view: viewB, features: []string{"featureC", "featureD"}}, + {view: viewC, features: []string{"featureE"}}, + {view: viewD, features: []string{"featureF"}}, + }, + map[string]*types.RepeatedValue{ + "driver_id": {Val: []*types.Value{ + {Val: &types.Value_Int32Val{Int32Val: 0}}, + {Val: &types.Value_Int32Val{Int32Val: 0}}, + {Val: &types.Value_Int32Val{Int32Val: 1}}, + {Val: &types.Value_Int32Val{Int32Val: 1}}, + {Val: &types.Value_Int32Val{Int32Val: 1}}, + }}, + "customer_id": {Val: []*types.Value{ + {Val: &types.Value_Int32Val{Int32Val: 1}}, + {Val: &types.Value_Int32Val{Int32Val: 2}}, + {Val: &types.Value_Int32Val{Int32Val: 3}}, + {Val: &types.Value_Int32Val{Int32Val: 3}}, + {Val: &types.Value_Int32Val{Int32Val: 4}}, + }}, + }, + map[string]string{ + "driver": "driver_id", + "customer": "customer_id", + }, + true, + ) + + assert.Len(t, refGroups, 3) + + // Group 1 + assert.Equal(t, []string{"featureA", "featureB", "featureC", "featureD"}, + refGroups["customer_id,driver_id"].featureNames) + assert.Equal(t, []string{"viewA", "viewA", "viewB", "viewB"}, + refGroups["customer_id,driver_id"].featureViewNames) + assert.Equal(t, []string{ + "aliasViewA__featureA", "aliasViewA__featureB", + "viewB__featureC", "viewB__featureD"}, + refGroups["customer_id,driver_id"].aliasedFeatureNames) + for _, group := range [][]int{{0}, {1}, {2, 3}, {4}} { + assert.Contains(t, refGroups["customer_id,driver_id"].indices, group) + } + + // Group2 + assert.Equal(t, []string{"featureE"}, + refGroups["driver_id"].featureNames) + for _, group := range [][]int{{0, 1}, {2, 3, 4}} { + assert.Contains(t, refGroups["driver_id"].indices, group) + } + + // Group3 + assert.Equal(t, []string{"featureF"}, + refGroups["customer_id"].featureNames) + + for _, group := range [][]int{{0}, {1}, {2, 3}, {4}} { + assert.Contains(t, refGroups["customer_id"].indices, group) + } + +} + +func TestGroupingFeatureRefsWithJoinKeyAliases(t *testing.T) { + viewA := &FeatureView{ + base: &BaseFeatureView{ + name: "viewA", + projection: &FeatureViewProjection{ + name: "viewA", + joinKeyMap: map[string]string{"location_id": "destination_id"}, + }, + }, + entities: map[string]struct{}{"location": {}}, + } + viewB := &FeatureView{ + base: &BaseFeatureView{name: "viewB"}, + entities: map[string]struct{}{"location": {}}, + } + + refGroups, _ := groupFeatureRefs( + []*featuresAndView{ + {view: viewA, features: []string{"featureA", "featureB"}}, + {view: viewB, features: []string{"featureC", "featureD"}}, + }, + map[string]*types.RepeatedValue{ + "location_id": {Val: []*types.Value{ + {Val: &types.Value_Int32Val{Int32Val: 0}}, + {Val: &types.Value_Int32Val{Int32Val: 0}}, + {Val: &types.Value_Int32Val{Int32Val: 1}}, + {Val: &types.Value_Int32Val{Int32Val: 1}}, + {Val: &types.Value_Int32Val{Int32Val: 1}}, + }}, + "destination_id": {Val: []*types.Value{ + {Val: &types.Value_Int32Val{Int32Val: 1}}, + {Val: &types.Value_Int32Val{Int32Val: 2}}, + {Val: &types.Value_Int32Val{Int32Val: 3}}, + {Val: &types.Value_Int32Val{Int32Val: 3}}, + {Val: &types.Value_Int32Val{Int32Val: 4}}, + }}, + }, + map[string]string{ + "location": "location_id", + }, + true, + ) + + assert.Len(t, refGroups, 2) + + assert.Equal(t, []string{"featureA", "featureB"}, + refGroups["location_id[destination_id]"].featureNames) + for _, group := range [][]int{{0}, {1}, {2, 3}, {4}} { + assert.Contains(t, refGroups["location_id[destination_id]"].indices, group) + } + + assert.Equal(t, []string{"featureC", "featureD"}, + refGroups["location_id"].featureNames) + for _, group := range [][]int{{0, 1}, {2, 3, 4}} { + assert.Contains(t, refGroups["location_id"].indices, group) + } + +} + +func TestGroupingFeatureRefsWithMissingKey(t *testing.T) { + viewA := &FeatureView{ + base: &BaseFeatureView{ + name: "viewA", + projection: &FeatureViewProjection{ + name: "viewA", + joinKeyMap: map[string]string{"location_id": "destination_id"}, + }, + }, + entities: map[string]struct{}{"location": {}}, + } + + _, err := groupFeatureRefs( + []*featuresAndView{ + {view: viewA, features: []string{"featureA", "featureB"}}, + }, + map[string]*types.RepeatedValue{ + "location_id": {Val: []*types.Value{ + {Val: &types.Value_Int32Val{Int32Val: 0}}, + }}, + }, + map[string]string{ + "location": "location_id", + }, + true, + ) + assert.Errorf(t, err, "key destination_id is missing in provided entity rows") } diff --git a/go/internal/feast/repoconfig.go b/go/internal/feast/repoconfig.go index db097284c0..cef3489786 100644 --- a/go/internal/feast/repoconfig.go +++ b/go/internal/feast/repoconfig.go @@ -3,7 +3,7 @@ package feast import ( "encoding/json" "github.com/ghodss/yaml" - "os" + "io/ioutil" "path/filepath" ) @@ -54,7 +54,7 @@ func NewRepoConfigFromJSON(repoPath, configJSON string) (*RepoConfig, error) { // NewRepoConfigFromFile reads the `feature_store.yaml` file in the repo path and converts it // into a RepoConfig struct. func NewRepoConfigFromFile(repoPath string) (*RepoConfig, error) { - data, err := os.ReadFile(filepath.Join(repoPath, "feature_store.yaml")) + data, err := ioutil.ReadFile(filepath.Join(repoPath, "feature_store.yaml")) if err != nil { return nil, err } diff --git a/go/utils/typeconversion.go b/go/utils/typeconversion.go new file mode 100644 index 0000000000..b9ae2228a1 --- /dev/null +++ b/go/utils/typeconversion.go @@ -0,0 +1,99 @@ +package utils + +import ( + "fmt" + "github.com/apache/arrow/go/arrow" + "github.com/apache/arrow/go/arrow/array" + "github.com/feast-dev/feast/go/protos/feast/types" +) + +func ProtoTypeToArrowType(sample *types.Value) (arrow.DataType, error) { + switch sample.Val.(type) { + case *types.Value_BytesVal: + return arrow.FixedWidthTypes.Boolean, nil + case *types.Value_Int32Val: + return arrow.PrimitiveTypes.Int32, nil + case *types.Value_Int64Val: + return arrow.PrimitiveTypes.Int64, nil + case *types.Value_FloatVal: + return arrow.PrimitiveTypes.Float32, nil + case *types.Value_DoubleVal: + return arrow.PrimitiveTypes.Float64, nil + default: + return nil, + fmt.Errorf("unsupported proto type in proto to arrow conversion: %s", sample.Val) + } +} + +func ProtoValuesToArrowArray(builder array.Builder, values []*types.Value) error { + switch fieldBuilder := builder.(type) { + case *array.BooleanBuilder: + for _, v := range values { + fieldBuilder.Append(v.GetBoolVal()) + } + case *array.Int32Builder: + for _, v := range values { + fieldBuilder.Append(v.GetInt32Val()) + } + case *array.Int64Builder: + for _, v := range values { + fieldBuilder.Append(v.GetInt64Val()) + } + case *array.Float32Builder: + for _, v := range values { + fieldBuilder.Append(v.GetFloatVal()) + } + case *array.Float64Builder: + for _, v := range values { + fieldBuilder.Append(v.GetDoubleVal()) + } + default: + return fmt.Errorf("unsupported array builder: %s", builder) + } + return nil +} + +func ArrowValuesToProtoValues(arr array.Interface) ([]*types.Value, error) { + values := make([]*types.Value, 0) + switch arr.DataType() { + case arrow.PrimitiveTypes.Int32: + for _, v := range arr.(*array.Int32).Int32Values() { + values = append(values, &types.Value{Val: &types.Value_Int32Val{Int32Val: v}}) + } + case arrow.PrimitiveTypes.Int64: + for _, v := range arr.(*array.Int64).Int64Values() { + values = append(values, &types.Value{Val: &types.Value_Int64Val{Int64Val: v}}) + } + case arrow.PrimitiveTypes.Float32: + for _, v := range arr.(*array.Float32).Float32Values() { + values = append(values, &types.Value{Val: &types.Value_FloatVal{FloatVal: v}}) + } + case arrow.FixedWidthTypes.Boolean: + for idx := 0; idx < arr.Len(); idx++ { + values = append(values, + &types.Value{Val: &types.Value_BoolVal{BoolVal: arr.(*array.Boolean).Value(idx)}}) + } + default: + return nil, fmt.Errorf("unsupported arrow to proto conversion for type %s", arr.DataType()) + } + + return values, nil +} + +func protoTypeToArrowType(sample *types.Value) (arrow.DataType, error) { + switch sample.Val.(type) { + case *types.Value_BytesVal: + return arrow.FixedWidthTypes.Boolean, nil + case *types.Value_Int32Val: + return arrow.PrimitiveTypes.Int32, nil + case *types.Value_Int64Val: + return arrow.PrimitiveTypes.Int64, nil + case *types.Value_FloatVal: + return arrow.PrimitiveTypes.Float32, nil + case *types.Value_DoubleVal: + return arrow.PrimitiveTypes.Float64, nil + default: + return nil, + fmt.Errorf("unsupported proto type in proto to arrow conversion: %s", sample.Val) + } +} diff --git a/sdk/python/MANIFEST.in b/sdk/python/MANIFEST.in index c5f6b71418..0eeaa181b2 100644 --- a/sdk/python/MANIFEST.in +++ b/sdk/python/MANIFEST.in @@ -1,3 +1,4 @@ recursive-include feast/protos/ *.py -include feast/binaries/* recursive-include feast py.typed *.pyi + +recursive-include feast/embedded_go/lib/ *.py *.so diff --git a/sdk/python/feast/embedded_go/lib/__init__.py b/sdk/python/feast/embedded_go/lib/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/sdk/python/feast/embedded_go/online_features_service.py b/sdk/python/feast/embedded_go/online_features_service.py new file mode 100644 index 0000000000..3d8bbc72c3 --- /dev/null +++ b/sdk/python/feast/embedded_go/online_features_service.py @@ -0,0 +1,120 @@ +from typing import Any, Dict, List, Optional, Union + +import pyarrow as pa +from pyarrow.cffi import ffi + +from feast.errors import FeatureNameCollisionError +from feast.feature_service import FeatureService +from feast.online_response import OnlineResponse +from feast.protos.feast.serving.ServingService_pb2 import GetOnlineFeaturesResponse +from feast.protos.feast.types.Value_pb2 import RepeatedValue, Value +from feast.repo_config import RepoConfig +from tests.unit.test_proto_json import FeatureVector + +from .lib.embedded import DataTable, NewOnlineFeatureService, OnlineFeatureServiceConfig +from .lib.go import Slice_string + +ARROW_TYPE_TO_PROTO_FIELD = { + pa.int32(): "int32_val", + pa.int64(): "int64_val", + pa.float32(): "float_val", + pa.float64(): "double_val", + pa.bool_(): "bool_val", + pa.string(): "string_val", + pa.binary(): "bytes_val", +} + + +class EmbeddedOnlineFeatureServer: + def __init__(self, repo_path: str, repo_config: RepoConfig): + self._service = NewOnlineFeatureService( + OnlineFeatureServiceConfig( + RepoPath=repo_path, RepoConfig=repo_config.json() + ) + ) + + def get_online_features( + self, + features_refs: List[str], + feature_service: Optional[FeatureService], + entities: Dict[str, Union[List[Any], RepeatedValue]], + project: str, + full_feature_names: bool = False, + ): + entity_fields = [] + entity_arrays = [] + for entity_name, entity_values in entities.items(): + arr = _to_arrow(entity_values) + entity_fields.append((entity_name, arr.type)) + entity_arrays.append(arr) + + schema = pa.schema(entity_fields) + batch = pa.RecordBatch.from_arrays(entity_arrays, schema=schema) + + out_c_schema = ffi.new("struct ArrowSchema*") + out_ptr_schema = int(ffi.cast("uintptr_t", out_c_schema)) + + out_c_array = ffi.new("struct ArrowArray*") + out_ptr_array = int(ffi.cast("uintptr_t", out_c_array)) + + in_c_schema = ffi.new("struct ArrowSchema*") + in_ptr_schema = int(ffi.cast("uintptr_t", in_c_schema)) + + in_c_array = ffi.new("struct ArrowArray*") + in_ptr_array = int(ffi.cast("uintptr_t", in_c_array)) + + schema._export_to_c(in_ptr_schema) + batch._export_to_c(in_ptr_array) + try: + self._service.GetOnlineFeatures( + featureRefs=Slice_string(features_refs), + featureServiceName=feature_service and feature_service.name or "", + entities=DataTable(SchemaPtr=in_ptr_schema, DataPtr=in_ptr_array), + projectName=project, + fullFeatureNames=full_feature_names, + output=DataTable(SchemaPtr=out_ptr_schema, DataPtr=out_ptr_array), + ) + except RuntimeError as exc: + (msg,) = exc.args + if msg.startswith("featureNameCollisionError"): + feature_refs = msg[len("featureNameCollisionError: ") : msg.find(";")] + feature_refs = feature_refs.split(",") + raise FeatureNameCollisionError( + feature_refs_collisions=feature_refs, + full_feature_names=full_feature_names, + ) + + raise + + result = pa.RecordBatch._import_from_c(out_ptr_array, out_ptr_schema) + + resp = GetOnlineFeaturesResponse() + + for idx, field in enumerate(result.schema): + feature_vector = FeatureVector() + + if field.type == pa.null(): + feature_vector.values.extend([Value()] * len(result.columns[idx])) + else: + proto_field_name = ARROW_TYPE_TO_PROTO_FIELD[field.type] + for v in result.columns[idx].tolist(): + feature_vector.values.append(Value(**{proto_field_name: v})) + + resp.results.append(feature_vector) + resp.metadata.feature_names.val.append(field.name) + + return OnlineResponse(resp) + + +def _to_arrow(value) -> pa.Array: + if isinstance(value, RepeatedValue): + _proto_to_arrow(value) + + return pa.array(value) + + +def _proto_to_arrow(value: RepeatedValue) -> pa.Array: + """ + ToDo: support entity rows already packed in protos + """ + raise NotImplementedError diff --git a/sdk/python/feast/feature_store.py b/sdk/python/feast/feature_store.py index e9108f8953..eb7cabe21a 100644 --- a/sdk/python/feast/feature_store.py +++ b/sdk/python/feast/feature_store.py @@ -19,6 +19,7 @@ from datetime import datetime from pathlib import Path from typing import ( + TYPE_CHECKING, Any, Dict, Iterable, @@ -60,7 +61,6 @@ DUMMY_ENTITY_VAL, FeatureView, ) -from feast.go_server import GoServer from feast.inference import ( update_data_sources_with_inferred_event_timestamp_col, update_entities_with_inferred_types_from_feature_views, @@ -90,6 +90,10 @@ warnings.simplefilter("once", DeprecationWarning) +if TYPE_CHECKING: + from feast.embedded_go.online_features_service import EmbeddedOnlineFeatureServer + + class FeatureStore: """ A FeatureStore object is used to define, create, and retrieve features. @@ -104,7 +108,7 @@ class FeatureStore: repo_path: Path _registry: Registry _provider: Provider - _go_server: Optional[GoServer] + _go_server: Optional["EmbeddedOnlineFeatureServer"] @log_exceptions def __init__( @@ -729,10 +733,6 @@ def apply( service.name, project=self.project, commit=False ) - # If a go server is running, kill it so that it can be recreated in `update_infra` with - # the latest registry state. - self.kill_go_server() - self._get_provider().update_infra( project=self.project, tables_to_delete=views_to_delete if not partial else [], @@ -754,8 +754,6 @@ def teardown(self): entities = self.list_entities() - self.kill_go_server() - self._get_provider().teardown_infra(self.project, tables, entities) self._registry.teardown() @@ -1228,12 +1226,24 @@ def get_online_features( # If Go feature server is enabled, send request to it instead of going through a regular Python logic if self.config.go_feature_server: + from feast.embedded_go.online_features_service import ( + EmbeddedOnlineFeatureServer, + ) + # Lazily start the go server on the first request if self._go_server is None: - self._go_server = GoServer(str(self.repo_path.absolute()), self.config,) - self._go_server._shared_connection._check_grpc_connection() + self._go_server = EmbeddedOnlineFeatureServer( + str(self.repo_path.absolute()), self.config + ) + return self._go_server.get_online_features( - features, columnar, full_feature_names + features_refs=features if isinstance(features, list) else [], + feature_service=features + if isinstance(features, FeatureService) + else None, + entities=columnar, + full_feature_names=full_feature_names, + project=self.config.project, ) return self._get_online_features( @@ -1868,11 +1878,6 @@ def serve_transformations(self, port: int) -> None: transformation_server.start_server(self, port) - def kill_go_server(self): - if self._go_server: - self._go_server.kill_go_server_explicitly() - self._go_server = None - def _validate_entity_values(join_key_values: Dict[str, List[Value]]): set_of_row_lengths = {len(v) for v in join_key_values.values()} diff --git a/sdk/python/go_build.py b/sdk/python/go_build.py deleted file mode 100644 index bd2b006581..0000000000 --- a/sdk/python/go_build.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2022 The Feast Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -import os -import pathlib -import shutil -import subprocess - -# Build go server for 3 targets: macos (intel), macos (m1), linux (64 bit) -# First start by clearing the necessary directory -binaries_path = (pathlib.Path(__file__) / "../feast/binaries").resolve() -binaries_path_abs = str(binaries_path.absolute()) -if binaries_path.exists(): - shutil.rmtree(binaries_path_abs) -os.mkdir(binaries_path_abs) -# Then, iterate over target architectures and build executables -for goos, goarch in (("darwin", "amd64"), ("darwin", "arm64"), ("linux", "amd64")): - subprocess.check_output( - [ - "go", - "build", - "-o", - f"{binaries_path_abs}/go_server_{goos}_{goarch}", - "github.com/feast-dev/feast/go/server", - ], - env={"GOOS": goos, "GOARCH": goarch, **os.environ}, - ) diff --git a/sdk/python/requirements/py3.7-ci-requirements.txt b/sdk/python/requirements/py3.7-ci-requirements.txt index 4e5b523fdf..67a9096705 100644 --- a/sdk/python/requirements/py3.7-ci-requirements.txt +++ b/sdk/python/requirements/py3.7-ci-requirements.txt @@ -526,6 +526,8 @@ pyasn1==0.4.8 # rsa pyasn1-modules==0.2.8 # via google-auth +pybindgen==0.22.0 + # via feast (setup.py) pycodestyle==2.8.0 # via flake8 pycparser==2.21 diff --git a/sdk/python/requirements/py3.8-ci-requirements.txt b/sdk/python/requirements/py3.8-ci-requirements.txt index 2fa1d94177..5249771fb2 100644 --- a/sdk/python/requirements/py3.8-ci-requirements.txt +++ b/sdk/python/requirements/py3.8-ci-requirements.txt @@ -520,6 +520,8 @@ pyasn1==0.4.8 # rsa pyasn1-modules==0.2.8 # via google-auth +pybindgen==0.22.0 + # via feast (setup.py) pycodestyle==2.8.0 # via flake8 pycparser==2.21 diff --git a/sdk/python/requirements/py3.9-ci-requirements.txt b/sdk/python/requirements/py3.9-ci-requirements.txt index 333ebf614d..3a86c5d4dc 100644 --- a/sdk/python/requirements/py3.9-ci-requirements.txt +++ b/sdk/python/requirements/py3.9-ci-requirements.txt @@ -514,6 +514,8 @@ pyasn1==0.4.8 # rsa pyasn1-modules==0.2.8 # via google-auth +pybindgen==0.22.0 + # via feast (setup.py) pycodestyle==2.8.0 # via flake8 pycparser==2.21 diff --git a/sdk/python/setup.cfg b/sdk/python/setup.cfg index ce8f391eb1..e2d707e272 100644 --- a/sdk/python/setup.cfg +++ b/sdk/python/setup.cfg @@ -5,7 +5,7 @@ include_trailing_comma=True force_grid_wrap=0 use_parentheses=True line_length=88 -skip=feast/protos +skip=feast/protos,feast/embedded_go/lib known_first_party=feast,feast_serving_server,feast_core_server default_section=THIRDPARTY @@ -14,8 +14,9 @@ ignore = E203, E266, E501, W503 max-line-length = 88 max-complexity = 20 select = B,C,E,F,W,T4 -exclude = .git,__pycache__,docs/conf.py,dist,feast/protos +exclude = .git,__pycache__,docs/conf.py,dist,feast/protos,feast/embedded_go/lib [mypy] files=feast,tests ignore_missing_imports=true +exclude=feast/embedded_go/lib diff --git a/sdk/python/setup.py b/sdk/python/setup.py index fea83267ce..1edd74859e 100644 --- a/sdk/python/setup.py +++ b/sdk/python/setup.py @@ -132,6 +132,7 @@ "pre-commit", "assertpy==1.1", "pip-tools", + "pybindgen", "types-protobuf", "types-python-dateutil", "types-pytz", @@ -282,7 +283,6 @@ class BuildGoProtosCommand(Command): description = "Builds the proto files into Go files." user_options = [] - def initialize_options(self): self.go_protoc = [ "python", @@ -317,22 +317,47 @@ def _generate_go_protos(self, path: str): print(f"Stderr: {e.stderr}") print(f"Stdout: {e.stdout}") - def _compile_go_feature_server(self): - print("Compile go feature server") - subprocess.check_call(["go", - "build", - "-work", - "-x", - "-o", - f"{repo_root}/sdk/python/feast/binaries/server", - f"github.com/feast-dev/feast/go/cmd/server"]) - def run(self): go_dir = Path(repo_root) / "go" / "protos" go_dir.mkdir(exist_ok=True) for sub_folder in self.sub_folders: self._generate_go_protos(f"feast/{sub_folder}/*.proto") - self._compile_go_feature_server() + + +class BuildGoEmbeddedCommand(build_py): + description = "Builds Go embedded library" + user_options = [] + + def initialize_options(self) -> None: + self.path_val = _generate_path_with_gopath() + + self.go_env = {} + for var in ("GOCACHE", "GOPATH"): + self.go_env[var] = subprocess \ + .check_output(["go", "env", var]) \ + .decode("utf-8") \ + .strip() + + def finalize_options(self) -> None: + pass + + def _compile_embedded_lib(self): + print("Compile embedded go") + subprocess.check_call([ + "gopy", + "build", + "-output", + "feast/embedded_go/lib", + "-vm", + "python3", + "github.com/feast-dev/feast/go/embedded" + ], env={ + "PATH": self.path_val, + **self.go_env, + }) + + def run(self): + self._compile_embedded_lib() class BuildCommand(build_py): @@ -343,6 +368,7 @@ def run(self): if os.getenv("COMPILE_GO", "false").lower() == "true": _ensure_go_and_proto_toolchain() self.run_command("build_go_protos") + self.run_command("build_go_lib") build_py.run(self) @@ -354,6 +380,7 @@ def run(self): if os.getenv("COMPILE_GO", "false").lower() == "true": _ensure_go_and_proto_toolchain() self.run_command("build_go_protos") + self.run_command("build_go_lib") develop.run(self) @@ -408,6 +435,7 @@ def run(self): cmdclass={ "build_python_protos": BuildPythonProtosCommand, "build_go_protos": BuildGoProtosCommand, + "build_go_lib": BuildGoEmbeddedCommand, "build_py": BuildCommand, "develop": DevelopCommand, }, diff --git a/sdk/python/tests/conftest.py b/sdk/python/tests/conftest.py index 7dfb0c3927..d03d81a43b 100644 --- a/sdk/python/tests/conftest.py +++ b/sdk/python/tests/conftest.py @@ -30,7 +30,6 @@ ) from tests.integration.feature_repos.repo_configuration import ( FULL_REPO_CONFIGS, - GO_CYCLE_REPO_CONFIGS, GO_REPO_CONFIGS, REDIS_CLUSTER_CONFIG, REDIS_CONFIG, @@ -94,8 +93,6 @@ def pytest_collection_modifyitems(config, items: List[Item]): should_run_integration = config.getoption("--integration") is True should_run_benchmark = config.getoption("--benchmark") is True should_run_universal = config.getoption("--universal") is True - should_run_goserver = config.getoption("--goserver") is True - should_run_goserverlifecycle = config.getoption("--goserverlifecycle") is True integration_tests = [t for t in items if "integration" in t.keywords] if not should_run_integration: @@ -121,18 +118,6 @@ def pytest_collection_modifyitems(config, items: List[Item]): for t in universal_tests: items.append(t) - goserver_tests = [t for t in items if "goserver" in t.keywords] - if should_run_goserver: - items.clear() - for t in goserver_tests: - items.append(t) - - goserverlifecycle_tests = [t for t in items if "goserverlifecycle" in t.keywords] - if should_run_goserverlifecycle: - items.clear() - for t in goserverlifecycle_tests: - items.append(t) - @pytest.fixture def simple_dataset_1() -> pd.DataFrame: @@ -210,23 +195,6 @@ def cleanup(): def go_environment(request, worker_id: str): e = construct_test_environment(request.param, worker_id=worker_id) - def cleanup(): - e.feature_store.teardown() - if e.feature_store._go_server: - e.feature_store._go_server.kill_go_server_explicitly() - - request.addfinalizer(cleanup) - return e - - -@pytest.fixture( - params=GO_CYCLE_REPO_CONFIGS, - scope="session", - ids=[str(c) for c in GO_CYCLE_REPO_CONFIGS], -) -def go_cycle_environment(request, worker_id: str): - e = construct_test_environment(request.param, worker_id=worker_id) - def cleanup(): e.feature_store.teardown() diff --git a/sdk/python/tests/integration/feature_repos/repo_configuration.py b/sdk/python/tests/integration/feature_repos/repo_configuration.py index ef57977fcb..c271d08605 100644 --- a/sdk/python/tests/integration/feature_repos/repo_configuration.py +++ b/sdk/python/tests/integration/feature_repos/repo_configuration.py @@ -119,10 +119,6 @@ IntegrationTestRepoConfig(online_store=REDIS_CONFIG, go_feature_server=True,), ] -GO_CYCLE_REPO_CONFIGS = [ - IntegrationTestRepoConfig(online_store=REDIS_CONFIG, go_feature_server=True,), -] - @dataclass class UniversalEntities: diff --git a/sdk/python/tests/integration/online_store/test_universal_online.py b/sdk/python/tests/integration/online_store/test_universal_online.py index 8390e622cd..e146379cf1 100644 --- a/sdk/python/tests/integration/online_store/test_universal_online.py +++ b/sdk/python/tests/integration/online_store/test_universal_online.py @@ -1,7 +1,6 @@ import datetime import itertools import os -import signal import time import unittest from datetime import timedelta @@ -715,7 +714,6 @@ def eventually_apply() -> Tuple[None, bool]: assert all(v is None for v in online_features["value"]) -@pytest.mark.skip @pytest.mark.integration @pytest.mark.goserver @pytest.mark.parametrize("full_feature_names", [True, False], ids=lambda v: str(v)) @@ -867,12 +865,7 @@ def test_online_retrieval_with_go_server( ) entity_rows = [ - { - "driver_id": _driver, - "customer_id": _customer, - "origin_id": origin, - "destination_id": destination, - } + {"origin_id": origin, "destination_id": destination} for (_driver, _customer, origin, destination) in zip( sample_drivers, sample_customers, *sample_location_pairs ) @@ -890,138 +883,6 @@ def test_online_retrieval_with_go_server( ) -@pytest.mark.skip -@pytest.mark.integration -@pytest.mark.goserver -def test_online_store_cleanup_with_go_server(go_environment, go_data_sources): - """ - This test mirrors test_online_store_cleanup for the Go feature server. It removes - on demand feature views since the Go feature server doesn't support them. - """ - driver_entities, fs, simple_driver_fv, driver_stats_fv, df = setup_feature_store( - go_environment, go_data_sources - ) - expected_values = df.sort_values(by="driver_id") - features = [f"{simple_driver_fv.name}:value"] - entity_rows = [{"driver_id": driver_id} for driver_id in sorted(driver_entities)] - - online_features = fs.get_online_features( - features=features, entity_rows=entity_rows - ).to_dict() - - assert np.allclose(expected_values["value"], online_features["value"]) - - fs.apply( - objects=[simple_driver_fv], objects_to_delete=[driver_stats_fv], partial=False - ) - - online_features = fs.get_online_features( - features=features, entity_rows=entity_rows - ).to_dict() - assert np.allclose(expected_values["value"], online_features["value"]) - - fs.apply(objects=[], objects_to_delete=[simple_driver_fv], partial=False) - - def eventually_apply() -> Tuple[None, bool]: - try: - fs.apply([simple_driver_fv]) - except BotoCoreError: - return None, False - - return None, True - - # Online store backend might have eventual consistency in schema update - # So recreating table that was just deleted might need some retries - wait_retry_backoff(eventually_apply, timeout_secs=60) - - online_features = fs.get_online_features(features=features, entity_rows=entity_rows) - online_features = online_features.to_dict() - assert all(v is None for v in online_features["value"]) - - -@pytest.mark.skip -@pytest.mark.integration -@pytest.mark.goserverlifecycle -def test_go_server_life_cycle(go_cycle_environment, go_data_sources): - import threading - - import psutil - - driver_entities, fs, simple_driver_fv, _, _ = setup_feature_store( - go_cycle_environment, go_data_sources - ) - features = [f"{simple_driver_fv.name}:value"] - entity_rows = [{"driver_id": driver_id} for driver_id in sorted(driver_entities)] - - # Start go server process that calls get_online_features and return and check if at any time go server - # fails to clean up resources - fs.get_online_features(features=features, entity_rows=entity_rows).to_dict() - - assert ( - fs._go_server - and fs._go_server._go_server_started.is_set() - and fs._go_server._shared_connection._process - ) - go_fs_pid = fs._go_server._shared_connection._process.pid - - os.kill(go_fs_pid, signal.SIGTERM) - # At the same time checking that resources are clean up properly once child process is killed - # Check that background thread has terminated - monitor_thread_alive = False - monitor_thread = fs._go_server._go_server_background_thread - assert monitor_thread.daemon - - print(f"Monitor thread: {monitor_thread}, {monitor_thread.ident}") - - for thread in threading.enumerate(): - if thread.ident == monitor_thread.ident and thread.is_alive(): - monitor_thread_alive = True - assert monitor_thread_alive - - # Check if go server subprocess is still active even if background thread and process are killed - go_server_still_alive = False - for proc in psutil.process_iter(): - try: - # Get process name & pid from process object. - process_name = proc.name() - ppid = proc.ppid() - if "goserver" in process_name and ppid == go_fs_pid: - # Kill process first and raise exception later - go_server_still_alive = True - proc.terminate() - - except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess): - pass - assert not go_server_still_alive - - # Yield control to monitor thread to restart process. - time.sleep(1) - - # Make sure the background thread has created a new subprocess. - assert ( - fs._go_server - and fs._go_server._go_server_started.is_set() - and fs._go_server._shared_connection._process - ) - new_go_fs_pid = fs._go_server._shared_connection._process.pid - assert new_go_fs_pid != go_fs_pid - fs._go_server._shared_connection._check_grpc_connection() - - # Ensure process is still running. - assert fs._go_server._shared_connection._process.poll() is None - - # And we can still get feature values. - fs.get_online_features(features=features, entity_rows=entity_rows).to_dict() - - fs.kill_go_server() - - # Ensure process is dead. - assert fs._go_server is None - # Ensure monitoring thread is also dead. - live_threads = [t.ident for t in threading.enumerate()] - assert monitor_thread.ident not in live_threads - - def setup_feature_store(environment, go_data_sources): fs = environment.feature_store fs.kill_go_server() @@ -1114,17 +975,10 @@ def get_latest_feature_values_from_dataframes( global_df["event_timestamp"].idxmax() ].to_dict() if origin_df is not None: - latest_origin_row = get_latest_row( - entity_row, origin_df, "location_id", "origin_id" - ) - latest_destination_row = get_latest_row( - entity_row, destination_df, "location_id", "destination_id" - ) - # Need full feature names for shadow entities - latest_origin_row["origin__temperature"] = latest_origin_row.pop("temperature") - latest_destination_row["destination__temperature"] = latest_destination_row.pop( - "temperature" + latest_location_row = get_latest_feature_values_for_location_df( + entity_row, origin_df, destination_df ) + request_data_features = entity_row.copy() request_data_features.pop("driver_id") request_data_features.pop("customer_id") @@ -1143,8 +997,7 @@ def get_latest_feature_values_from_dataframes( **latest_customer_row, **latest_driver_row, **latest_orders_row, - **latest_origin_row, - **latest_destination_row, + **latest_location_row, **request_data_features, } return { @@ -1155,6 +1008,25 @@ def get_latest_feature_values_from_dataframes( } +def get_latest_feature_values_for_location_df(entity_row, origin_df, destination_df): + latest_origin_row = get_latest_row( + entity_row, origin_df, "location_id", "origin_id" + ) + latest_destination_row = get_latest_row( + entity_row, destination_df, "location_id", "destination_id" + ) + # Need full feature names for shadow entities + latest_origin_row["origin__temperature"] = latest_origin_row.pop("temperature") + latest_destination_row["destination__temperature"] = latest_destination_row.pop( + "temperature" + ) + + return { + **latest_origin_row, + **latest_destination_row, + } + + def assert_feature_service_correctness( environment, feature_service, @@ -1222,22 +1094,15 @@ def assert_feature_service_entity_mapping_correctness( ) feature_service_keys = feature_service_online_features_dict.keys() - assert ( - len(feature_service_keys) - == sum( - [ - len(projection.features) - for projection in feature_service.feature_view_projections - ] - ) - + 4 - ) # Add 4 for the driver_id, customer_id, origin_id, and destination_id entity keys + assert len(feature_service_keys) == sum( + [ + len(projection.features) + for projection in feature_service.feature_view_projections + ] + ) + len(entity_rows[0]) for i, entity_row in enumerate(entity_rows): - df_features = get_latest_feature_values_from_dataframes( - driver_df=drivers_df, - customer_df=customers_df, - orders_df=orders_df, + df_features = get_latest_feature_values_for_location_df( origin_df=origins_df, destination_df=destinations_df, entity_row=entity_row, From 8b03be676fa333e1206a7bb55dcf4219b4d54593 Mon Sep 17 00:00:00 2001 From: pyalex Date: Tue, 22 Mar 2022 18:13:54 -0700 Subject: [PATCH 02/10] more supported type for proto <-> arrow converstion Signed-off-by: pyalex --- Makefile | 2 +- go/embedded/online_features.go | 7 ++ go/internal/feast/featurestore.go | 1 + go/utils/typeconversion.go | 162 ++++++++++++++++++++++++++---- 4 files changed, 152 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 64c7092bc1..450978cdfd 100644 --- a/Makefile +++ b/Makefile @@ -137,7 +137,7 @@ compile-protos-go: install-go-proto-dependencies install-protoc-dependencies compile-go-lib: install-go-proto-dependencies install-go-ci-dependencies python -m install pybindgen - python sdk/python/setup.py build_go_lib + cd sdk/python && python setup.py build_go_lib test-go: compile-protos-go go test ./... diff --git a/go/embedded/online_features.go b/go/embedded/online_features.go index 04a6aec823..8a66edf0cb 100644 --- a/go/embedded/online_features.go +++ b/go/embedded/online_features.go @@ -92,6 +92,13 @@ func (s *OnlineFeatureService) GetOnlineFeatures( return nil } +/* + Read Record Batch from memory managed by Python caller. + Python part uses C ABI interface to export this record into C Data Interface, + and then it provides pointers (dataPtr & schemaPtr) to the Go part. + Here we import this data from given pointers and wrap them into Go Arrow Interface (array.Record). + See export code here https://github.com/feast-dev/feast/blob/master/sdk/python/feast/embedded_go/online_features_service.py +*/ func readArrowRecord(data DataTable) (array.Record, error) { return cdata.ImportCRecordBatch( cdata.ArrayFromPtr(data.DataPtr), diff --git a/go/internal/feast/featurestore.go b/go/internal/feast/featurestore.go index 3d8f34d702..8fe6ac62d6 100644 --- a/go/internal/feast/featurestore.go +++ b/go/internal/feast/featurestore.go @@ -82,6 +82,7 @@ func NewFeatureStore(config *RepoConfig) (*FeatureStore, error) { } // TODO: Review all functions that use ODFV and Request FV since these have not been tested +// ToDo: Split GetOnlineFeatures interface into two: GetOnlinFeaturesByFeatureService and GetOnlineFeaturesByFeatureRefs func (fs *FeatureStore) GetOnlineFeatures( ctx context.Context, featureRefs []string, diff --git a/go/utils/typeconversion.go b/go/utils/typeconversion.go index b9ae2228a1..ad0ca2e1f5 100644 --- a/go/utils/typeconversion.go +++ b/go/utils/typeconversion.go @@ -10,7 +10,9 @@ import ( func ProtoTypeToArrowType(sample *types.Value) (arrow.DataType, error) { switch sample.Val.(type) { case *types.Value_BytesVal: - return arrow.FixedWidthTypes.Boolean, nil + return arrow.BinaryTypes.Binary, nil + case *types.Value_StringVal: + return arrow.BinaryTypes.String, nil case *types.Value_Int32Val: return arrow.PrimitiveTypes.Int32, nil case *types.Value_Int64Val: @@ -19,6 +21,26 @@ func ProtoTypeToArrowType(sample *types.Value) (arrow.DataType, error) { return arrow.PrimitiveTypes.Float32, nil case *types.Value_DoubleVal: return arrow.PrimitiveTypes.Float64, nil + case *types.Value_BoolVal: + return arrow.FixedWidthTypes.Boolean, nil + case *types.Value_BoolListVal: + return arrow.ListOf(arrow.FixedWidthTypes.Boolean), nil + case *types.Value_StringListVal: + return arrow.ListOf(arrow.BinaryTypes.String), nil + case *types.Value_BytesListVal: + return arrow.ListOf(arrow.BinaryTypes.Binary), nil + case *types.Value_Int32ListVal: + return arrow.ListOf(arrow.PrimitiveTypes.Int32), nil + case *types.Value_Int64ListVal: + return arrow.ListOf(arrow.PrimitiveTypes.Int64), nil + case *types.Value_FloatListVal: + return arrow.ListOf(arrow.PrimitiveTypes.Float32), nil + case *types.Value_DoubleListVal: + return arrow.ListOf(arrow.PrimitiveTypes.Float64), nil + case *types.Value_UnixTimestampVal: + return arrow.FixedWidthTypes.Time64ns, nil + case *types.Value_UnixTimestampListVal: + return arrow.ListOf(arrow.FixedWidthTypes.Time64ns), nil default: return nil, fmt.Errorf("unsupported proto type in proto to arrow conversion: %s", sample.Val) @@ -31,6 +53,14 @@ func ProtoValuesToArrowArray(builder array.Builder, values []*types.Value) error for _, v := range values { fieldBuilder.Append(v.GetBoolVal()) } + case *array.BinaryBuilder: + for _, v := range values { + fieldBuilder.Append(v.GetBytesVal()) + } + case *array.StringBuilder: + for _, v := range values { + fieldBuilder.Append(v.GetStringVal()) + } case *array.Int32Builder: for _, v := range values { fieldBuilder.Append(v.GetInt32Val()) @@ -47,6 +77,50 @@ func ProtoValuesToArrowArray(builder array.Builder, values []*types.Value) error for _, v := range values { fieldBuilder.Append(v.GetDoubleVal()) } + case *array.Time64Builder: + for _, v := range values { + fieldBuilder.Append(arrow.Time64(v.GetUnixTimestampVal())) + } + case *array.ListBuilder: + for _, list := range values { + fieldBuilder.Append(true) + + switch valueBuilder := fieldBuilder.ValueBuilder().(type) { + + case *array.BooleanBuilder: + for _, v := range list.GetBoolListVal().GetVal() { + valueBuilder.Append(v) + } + case *array.BinaryBuilder: + for _, v := range list.GetBytesListVal().GetVal() { + valueBuilder.Append(v) + } + case *array.StringBuilder: + for _, v := range list.GetStringListVal().GetVal() { + valueBuilder.Append(v) + } + case *array.Int32Builder: + for _, v := range list.GetInt32ListVal().GetVal() { + valueBuilder.Append(v) + } + case *array.Int64Builder: + for _, v := range list.GetInt64ListVal().GetVal() { + valueBuilder.Append(v) + } + case *array.Float32Builder: + for _, v := range list.GetFloatListVal().GetVal() { + valueBuilder.Append(v) + } + case *array.Float64Builder: + for _, v := range list.GetDoubleListVal().GetVal() { + valueBuilder.Append(v) + } + case *array.Time64Builder: + for _, v := range list.GetUnixTimestampListVal().GetVal() { + valueBuilder.Append(arrow.Time64(v)) + } + } + } default: return fmt.Errorf("unsupported array builder: %s", builder) } @@ -73,27 +147,77 @@ func ArrowValuesToProtoValues(arr array.Interface) ([]*types.Value, error) { values = append(values, &types.Value{Val: &types.Value_BoolVal{BoolVal: arr.(*array.Boolean).Value(idx)}}) } + case arrow.BinaryTypes.Binary: + for idx := 0; idx < arr.Len(); idx++ { + values = append(values, + &types.Value{Val: &types.Value_BytesVal{BytesVal: arr.(*array.Binary).Value(idx)}}) + } + case arrow.BinaryTypes.String: + for idx := 0; idx < arr.Len(); idx++ { + values = append(values, + &types.Value{Val: &types.Value_StringVal{StringVal: arr.(*array.Binary).ValueString(idx)}}) + } + case arrow.LIST: + listArr := arr.(*array.List) + listValues := listArr.ListValues() + offsets := listArr.Offsets()[1:] + pos := 0 + for idx := 0; idx < listArr.Len(); idx++ { + switch listValues.DataType() { + case arrow.PrimitiveTypes.Int32: + vals := make([]int32, int(offsets[idx])-pos) + for j := pos; j < int(offsets[idx]); j++ { + vals[j-pos] = listValues.(*array.Int32).Value(j) + } + values = append(values, + &types.Value{Val: &types.Value_Int32ListVal{Int32ListVal: &types.Int32List{Val: vals}}}) + case arrow.PrimitiveTypes.Int64: + vals := make([]int64, int(offsets[idx])-pos) + for j := pos; j < int(offsets[idx]); j++ { + vals[j-pos] = listValues.(*array.Int64).Value(j) + } + values = append(values, + &types.Value{Val: &types.Value_Int64ListVal{Int64ListVal: &types.Int64List{Val: vals}}}) + case arrow.PrimitiveTypes.Float32: + vals := make([]float32, int(offsets[idx])-pos) + for j := pos; j < int(offsets[idx]); j++ { + vals[j-pos] = listValues.(*array.Float32).Value(j) + } + values = append(values, + &types.Value{Val: &types.Value_FloatListVal{FloatListVal: &types.FloatList{Val: vals}}}) + case arrow.PrimitiveTypes.Float64: + vals := make([]float64, int(offsets[idx])-pos) + for j := pos; j < int(offsets[idx]); j++ { + vals[j-pos] = listValues.(*array.Float64).Value(j) + } + values = append(values, + &types.Value{Val: &types.Value_DoubleListVal{DoubleListVal: &types.DoubleList{Val: vals}}}) + case arrow.BinaryTypes.Binary: + vals := make([][]byte, int(offsets[idx])-pos) + for j := pos; j < int(offsets[idx]); j++ { + vals[j-pos] = listValues.(*array.Binary).Value(j) + } + values = append(values, + &types.Value{Val: &types.Value_BytesListVal{BytesListVal: &types.BytesList{Val: vals}}}) + case arrow.BinaryTypes.String: + vals := make([]string, int(offsets[idx])-pos) + for j := pos; j < int(offsets[idx]); j++ { + vals[j-pos] = listValues.(*array.String).Value(j) + } + values = append(values, + &types.Value{Val: &types.Value_StringListVal{StringListVal: &types.StringList{Val: vals}}}) + case arrow.FixedWidthTypes.Boolean: + vals := make([]bool, int(offsets[idx])-pos) + for j := pos; j < int(offsets[idx]); j++ { + vals[j-pos] = listValues.(*array.Boolean).Value(j) + } + values = append(values, + &types.Value{Val: &types.Value_BoolListVal{BoolListVal: &types.BoolList{Val: vals}}}) + } + } default: return nil, fmt.Errorf("unsupported arrow to proto conversion for type %s", arr.DataType()) } return values, nil } - -func protoTypeToArrowType(sample *types.Value) (arrow.DataType, error) { - switch sample.Val.(type) { - case *types.Value_BytesVal: - return arrow.FixedWidthTypes.Boolean, nil - case *types.Value_Int32Val: - return arrow.PrimitiveTypes.Int32, nil - case *types.Value_Int64Val: - return arrow.PrimitiveTypes.Int64, nil - case *types.Value_FloatVal: - return arrow.PrimitiveTypes.Float32, nil - case *types.Value_DoubleVal: - return arrow.PrimitiveTypes.Float64, nil - default: - return nil, - fmt.Errorf("unsupported proto type in proto to arrow conversion: %s", sample.Val) - } -} From 47cae140cbaca37bd9ebf3dcff44a064d21c06b6 Mon Sep 17 00:00:00 2001 From: pyalex Date: Tue, 22 Mar 2022 18:42:06 -0700 Subject: [PATCH 03/10] better names Signed-off-by: pyalex --- go/cmd/server/server.go | 6 +- go/embedded/online_features.go | 3 +- go/internal/feast/featurestore.go | 76 +++++++++++++------------- go/internal/feast/featurestore_test.go | 20 +++---- go/utils/typeconversion.go | 64 ++++++++++++---------- 5 files changed, 86 insertions(+), 83 deletions(-) diff --git a/go/cmd/server/server.go b/go/cmd/server/server.go index 859c7c2d0a..2a3df80fa4 100644 --- a/go/cmd/server/server.go +++ b/go/cmd/server/server.go @@ -25,10 +25,6 @@ func (s *servingServiceServer) GetFeastServingInfo(ctx context.Context, request } func (s *servingServiceServer) GetOnlineFeatures(ctx context.Context, request *serving.GetOnlineFeaturesRequest) (*serving.GetOnlineFeaturesResponse, error) { - featureRefs, err := s.fs.ExtractFeatureRefs(request.GetKind(), request.GetFullFeatureNames()) - if err != nil { - return nil, err - } featuresOrService, err := s.fs.ParseFeatures(request.GetKind()) if err != nil { return nil, err @@ -36,7 +32,7 @@ func (s *servingServiceServer) GetOnlineFeatures(ctx context.Context, request *s featureVectors, err := s.fs.GetOnlineFeatures( ctx, - featureRefs, + featuresOrService.FeaturesRefs, featuresOrService.FeatureService, request.GetEntities(), request.GetFullFeatureNames()) diff --git a/go/embedded/online_features.go b/go/embedded/online_features.go index 8a66edf0cb..abb0712322 100644 --- a/go/embedded/online_features.go +++ b/go/embedded/online_features.go @@ -96,7 +96,8 @@ func (s *OnlineFeatureService) GetOnlineFeatures( Read Record Batch from memory managed by Python caller. Python part uses C ABI interface to export this record into C Data Interface, and then it provides pointers (dataPtr & schemaPtr) to the Go part. - Here we import this data from given pointers and wrap them into Go Arrow Interface (array.Record). + Here we import this data from given pointers and wrap the underlying values + into Go Arrow Interface (array.Record). See export code here https://github.com/feast-dev/feast/blob/master/sdk/python/feast/embedded_go/online_features_service.py */ func readArrowRecord(data DataTable) (array.Record, error) { diff --git a/go/internal/feast/featurestore.go b/go/internal/feast/featurestore.go index 8fe6ac62d6..d0e9312fba 100644 --- a/go/internal/feast/featurestore.go +++ b/go/internal/feast/featurestore.go @@ -31,10 +31,17 @@ type FeatureStore struct { // can be specified either as a list of string feature references or as a feature service. String // feature references must have format "feature_view:feature", e.g. "customer_fv:daily_transactions". type Features struct { - Features []string + FeaturesRefs []string FeatureService *FeatureService } +/* + FeatureVector type represent result of retrieving single feature for multiple rows. + It can be imagined as a column in output dataframe / table. + It contains of feature name, list of values (across all rows), + list of statuses and list of timestamp. All these lists have equal length. + And this length is also equal to number of entity rows received in request. +*/ type FeatureVector struct { Name string Values array.Interface @@ -42,17 +49,23 @@ type FeatureVector struct { Timestamps []*timestamppb.Timestamp } -type featuresAndView struct { - view *FeatureView - features []string +type featureViewAndRefs struct { + view *FeatureView + featureRefs []string } +/* + We group all features from a single request by entities they attached to. + Thus, we will be able to call online retrieval per entity and not per each feature view. + In this struct we collect all features and views that belongs to a group. + We also store here projected entity keys (only ones that needed to retrieve these features) + and indexes to map result of retrieval into output response. +*/ type GroupedFeaturesPerEntitySet struct { // A list of requested feature references of the form featureViewName:featureName that share this entity set featureNames []string featureViewNames []string - // A list of requested featureName if fullFeatureNames = False or a list of featureViewNameAlias__featureName that share this - // entity set + // full feature references as they supposed to appear in response aliasedFeatureNames []string // Entity set as a list of EntityKeys to pass to OnlineRead entityKeys []*types.EntityKey @@ -96,7 +109,7 @@ func (fs *FeatureStore) GetOnlineFeatures( } var fvs map[string]*FeatureView - var requestedFeatureViews []*featuresAndView + var requestedFeatureViews []*featureViewAndRefs var requestedRequestFeatureViews []*RequestFeatureView var requestedOnDemandFeatureViews []*OnDemandFeatureView if featureService != nil { @@ -215,14 +228,14 @@ func (fs *FeatureStore) DestructOnlineStore() { // and populates a Features struct with the result. func (fs *FeatureStore) ParseFeatures(kind interface{}) (*Features, error) { if featureList, ok := kind.(*serving.GetOnlineFeaturesRequest_Features); ok { - return &Features{Features: featureList.Features.GetVal(), FeatureService: nil}, nil + return &Features{FeaturesRefs: featureList.Features.GetVal(), FeatureService: nil}, nil } if featureServiceRequest, ok := kind.(*serving.GetOnlineFeaturesRequest_FeatureService); ok { featureService, err := fs.registry.getFeatureService(fs.config.Project, featureServiceRequest.FeatureService) if err != nil { return nil, err } - return &Features{Features: nil, FeatureService: featureService}, nil + return &Features{FeaturesRefs: nil, FeatureService: featureService}, nil } return nil, errors.New("cannot parse kind from GetOnlineFeaturesRequest") } @@ -240,21 +253,10 @@ func (fs *FeatureStore) getFeatureRefs(features *Features) ([]string, error) { } return featureRefs, nil } else { - return features.Features, nil + return features.FeaturesRefs, nil } } -func (fs *FeatureStore) ExtractFeatureRefs(kind interface{}, fullFeatureNames bool) ([]string, error) { - features, err := fs.ParseFeatures(kind) - if err != nil { - return nil, err - } - - featureRefs, err := fs.getFeatureRefs(features) - - return featureRefs, nil -} - func (fs *FeatureStore) GetFeatureService(name string, project string) (*FeatureService, error) { return fs.registry.getFeatureService(project, name) } @@ -268,7 +270,7 @@ func (fs *FeatureStore) GetFeatureService(name string, project string) (*Feature retrieving all feature views. Similar argument to FeatureService applies. */ -func (fs *FeatureStore) getFeatureViewsToUseByService(featureService *FeatureService, hideDummyEntity bool) (map[string]*FeatureView, []*featuresAndView, []*RequestFeatureView, []*OnDemandFeatureView, error) { +func (fs *FeatureStore) getFeatureViewsToUseByService(featureService *FeatureService, hideDummyEntity bool) (map[string]*FeatureView, []*featureViewAndRefs, []*RequestFeatureView, []*OnDemandFeatureView, error) { fvs := make(map[string]*FeatureView) requestFvs := make(map[string]*RequestFeatureView) odFvs := make(map[string]*OnDemandFeatureView) @@ -297,7 +299,7 @@ func (fs *FeatureStore) getFeatureViewsToUseByService(featureService *FeatureSer odFvs[onDemandFeatureView.base.name] = onDemandFeatureView } - fvsToUse := make([]*featuresAndView, 0) + fvsToUse := make([]*featureViewAndRefs, 0) requestFvsToUse := make([]*RequestFeatureView, 0) odFvsToUse := make([]*OnDemandFeatureView, 0) @@ -315,9 +317,9 @@ func (fs *FeatureStore) getFeatureViewsToUseByService(featureService *FeatureSer for index, feature := range newFv.base.features { features[index] = feature.name } - fvsToUse = append(fvsToUse, &featuresAndView{ - view: newFv, - features: features, + fvsToUse = append(fvsToUse, &featureViewAndRefs{ + view: newFv, + featureRefs: features, }) } else if requestFv, ok := requestFvs[featureViewName]; ok { base, err := requestFv.base.withProjection(featureProjection) @@ -343,7 +345,7 @@ func (fs *FeatureStore) getFeatureViewsToUseByService(featureService *FeatureSer /* Return all FeatureView, OnDemandFeatureView, RequestFeatureView from the registry */ -func (fs *FeatureStore) getFeatureViewsToUseByFeatureRefs(features []string, hideDummyEntity bool) (map[string]*FeatureView, []*featuresAndView, []*RequestFeatureView, []*OnDemandFeatureView, error) { +func (fs *FeatureStore) getFeatureViewsToUseByFeatureRefs(features []string, hideDummyEntity bool) (map[string]*FeatureView, []*featureViewAndRefs, []*RequestFeatureView, []*OnDemandFeatureView, error) { fvs := make(map[string]*FeatureView) requestFvs := make(map[string]*RequestFeatureView) odFvs := make(map[string]*OnDemandFeatureView) @@ -372,7 +374,7 @@ func (fs *FeatureStore) getFeatureViewsToUseByFeatureRefs(features []string, hid odFvs[onDemandFeatureView.base.name] = onDemandFeatureView } - fvsToUse := make([]*featuresAndView, 0) + fvsToUse := make([]*featureViewAndRefs, 0) requestFvsToUse := make([]*RequestFeatureView, 0) odFvsToUse := make([]*OnDemandFeatureView, 0) @@ -385,14 +387,14 @@ func (fs *FeatureStore) getFeatureViewsToUseByFeatureRefs(features []string, hid found := false for _, group := range fvsToUse { if group.view == fv { - group.features = append(group.features, featureName) + group.featureRefs = append(group.featureRefs, featureName) found = true } } if !found { - fvsToUse = append(fvsToUse, &featuresAndView{ - view: fv, - features: []string{featureName}, + fvsToUse = append(fvsToUse, &featureViewAndRefs{ + view: fv, + featureRefs: []string{featureName}, }) } } else if requestFv, ok := requestFvs[featureViewName]; ok { @@ -408,7 +410,7 @@ func (fs *FeatureStore) getFeatureViewsToUseByFeatureRefs(features []string, hid return fvs, fvsToUse, requestFvsToUse, odFvsToUse, nil } -func (fs *FeatureStore) getEntityMaps(requestedFeatureViews []*featuresAndView) (map[string]string, map[string]interface{}, error) { +func (fs *FeatureStore) getEntityMaps(requestedFeatureViews []*featureViewAndRefs) (map[string]string, map[string]interface{}, error) { entityNameToJoinKeyMap := make(map[string]string) expectedJoinKeysSet := make(map[string]interface{}) @@ -458,11 +460,11 @@ func (fs *FeatureStore) validateEntityValues(joinKeyValues map[string]*types.Rep return numRows, nil } -func validateFeatureRefs(requestedFeatures []*featuresAndView, fullFeatureNames bool) error { +func validateFeatureRefs(requestedFeatures []*featureViewAndRefs, fullFeatureNames bool) error { featureRefCounter := make(map[string]int) featureRefs := make([]string, 0) for _, viewAndFeatures := range requestedFeatures { - for _, feature := range viewAndFeatures.features { + for _, feature := range viewAndFeatures.featureRefs { projectedViewName := viewAndFeatures.view.base.name if viewAndFeatures.view.base.projection != nil { projectedViewName = viewAndFeatures.view.base.projection.nameToUse() @@ -738,7 +740,7 @@ Group feature views that share the same set of join keys. For each group, we sto rows for each requested feature */ -func groupFeatureRefs(requestedFeatureViews []*featuresAndView, +func groupFeatureRefs(requestedFeatureViews []*featureViewAndRefs, joinKeyValues map[string]*types.RepeatedValue, entityNameToJoinKeyMap map[string]string, fullFeatureNames bool, @@ -750,7 +752,7 @@ func groupFeatureRefs(requestedFeatureViews []*featuresAndView, for _, featuresAndView := range requestedFeatureViews { joinKeys := make([]string, 0) fv := featuresAndView.view - featureNames := featuresAndView.features + featureNames := featuresAndView.featureRefs for entity, _ := range fv.entities { joinKeys = append(joinKeys, entityNameToJoinKeyMap[entity]) } diff --git a/go/internal/feast/featurestore_test.go b/go/internal/feast/featurestore_test.go index e3422c4447..b7413e645f 100644 --- a/go/internal/feast/featurestore_test.go +++ b/go/internal/feast/featurestore_test.go @@ -89,11 +89,11 @@ func TestGroupingFeatureRefs(t *testing.T) { entities: map[string]struct{}{"customer": {}}, } refGroups, _ := groupFeatureRefs( - []*featuresAndView{ - {view: viewA, features: []string{"featureA", "featureB"}}, - {view: viewB, features: []string{"featureC", "featureD"}}, - {view: viewC, features: []string{"featureE"}}, - {view: viewD, features: []string{"featureF"}}, + []*featureViewAndRefs{ + {view: viewA, featureRefs: []string{"featureA", "featureB"}}, + {view: viewB, featureRefs: []string{"featureC", "featureD"}}, + {view: viewC, featureRefs: []string{"featureE"}}, + {view: viewD, featureRefs: []string{"featureF"}}, }, map[string]*types.RepeatedValue{ "driver_id": {Val: []*types.Value{ @@ -167,9 +167,9 @@ func TestGroupingFeatureRefsWithJoinKeyAliases(t *testing.T) { } refGroups, _ := groupFeatureRefs( - []*featuresAndView{ - {view: viewA, features: []string{"featureA", "featureB"}}, - {view: viewB, features: []string{"featureC", "featureD"}}, + []*featureViewAndRefs{ + {view: viewA, featureRefs: []string{"featureA", "featureB"}}, + {view: viewB, featureRefs: []string{"featureC", "featureD"}}, }, map[string]*types.RepeatedValue{ "location_id": {Val: []*types.Value{ @@ -222,8 +222,8 @@ func TestGroupingFeatureRefsWithMissingKey(t *testing.T) { } _, err := groupFeatureRefs( - []*featuresAndView{ - {view: viewA, features: []string{"featureA", "featureB"}}, + []*featureViewAndRefs{ + {view: viewA, featureRefs: []string{"featureA", "featureB"}}, }, map[string]*types.RepeatedValue{ "location_id": {Val: []*types.Value{ diff --git a/go/utils/typeconversion.go b/go/utils/typeconversion.go index ad0ca2e1f5..9549649218 100644 --- a/go/utils/typeconversion.go +++ b/go/utils/typeconversion.go @@ -129,36 +129,8 @@ func ProtoValuesToArrowArray(builder array.Builder, values []*types.Value) error func ArrowValuesToProtoValues(arr array.Interface) ([]*types.Value, error) { values := make([]*types.Value, 0) - switch arr.DataType() { - case arrow.PrimitiveTypes.Int32: - for _, v := range arr.(*array.Int32).Int32Values() { - values = append(values, &types.Value{Val: &types.Value_Int32Val{Int32Val: v}}) - } - case arrow.PrimitiveTypes.Int64: - for _, v := range arr.(*array.Int64).Int64Values() { - values = append(values, &types.Value{Val: &types.Value_Int64Val{Int64Val: v}}) - } - case arrow.PrimitiveTypes.Float32: - for _, v := range arr.(*array.Float32).Float32Values() { - values = append(values, &types.Value{Val: &types.Value_FloatVal{FloatVal: v}}) - } - case arrow.FixedWidthTypes.Boolean: - for idx := 0; idx < arr.Len(); idx++ { - values = append(values, - &types.Value{Val: &types.Value_BoolVal{BoolVal: arr.(*array.Boolean).Value(idx)}}) - } - case arrow.BinaryTypes.Binary: - for idx := 0; idx < arr.Len(); idx++ { - values = append(values, - &types.Value{Val: &types.Value_BytesVal{BytesVal: arr.(*array.Binary).Value(idx)}}) - } - case arrow.BinaryTypes.String: - for idx := 0; idx < arr.Len(); idx++ { - values = append(values, - &types.Value{Val: &types.Value_StringVal{StringVal: arr.(*array.Binary).ValueString(idx)}}) - } - case arrow.LIST: - listArr := arr.(*array.List) + + if listArr, ok := arr.(*array.List); ok { listValues := listArr.ListValues() offsets := listArr.Offsets()[1:] pos := 0 @@ -215,6 +187,38 @@ func ArrowValuesToProtoValues(arr array.Interface) ([]*types.Value, error) { &types.Value{Val: &types.Value_BoolListVal{BoolListVal: &types.BoolList{Val: vals}}}) } } + + return values, nil + } + + switch arr.DataType() { + case arrow.PrimitiveTypes.Int32: + for _, v := range arr.(*array.Int32).Int32Values() { + values = append(values, &types.Value{Val: &types.Value_Int32Val{Int32Val: v}}) + } + case arrow.PrimitiveTypes.Int64: + for _, v := range arr.(*array.Int64).Int64Values() { + values = append(values, &types.Value{Val: &types.Value_Int64Val{Int64Val: v}}) + } + case arrow.PrimitiveTypes.Float32: + for _, v := range arr.(*array.Float32).Float32Values() { + values = append(values, &types.Value{Val: &types.Value_FloatVal{FloatVal: v}}) + } + case arrow.FixedWidthTypes.Boolean: + for idx := 0; idx < arr.Len(); idx++ { + values = append(values, + &types.Value{Val: &types.Value_BoolVal{BoolVal: arr.(*array.Boolean).Value(idx)}}) + } + case arrow.BinaryTypes.Binary: + for idx := 0; idx < arr.Len(); idx++ { + values = append(values, + &types.Value{Val: &types.Value_BytesVal{BytesVal: arr.(*array.Binary).Value(idx)}}) + } + case arrow.BinaryTypes.String: + for idx := 0; idx < arr.Len(); idx++ { + values = append(values, + &types.Value{Val: &types.Value_StringVal{StringVal: arr.(*array.Binary).ValueString(idx)}}) + } default: return nil, fmt.Errorf("unsupported arrow to proto conversion for type %s", arr.DataType()) } From 70bdf1ae01828b4fd4db3c7769a9b99bea2b339c Mon Sep 17 00:00:00 2001 From: pyalex Date: Tue, 22 Mar 2022 18:50:01 -0700 Subject: [PATCH 04/10] fix arrow to proto conversion Signed-off-by: pyalex --- go/internal/feast/featurestore.go | 2 +- go/utils/typeconversion.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/go/internal/feast/featurestore.go b/go/internal/feast/featurestore.go index d0e9312fba..d8525b7560 100644 --- a/go/internal/feast/featurestore.go +++ b/go/internal/feast/featurestore.go @@ -27,7 +27,7 @@ type FeatureStore struct { onlineStore OnlineStore } -// A Features struct specifies a list of Features to be retrieved from the online store. These Features +// A Features struct specifies a list of features to be retrieved from the online store. These features // can be specified either as a list of string feature references or as a feature service. String // feature references must have format "feature_view:feature", e.g. "customer_fv:daily_transactions". type Features struct { diff --git a/go/utils/typeconversion.go b/go/utils/typeconversion.go index 9549649218..270bfca957 100644 --- a/go/utils/typeconversion.go +++ b/go/utils/typeconversion.go @@ -186,6 +186,9 @@ func ArrowValuesToProtoValues(arr array.Interface) ([]*types.Value, error) { values = append(values, &types.Value{Val: &types.Value_BoolListVal{BoolListVal: &types.BoolList{Val: vals}}}) } + + // set the end of current element as start of the next + pos = int(offsets[idx]) } return values, nil From d14eeb2b84a90851093165a069d0a12cb3cd2740 Mon Sep 17 00:00:00 2001 From: pyalex Date: Tue, 22 Mar 2022 18:57:03 -0700 Subject: [PATCH 05/10] fix import Signed-off-by: pyalex --- sdk/python/feast/embedded_go/online_features_service.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk/python/feast/embedded_go/online_features_service.py b/sdk/python/feast/embedded_go/online_features_service.py index 3d8bbc72c3..246cc96de8 100644 --- a/sdk/python/feast/embedded_go/online_features_service.py +++ b/sdk/python/feast/embedded_go/online_features_service.py @@ -9,7 +9,6 @@ from feast.protos.feast.serving.ServingService_pb2 import GetOnlineFeaturesResponse from feast.protos.feast.types.Value_pb2 import RepeatedValue, Value from feast.repo_config import RepoConfig -from tests.unit.test_proto_json import FeatureVector from .lib.embedded import DataTable, NewOnlineFeatureService, OnlineFeatureServiceConfig from .lib.go import Slice_string @@ -91,7 +90,7 @@ def get_online_features( resp = GetOnlineFeaturesResponse() for idx, field in enumerate(result.schema): - feature_vector = FeatureVector() + feature_vector = GetOnlineFeaturesResponse.FeatureVector() if field.type == pa.null(): feature_vector.values.extend([Value()] * len(result.columns[idx])) From 6ed2a2a58756878b56a62b0c8b533acd0630fa3c Mon Sep 17 00:00:00 2001 From: pyalex Date: Wed, 23 Mar 2022 15:04:06 -0700 Subject: [PATCH 06/10] address some PR comments Signed-off-by: pyalex --- Makefile | 2 ++ go/embedded/online_features.go | 2 +- go/internal/feast/featurestore_test.go | 2 +- .../feast/embedded_go/online_features_service.py | 5 +++++ sdk/python/tests/conftest.py | 13 +++++++------ 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 450978cdfd..021c6b1640 100644 --- a/Makefile +++ b/Makefile @@ -125,6 +125,8 @@ install-go-proto-dependencies: go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1.0 install-go-ci-dependencies: + # ToDo: currently gopy installation doesn't work w/o explicit go get in the next two lines + # ToDo: there should be a better way to install gopy go get golang.org/x/tools/cmd/goimports go get github.com/go-python/gopy go install github.com/go-python/gopy diff --git a/go/embedded/online_features.go b/go/embedded/online_features.go index abb0712322..c0002b1230 100644 --- a/go/embedded/online_features.go +++ b/go/embedded/online_features.go @@ -35,7 +35,7 @@ func NewOnlineFeatureService(conf *OnlineFeatureServiceConfig) *OnlineFeatureSer if err != nil { log.Fatalln(err) } - defer fs.DestructOnlineStore() + return &OnlineFeatureService{fs: fs} } diff --git a/go/internal/feast/featurestore_test.go b/go/internal/feast/featurestore_test.go index b7413e645f..3a25a56bcd 100644 --- a/go/internal/feast/featurestore_test.go +++ b/go/internal/feast/featurestore_test.go @@ -63,7 +63,7 @@ func TestGetOnlineFeaturesRedis(t *testing.T) { ctx := context.Background() response, err := fs.GetOnlineFeatures(ctx, featureNames, nil, entities, true) assert.Nil(t, err) - assert.Len(t, response, 4) + assert.Len(t, response, 4) // 3 features + 1 entity = 4 columns (feature vectors) in response } func TestGroupingFeatureRefs(t *testing.T) { diff --git a/sdk/python/feast/embedded_go/online_features_service.py b/sdk/python/feast/embedded_go/online_features_service.py index 246cc96de8..a18f1582c7 100644 --- a/sdk/python/feast/embedded_go/online_features_service.py +++ b/sdk/python/feast/embedded_go/online_features_service.py @@ -50,6 +50,11 @@ def get_online_features( schema = pa.schema(entity_fields) batch = pa.RecordBatch.from_arrays(entity_arrays, schema=schema) + # Here we create C structures that will be shared between Python and Go. + # We will pass entities as arrow Record Batch to Go part (in_c_array & in_c_schema) + # and receive features as Record Batch from Go (out_c_array & out_c_schema) + # This objects needs to be initialized here in order to correctly + # free them later using Python GC. out_c_schema = ffi.new("struct ArrowSchema*") out_ptr_schema = int(ffi.cast("uintptr_t", out_c_schema)) diff --git a/sdk/python/tests/conftest.py b/sdk/python/tests/conftest.py index d03d81a43b..1254604a0b 100644 --- a/sdk/python/tests/conftest.py +++ b/sdk/python/tests/conftest.py @@ -81,18 +81,13 @@ def pytest_addoption(parser): default=False, help="Run tests that use the go feature server", ) - parser.addoption( - "--goserverlifecycle", - action="store_true", - default=False, - help="Run tests on go feature server lifecycle", - ) def pytest_collection_modifyitems(config, items: List[Item]): should_run_integration = config.getoption("--integration") is True should_run_benchmark = config.getoption("--benchmark") is True should_run_universal = config.getoption("--universal") is True + should_run_goserver = config.getoption("--goserver") is True integration_tests = [t for t in items if "integration" in t.keywords] if not should_run_integration: @@ -118,6 +113,12 @@ def pytest_collection_modifyitems(config, items: List[Item]): for t in universal_tests: items.append(t) + goserver_tests = [t for t in items if "goserver" in t.keywords] + if should_run_goserver: + items.clear() + for t in goserver_tests: + items.append(t) + @pytest.fixture def simple_dataset_1() -> pd.DataFrame: From dfd3a9848bcfef832d9280d8069d3850c9259bb8 Mon Sep 17 00:00:00 2001 From: pyalex Date: Thu, 24 Mar 2022 10:54:23 -0700 Subject: [PATCH 07/10] fix Makefile Signed-off-by: pyalex --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 021c6b1640..18d6c9a0fd 100644 --- a/Makefile +++ b/Makefile @@ -138,7 +138,7 @@ compile-protos-go: install-go-proto-dependencies install-protoc-dependencies cd sdk/python && python setup.py build_go_protos compile-go-lib: install-go-proto-dependencies install-go-ci-dependencies - python -m install pybindgen + python -m pip install pybindgen==0.22.0 cd sdk/python && python setup.py build_go_lib test-go: compile-protos-go From ba40a153db7db6318872df843f274686dc740499 Mon Sep 17 00:00:00 2001 From: pyalex Date: Thu, 24 Mar 2022 12:08:50 -0700 Subject: [PATCH 08/10] type conversion test Signed-off-by: pyalex --- go/internal/feast/featurestore.go | 28 ++--------- go/utils/typeconversion.go | 52 +++++++++++++++++++- go/utils/typeconversion_test.go | 80 +++++++++++++++++++++++++++++++ 3 files changed, 134 insertions(+), 26 deletions(-) create mode 100644 go/utils/typeconversion_test.go diff --git a/go/internal/feast/featurestore.go b/go/internal/feast/featurestore.go index d8525b7560..ca55f703dd 100644 --- a/go/internal/feast/featurestore.go +++ b/go/internal/feast/featurestore.go @@ -8,7 +8,6 @@ import ( "sort" "strings" - "github.com/apache/arrow/go/arrow" "github.com/apache/arrow/go/arrow/array" "github.com/apache/arrow/go/arrow/memory" "github.com/feast-dev/feast/go/protos/feast/serving" @@ -622,30 +621,11 @@ func (fs *FeatureStore) transposeResponseIntoColumns(featureData2D [][]FeatureDa currentVector.Timestamps[rowIndex] = eventTimeStamp } } - var fieldType arrow.DataType - var err error - - for _, val := range protoValues { - if val != nil { - fieldType, err = utils.ProtoTypeToArrowType(val) - if err != nil { - return nil, err - } - break - } - } - - if fieldType != nil { - builder := array.NewBuilder(arrowAllocator, fieldType) - err = utils.ProtoValuesToArrowArray(builder, protoValues) - if err != nil { - return nil, err - } - - currentVector.Values = builder.NewArray() - } else { - currentVector.Values = array.NewNull(numRows) + arrowValues, err := utils.ProtoValuesToArrowArray(protoValues, arrowAllocator, numRows) + if err != nil { + return nil, err } + currentVector.Values = arrowValues } return vectors, nil diff --git a/go/utils/typeconversion.go b/go/utils/typeconversion.go index 270bfca957..f81d0ff8f7 100644 --- a/go/utils/typeconversion.go +++ b/go/utils/typeconversion.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/apache/arrow/go/arrow" "github.com/apache/arrow/go/arrow/array" + "github.com/apache/arrow/go/arrow/memory" "github.com/feast-dev/feast/go/protos/feast/types" ) @@ -47,7 +48,7 @@ func ProtoTypeToArrowType(sample *types.Value) (arrow.DataType, error) { } } -func ProtoValuesToArrowArray(builder array.Builder, values []*types.Value) error { +func copyProtoValuesToArrowArray(builder array.Builder, values []*types.Value) error { switch fieldBuilder := builder.(type) { case *array.BooleanBuilder: for _, v := range values { @@ -185,6 +186,16 @@ func ArrowValuesToProtoValues(arr array.Interface) ([]*types.Value, error) { } values = append(values, &types.Value{Val: &types.Value_BoolListVal{BoolListVal: &types.BoolList{Val: vals}}}) + case arrow.FixedWidthTypes.Time64ns: + vals := make([]int64, int(offsets[idx])-pos) + for j := pos; j < int(offsets[idx]); j++ { + vals[j-pos] = int64(listValues.(*array.Time64).Value(j)) + } + + values = append(values, + &types.Value{Val: &types.Value_UnixTimestampListVal{ + UnixTimestampListVal: &types.Int64List{Val: vals}}}) + } // set the end of current element as start of the next @@ -207,6 +218,10 @@ func ArrowValuesToProtoValues(arr array.Interface) ([]*types.Value, error) { for _, v := range arr.(*array.Float32).Float32Values() { values = append(values, &types.Value{Val: &types.Value_FloatVal{FloatVal: v}}) } + case arrow.PrimitiveTypes.Float64: + for _, v := range arr.(*array.Float64).Float64Values() { + values = append(values, &types.Value{Val: &types.Value_DoubleVal{DoubleVal: v}}) + } case arrow.FixedWidthTypes.Boolean: for idx := 0; idx < arr.Len(); idx++ { values = append(values, @@ -220,7 +235,13 @@ func ArrowValuesToProtoValues(arr array.Interface) ([]*types.Value, error) { case arrow.BinaryTypes.String: for idx := 0; idx < arr.Len(); idx++ { values = append(values, - &types.Value{Val: &types.Value_StringVal{StringVal: arr.(*array.Binary).ValueString(idx)}}) + &types.Value{Val: &types.Value_StringVal{StringVal: arr.(*array.String).Value(idx)}}) + } + case arrow.FixedWidthTypes.Time64ns: + for idx := 0; idx < arr.Len(); idx++ { + values = append(values, + &types.Value{Val: &types.Value_UnixTimestampVal{ + UnixTimestampVal: int64(arr.(*array.Time64).Value(idx))}}) } default: return nil, fmt.Errorf("unsupported arrow to proto conversion for type %s", arr.DataType()) @@ -228,3 +249,30 @@ func ArrowValuesToProtoValues(arr array.Interface) ([]*types.Value, error) { return values, nil } + +func ProtoValuesToArrowArray(protoValues []*types.Value, arrowAllocator memory.Allocator, numRows int) (array.Interface, error) { + var fieldType arrow.DataType + var err error + + for _, val := range protoValues { + if val != nil { + fieldType, err = ProtoTypeToArrowType(val) + if err != nil { + return nil, err + } + break + } + } + + if fieldType != nil { + builder := array.NewBuilder(arrowAllocator, fieldType) + err = copyProtoValuesToArrowArray(builder, protoValues) + if err != nil { + return nil, err + } + + return builder.NewArray(), nil + } else { + return array.NewNull(numRows), nil + } +} diff --git a/go/utils/typeconversion_test.go b/go/utils/typeconversion_test.go new file mode 100644 index 0000000000..084cf816b9 --- /dev/null +++ b/go/utils/typeconversion_test.go @@ -0,0 +1,80 @@ +package utils + +import ( + "github.com/apache/arrow/go/arrow/memory" + "github.com/feast-dev/feast/go/protos/feast/types" + "github.com/golang/protobuf/proto" + "github.com/stretchr/testify/assert" + "testing" + "time" +) + +var ( + PROTO_VALUES = [][]*types.Value{ + {{Val: &types.Value_Int32Val{10}}, {Val: &types.Value_Int32Val{20}}}, + {{Val: &types.Value_Int64Val{10}}, {Val: &types.Value_Int64Val{20}}}, + {{Val: &types.Value_FloatVal{1.0}}, {Val: &types.Value_FloatVal{2.0}}}, + {{Val: &types.Value_DoubleVal{1.0}}, {Val: &types.Value_DoubleVal{2.0}}}, + {{Val: &types.Value_StringVal{"aaa"}}, {Val: &types.Value_StringVal{"bbb"}}}, + {{Val: &types.Value_BytesVal{[]byte{1, 2, 3}}}, {Val: &types.Value_BytesVal{[]byte{4, 5, 6}}}}, + {{Val: &types.Value_BoolVal{true}}, {Val: &types.Value_BoolVal{false}}}, + {{Val: &types.Value_UnixTimestampVal{time.Now().Unix()}}, + {Val: &types.Value_UnixTimestampVal{time.Now().Unix()}}}, + + { + {Val: &types.Value_Int32ListVal{&types.Int32List{Val: []int32{0, 1, 2}}}}, + {Val: &types.Value_Int32ListVal{&types.Int32List{Val: []int32{3, 4, 5}}}}, + }, + { + {Val: &types.Value_Int64ListVal{&types.Int64List{Val: []int64{0, 1, 2}}}}, + {Val: &types.Value_Int64ListVal{&types.Int64List{Val: []int64{3, 4, 5}}}}, + }, + { + {Val: &types.Value_FloatListVal{&types.FloatList{Val: []float32{0.5, 1.5, 2}}}}, + {Val: &types.Value_FloatListVal{&types.FloatList{Val: []float32{3.5, 4, 5}}}}, + }, + { + {Val: &types.Value_DoubleListVal{&types.DoubleList{Val: []float64{0.5, 1, 2}}}}, + {Val: &types.Value_DoubleListVal{&types.DoubleList{Val: []float64{3.5, 4, 5}}}}, + }, + { + {Val: &types.Value_BytesListVal{&types.BytesList{Val: [][]byte{{0, 1}, {2}}}}}, + {Val: &types.Value_BytesListVal{&types.BytesList{Val: [][]byte{{3, 4}, {5}}}}}, + }, + { + {Val: &types.Value_StringListVal{&types.StringList{Val: []string{"aa", "bb"}}}}, + {Val: &types.Value_StringListVal{&types.StringList{Val: []string{"cc", "dd"}}}}, + }, + { + {Val: &types.Value_BoolListVal{&types.BoolList{Val: []bool{false, false}}}}, + {Val: &types.Value_BoolListVal{&types.BoolList{Val: []bool{true, true}}}}, + }, + { + {Val: &types.Value_UnixTimestampListVal{&types.Int64List{Val: []int64{time.Now().Unix()}}}}, + {Val: &types.Value_UnixTimestampListVal{&types.Int64List{Val: []int64{time.Now().Unix()}}}}, + }, + } +) + +func TestConversionBetweenProtoAndArrow(t *testing.T) { + pool := memory.NewGoAllocator() + for _, vector := range PROTO_VALUES { + arrowArray, err := ProtoValuesToArrowArray(vector, pool, len(vector)) + assert.Nil(t, err) + + protoValues, err := ArrowValuesToProtoValues(arrowArray) + assert.Nil(t, err) + + protoValuesEquals(t, vector, protoValues) + } + +} + +func protoValuesEquals(t *testing.T, a, b []*types.Value) { + assert.Equal(t, len(a), len(b)) + + for idx, left := range a { + assert.Truef(t, proto.Equal(left, b[idx]), + "Arrays are not equal. Diff[%d] %v != %v", idx, left, b[idx]) + } +} From 167c07ae18ed567ee68f1468652ac1b8b8e51404 Mon Sep 17 00:00:00 2001 From: pyalex Date: Thu, 24 Mar 2022 12:34:10 -0700 Subject: [PATCH 09/10] rename package utils -> types Signed-off-by: pyalex --- go/cmd/server/server.go | 4 +- go/embedded/online_features.go | 12 ++--- go/internal/feast/featurestore.go | 56 +++++++++++----------- go/{utils => types}/typeconversion.go | 2 +- go/{utils => types}/typeconversion_test.go | 2 +- 5 files changed, 38 insertions(+), 38 deletions(-) rename go/{utils => types}/typeconversion.go (99%) rename go/{utils => types}/typeconversion_test.go (99%) diff --git a/go/cmd/server/server.go b/go/cmd/server/server.go index 2a3df80fa4..643ae4059c 100644 --- a/go/cmd/server/server.go +++ b/go/cmd/server/server.go @@ -5,7 +5,7 @@ import ( "github.com/feast-dev/feast/go/internal/feast" "github.com/feast-dev/feast/go/protos/feast/serving" "github.com/feast-dev/feast/go/protos/feast/types" - "github.com/feast-dev/feast/go/utils" + "github.com/feast-dev/feast/go/types" "github.com/golang/protobuf/ptypes/timestamp" ) @@ -63,7 +63,7 @@ func (s *servingServiceServer) GetOnlineFeatures(ctx context.Context, request *s for _, vector := range featureVectors { resp.Metadata.FeatureNames.Val = append(resp.Metadata.FeatureNames.Val, vector.Name) - values, err := utils.ArrowValuesToProtoValues(vector.Values) + values, err := types.ArrowValuesToProtoValues(vector.Values) if err != nil { return nil, err } diff --git a/go/embedded/online_features.go b/go/embedded/online_features.go index c0002b1230..4602538f42 100644 --- a/go/embedded/online_features.go +++ b/go/embedded/online_features.go @@ -6,8 +6,8 @@ import ( "github.com/apache/arrow/go/arrow/array" "github.com/apache/arrow/go/arrow/cdata" "github.com/feast-dev/feast/go/internal/feast" - "github.com/feast-dev/feast/go/protos/feast/types" - "github.com/feast-dev/feast/go/utils" + prototypes "github.com/feast-dev/feast/go/protos/feast/types" + "github.com/feast-dev/feast/go/types" "log" ) @@ -106,16 +106,16 @@ func readArrowRecord(data DataTable) (array.Record, error) { cdata.SchemaFromPtr(data.SchemaPtr)) } -func recordToProto(rec array.Record) (map[string]*types.RepeatedValue, error) { - r := make(map[string]*types.RepeatedValue) +func recordToProto(rec array.Record) (map[string]*prototypes.RepeatedValue, error) { + r := make(map[string]*prototypes.RepeatedValue) schema := rec.Schema() for idx, column := range rec.Columns() { field := schema.Field(idx) - values, err := utils.ArrowValuesToProtoValues(column) + values, err := types.ArrowValuesToProtoValues(column) if err != nil { return nil, err } - r[field.Name] = &types.RepeatedValue{Val: values} + r[field.Name] = &prototypes.RepeatedValue{Val: values} } return r, nil } diff --git a/go/internal/feast/featurestore.go b/go/internal/feast/featurestore.go index ca55f703dd..c5b3a14eb8 100644 --- a/go/internal/feast/featurestore.go +++ b/go/internal/feast/featurestore.go @@ -11,8 +11,8 @@ import ( "github.com/apache/arrow/go/arrow/array" "github.com/apache/arrow/go/arrow/memory" "github.com/feast-dev/feast/go/protos/feast/serving" - "github.com/feast-dev/feast/go/protos/feast/types" - "github.com/feast-dev/feast/go/utils" + prototypes "github.com/feast-dev/feast/go/protos/feast/types" + "github.com/feast-dev/feast/go/types" "github.com/golang/protobuf/proto" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -67,7 +67,7 @@ type GroupedFeaturesPerEntitySet struct { // full feature references as they supposed to appear in response aliasedFeatureNames []string // Entity set as a list of EntityKeys to pass to OnlineRead - entityKeys []*types.EntityKey + entityKeys []*prototypes.EntityKey // Reversed mapping to project result of retrieval from storage to response indices [][]int } @@ -99,7 +99,7 @@ func (fs *FeatureStore) GetOnlineFeatures( ctx context.Context, featureRefs []string, featureService *FeatureService, - entityProtos map[string]*types.RepeatedValue, + entityProtos map[string]*prototypes.RepeatedValue, fullFeatureNames bool) ([]*FeatureVector, error) { numRows, err := fs.validateEntityValues(entityProtos) @@ -142,8 +142,8 @@ func (fs *FeatureStore) GetOnlineFeatures( // TODO: Add a map that contains provided entities + ODFV schema entities + request schema // to use for ODFV // Remove comments for requestDataFeatures when ODFV is supported - // requestDataFeatures := make(map[string]*types.RepeatedValue) // TODO (Ly): Should be empty now until ODFV and Request FV are supported - mappedEntityProtos := make(map[string]*types.RepeatedValue) + // requestDataFeatures := make(map[string]*prototypes.RepeatedValue) // TODO (Ly): Should be empty now until ODFV and Request FV are supported + mappedEntityProtos := make(map[string]*prototypes.RepeatedValue) for joinKeyOrFeature, vals := range entityProtos { if _, ok := neededRequestODFVFeatures[joinKeyOrFeature]; ok { mappedEntityProtos[joinKeyOrFeature] = vals @@ -185,7 +185,7 @@ func (fs *FeatureStore) GetOnlineFeatures( } if entitylessCase { - dummyEntityColumn := &types.RepeatedValue{Val: make([]*types.Value, numRows)} + dummyEntityColumn := &prototypes.RepeatedValue{Val: make([]*prototypes.Value, numRows)} for index := 0; index < numRows; index++ { dummyEntityColumn.Val[index] = &DUMMY_ENTITY } @@ -204,7 +204,7 @@ func (fs *FeatureStore) GetOnlineFeatures( return nil, err } - vectors, err := fs.transposeResponseIntoColumns(featureData, + vectors, err := fs.transposeFeatureRowsIntoColumns(featureData, groupRef, fvs, arrowMemory, @@ -446,7 +446,7 @@ func (fs *FeatureStore) getEntityMaps(requestedFeatureViews []*featureViewAndRef return entityNameToJoinKeyMap, expectedJoinKeysSet, nil } -func (fs *FeatureStore) validateEntityValues(joinKeyValues map[string]*types.RepeatedValue) (int, error) { +func (fs *FeatureStore) validateEntityValues(joinKeyValues map[string]*prototypes.RepeatedValue) (int, error) { setOfRowLengths := make(map[int]bool) var numRows int for _, col := range joinKeyValues { @@ -531,7 +531,7 @@ func (fs *FeatureStore) getNeededRequestData(requestedRequestFeatureViews []*Req func (fs *FeatureStore) ensureRequestedDataExist(neededRequestData map[string]struct{}, neededRequestFvFeatures map[string]struct{}, - requestDataFeatures map[string]*types.RepeatedValue) error { + requestDataFeatures map[string]*prototypes.RepeatedValue) error { // TODO (Ly): Review: Skip checking even if composite set of // neededRequestData neededRequestFvFeatures is different from // request_data_features but same length? @@ -556,19 +556,19 @@ func (fs *FeatureStore) checkOutsideTtl(featureTimestamp *timestamppb.Timestamp, return currentTimestamp.GetSeconds()-featureTimestamp.GetSeconds() > ttl.Seconds } -func (fs *FeatureStore) readFromOnlineStore(ctx context.Context, entityRows []*types.EntityKey, +func (fs *FeatureStore) readFromOnlineStore(ctx context.Context, entityRows []*prototypes.EntityKey, requestedFeatureViewNames []string, requestedFeatureNames []string, ) ([][]FeatureData, error) { numRows := len(entityRows) - entityRowsValue := make([]types.EntityKey, numRows) + entityRowsValue := make([]prototypes.EntityKey, numRows) for index, entityKey := range entityRows { - entityRowsValue[index] = types.EntityKey{JoinKeys: entityKey.JoinKeys, EntityValues: entityKey.EntityValues} + entityRowsValue[index] = prototypes.EntityKey{JoinKeys: entityKey.JoinKeys, EntityValues: entityKey.EntityValues} } return fs.onlineStore.OnlineRead(ctx, entityRowsValue, requestedFeatureViewNames, requestedFeatureNames) } -func (fs *FeatureStore) transposeResponseIntoColumns(featureData2D [][]FeatureData, +func (fs *FeatureStore) transposeFeatureRowsIntoColumns(featureData2D [][]FeatureData, groupRef *GroupedFeaturesPerEntitySet, fvs map[string]*FeatureView, arrowAllocator memory.Allocator, @@ -576,7 +576,7 @@ func (fs *FeatureStore) transposeResponseIntoColumns(featureData2D [][]FeatureDa numFeatures := len(groupRef.aliasedFeatureNames) - var value *types.Value + var value *prototypes.Value var status serving.FieldStatus var eventTimeStamp *timestamppb.Timestamp var featureData *FeatureData @@ -592,7 +592,7 @@ func (fs *FeatureStore) transposeResponseIntoColumns(featureData2D [][]FeatureDa Timestamps: make([]*timestamppb.Timestamp, numRows), } vectors = append(vectors, currentVector) - protoValues := make([]*types.Value, numRows) + protoValues := make([]*prototypes.Value, numRows) for rowEntityIndex, outputIndexes := range groupRef.indices { if featureData2D[rowEntityIndex] == nil { @@ -604,14 +604,14 @@ func (fs *FeatureStore) transposeResponseIntoColumns(featureData2D [][]FeatureDa eventTimeStamp = ×tamppb.Timestamp{Seconds: featureData.timestamp.Seconds, Nanos: featureData.timestamp.Nanos} featureViewName = featureData.reference.FeatureViewName fv = fvs[featureViewName] - if _, ok := featureData.value.Val.(*types.Value_NullVal); ok { + if _, ok := featureData.value.Val.(*prototypes.Value_NullVal); ok { value = nil status = serving.FieldStatus_NOT_FOUND } else if fs.checkOutsideTtl(eventTimeStamp, timestamppb.Now(), fv.ttl) { - value = &types.Value{Val: featureData.value.Val} + value = &prototypes.Value{Val: featureData.value.Val} status = serving.FieldStatus_OUTSIDE_MAX_AGE } else { - value = &types.Value{Val: featureData.value.Val} + value = &prototypes.Value{Val: featureData.value.Val} status = serving.FieldStatus_PRESENT } } @@ -621,7 +621,7 @@ func (fs *FeatureStore) transposeResponseIntoColumns(featureData2D [][]FeatureDa currentVector.Timestamps[rowIndex] = eventTimeStamp } } - arrowValues, err := utils.ProtoValuesToArrowArray(protoValues, arrowAllocator, numRows) + arrowValues, err := types.ProtoValuesToArrowArray(protoValues, arrowAllocator, numRows) if err != nil { return nil, err } @@ -690,7 +690,7 @@ func (fs *FeatureStore) listEntities(hideDummyEntity bool) ([]*Entity, error) { return entities, nil } -func entityKeysToProtos(joinKeyValues map[string]*types.RepeatedValue) []*types.EntityKey { +func entityKeysToProtos(joinKeyValues map[string]*prototypes.RepeatedValue) []*prototypes.EntityKey { keys := make([]string, len(joinKeyValues)) index := 0 var numRows int @@ -700,11 +700,11 @@ func entityKeysToProtos(joinKeyValues map[string]*types.RepeatedValue) []*types. numRows = len(v.Val) } sort.Strings(keys) - entityKeys := make([]*types.EntityKey, numRows) + entityKeys := make([]*prototypes.EntityKey, numRows) numJoinKeys := len(keys) // Construct each EntityKey object for index = 0; index < numRows; index++ { - entityKeys[index] = &types.EntityKey{JoinKeys: keys, EntityValues: make([]*types.Value, numJoinKeys)} + entityKeys[index] = &prototypes.EntityKey{JoinKeys: keys, EntityValues: make([]*prototypes.Value, numJoinKeys)} } for colIndex, key := range keys { @@ -721,7 +721,7 @@ rows for each requested feature */ func groupFeatureRefs(requestedFeatureViews []*featureViewAndRefs, - joinKeyValues map[string]*types.RepeatedValue, + joinKeyValues map[string]*prototypes.RepeatedValue, entityNameToJoinKeyMap map[string]string, fullFeatureNames bool, ) (map[string]*GroupedFeaturesPerEntitySet, @@ -738,7 +738,7 @@ func groupFeatureRefs(requestedFeatureViews []*featureViewAndRefs, } groupKeyBuilder := make([]string, 0) - joinKeysValuesProjection := make(map[string]*types.RepeatedValue) + joinKeysValuesProjection := make(map[string]*prototypes.RepeatedValue) joinKeyToAliasMap := make(map[string]string) if fv.base.projection != nil && fv.base.projection.joinKeyMap != nil { @@ -804,8 +804,8 @@ func groupFeatureRefs(requestedFeatureViews []*featureViewAndRefs, return groups, nil } -func getUniqueEntityRows(joinKeysProto []*types.EntityKey) ([]*types.EntityKey, [][]int, error) { - uniqueValues := make(map[[sha256.Size]byte]*types.EntityKey, 0) +func getUniqueEntityRows(joinKeysProto []*prototypes.EntityKey) ([]*prototypes.EntityKey, [][]int, error) { + uniqueValues := make(map[[sha256.Size]byte]*prototypes.EntityKey, 0) positions := make(map[[sha256.Size]byte][]int, 0) for index, entityKey := range joinKeysProto { @@ -824,7 +824,7 @@ func getUniqueEntityRows(joinKeysProto []*types.EntityKey) ([]*types.EntityKey, } mappingIndices := make([][]int, len(uniqueValues)) - uniqueEntityRows := make([]*types.EntityKey, 0) + uniqueEntityRows := make([]*prototypes.EntityKey, 0) for rowHash, row := range uniqueValues { nextIdx := len(uniqueEntityRows) diff --git a/go/utils/typeconversion.go b/go/types/typeconversion.go similarity index 99% rename from go/utils/typeconversion.go rename to go/types/typeconversion.go index f81d0ff8f7..1b577c7732 100644 --- a/go/utils/typeconversion.go +++ b/go/types/typeconversion.go @@ -1,4 +1,4 @@ -package utils +package types import ( "fmt" diff --git a/go/utils/typeconversion_test.go b/go/types/typeconversion_test.go similarity index 99% rename from go/utils/typeconversion_test.go rename to go/types/typeconversion_test.go index 084cf816b9..b0f879fa79 100644 --- a/go/utils/typeconversion_test.go +++ b/go/types/typeconversion_test.go @@ -1,4 +1,4 @@ -package utils +package types import ( "github.com/apache/arrow/go/arrow/memory" From 5f97c4b1d2cd38d86ed9c6de6da5322feb225bf3 Mon Sep 17 00:00:00 2001 From: pyalex Date: Thu, 24 Mar 2022 12:41:26 -0700 Subject: [PATCH 10/10] clean up on renaming Signed-off-by: pyalex --- go/cmd/server/server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go/cmd/server/server.go b/go/cmd/server/server.go index 643ae4059c..2f9edb793a 100644 --- a/go/cmd/server/server.go +++ b/go/cmd/server/server.go @@ -4,7 +4,7 @@ import ( "context" "github.com/feast-dev/feast/go/internal/feast" "github.com/feast-dev/feast/go/protos/feast/serving" - "github.com/feast-dev/feast/go/protos/feast/types" + prototypes "github.com/feast-dev/feast/go/protos/feast/types" "github.com/feast-dev/feast/go/types" "github.com/golang/protobuf/ptypes/timestamp" ) @@ -47,7 +47,7 @@ func (s *servingServiceServer) GetOnlineFeatures(ctx context.Context, request *s resp.Metadata.FeatureNames.Val = append(resp.Metadata.FeatureNames.Val, name) vec := &serving.GetOnlineFeaturesResponse_FeatureVector{ - Values: make([]*types.Value, 0), + Values: make([]*prototypes.Value, 0), Statuses: make([]serving.FieldStatus, 0), EventTimestamps: make([]*timestamp.Timestamp, 0), }