Skip to content

spanner: parser should allow JSON_VALUE_ARRAY columns #9556

@wwidner-ch

Description

@wwidner-ch

Client

spanner

Environment

e.g. Alpine Docker on GKE

Go Environment

$ go version
go version go1.21.5 darwin/arm64

$ go env
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/weswidner/Library/Caches/go-build'
GOENV='/Users/weswidner/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/weswidner/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/weswidner/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.21.5/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.21.5/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.5'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/weswidner/code/deproot/src/github.com/CyberhavenInc/dataflow/backend/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/yp/hj3tmk457zz3mt4pby42vmgm0000gn/T/go-build3120587149=/tmp/go-build -gno-record-gcc-switches -fno-common'

Code

e.g.

package main

import (
	"cloud.google.com/go/spanner/spansql"
)

func main() {
	_, err := spansql.ParseDDL("testfile.sql", `ALTER TABLE testtable ADD COLUMN IF NOT EXISTS testcolumn ARRAY<STRING(MAX)> AS (JSON_VALUE_ARRAY(edge, "$.some.json.path")) STORED;`)
	if err != nil {
		panic(err)
	}
}

Expected behavior

Statement with JSON_VALUE_ARRAY should parse without error

Actual behavior

panic: testfile.sql:1.97: got "(" while expecting ")"

Additional context

The funcNames slice in keywords.go needs to be extended to include the JSON extractors listed here.

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the Spanner API.triage meI really want to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions