Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
create model, create function... all the goodies (#2264)
Browse files Browse the repository at this point in the history
* create function, create/drop model; re-introduced limit; added COPY; var(); corr()

* review feedback
  • Loading branch information
paddyjok committed Apr 4, 2023
1 parent c8c88ab commit 284f62d
Show file tree
Hide file tree
Showing 36 changed files with 4,086 additions and 477 deletions.
3 changes: 2 additions & 1 deletion dax/test/dax/dax_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ func TestDAXIntegration(t *testing.T) {
"testinsert/test-5", // error messages differ
"percentile_test/test-6", // related to TODO in orchestrator.executePercentile
"alterTable/alterTableBadTable", // looks like table does not exist is a different error in DAX
"top-tests/test-1", // don't know why this is failing at all
"top-limit-tests/test-2", // don't know why this is failing at all
"top-limit-tests/test-3", // don't know why this is failing at all
"delete_tests",
"viewtests/drop-view", // drop view does a delete
"viewtests/drop-view-if-exists-after-drop",
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ require (
github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d // indirect
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e // indirect
github.com/tinylib/msgp v1.1.2 // indirect
gonum.org/v1/gonum v0.11.0 // indirect
)

require (
Expand Down Expand Up @@ -197,6 +198,7 @@ require (
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/sajari/regression v1.0.1
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/soheilhy/cmux v0.1.5 // indirect
github.com/spf13/afero v1.6.0 // indirect
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,8 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
github.com/sajari/regression v1.0.1 h1:iTVc6ZACGCkoXC+8NdqH5tIreslDTT/bXxT6OmHR5PE=
github.com/sajari/regression v1.0.1/go.mod h1:NeG/XTW1lYfGY7YV/Z0nYDV/RGh3wxwd1yW46835flM=
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/santhosh-tekuri/jsonschema/v5 v5.0.0/go.mod h1:FKdcjfQW6rpZSnxxUvEA5H/cDPdvJ/SZJQLWWXWGrZ0=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
Expand Down Expand Up @@ -1684,6 +1686,7 @@ golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNq
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.11.0 h1:f1IJhK4Km5tBJmaiJXtk/PkL4cdVX6J+tGiM187uT5E=
gonum.org/v1/gonum v0.11.0/go.mod h1:fSG4YDCxxUZQJ7rKsQrj0gMOg00Il0Z96/qMA4bVQhA=
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=
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
Expand Down
45 changes: 40 additions & 5 deletions sql3/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ const (
ErrUnsupported errors.Code = "ErrUnsupported"
ErrCacheKeyNotFound errors.Code = "ErrCacheKeyNotFound"

ErrDuplicateColumn errors.Code = "ErrDuplicateColumn"
ErrUnknownType errors.Code = "ErrUnknownType"
ErrUnknownIdentifier errors.Code = "ErrUnknownIdentifier"
// syntax/semantic errors
ErrDuplicateColumn errors.Code = "ErrDuplicateColumn"
ErrUnknownType errors.Code = "ErrUnknownType"
ErrUnknownIdentifier errors.Code = "ErrUnknownIdentifier"
ErrTopLimitCannotCoexist errors.Code = "ErrTopLimitCannotCoexist"

// type related errors
ErrTypeIncompatibleWithBitwiseOperator errors.Code = "ErrTypeIncompatibleWithBitwiseOperator"
ErrTypeIncompatibleWithLogicalOperator errors.Code = "ErrTypeIncompatibleWithLogicalOperator"
ErrTypeIncompatibleWithEqualityOperator errors.Code = "ErrTypeIncompatibleWithEqualityOperator"
Expand All @@ -40,8 +43,6 @@ const (
ErrTimeQuantumExpressionExpected errors.Code = "ErrTimeQuantumExpressionExpected"
ErrSingleRowExpected errors.Code = "ErrSingleRowExpected"

// type related errors

// decimal
ErrDecimalScaleExpected errors.Code = "ErrDecimalScaleExpected"

Expand Down Expand Up @@ -94,6 +95,9 @@ const (
ErrViewExists errors.Code = "ErrViewExists"
ErrViewNotFound errors.Code = "ErrViewNotFound"

ErrModelExists errors.Code = "ErrModelExists"
ErrModelNotFound errors.Code = "ErrModelNotFound"

ErrBadColumnConstraint errors.Code = "ErrBadColumnConstraint"
ErrConflictingColumnConstraint errors.Code = "ErrConflictingColumnConstraint"

Expand Down Expand Up @@ -141,6 +145,9 @@ const (
ErrInvalidDatetimePart errors.Code = "ErrInvalidDatetimePart"
ErrOutputValueOutOfRange errors.Code = "ErrOutputValueOutOfRange"
ErrDivideByZero errors.Code = "ErrDivideByZero"

// remote execution
ErrRemoteUnauthorized errors.Code = "ErrRemoteUnauthorized"
)

func NewErrDuplicateColumn(line int, col int, column string) error {
Expand All @@ -164,6 +171,13 @@ func NewErrUnknownIdentifier(line int, col int, ident string) error {
)
}

func NewErrErrTopLimitCannotCoexist(line int, col int) error {
return errors.New(
ErrTopLimitCannotCoexist,
fmt.Sprintf("[%d:%d] TOP and LIMIT cannot cannot be used at the same time (TOP will be deprecated in a future release)", line, col),
)
}

func NewErrInternal(msg string) error {
preamble := "internal error"
_, filename, line, ok := runtime.Caller(1)
Expand Down Expand Up @@ -647,6 +661,20 @@ func NewErrViewExists(line, col int, viewName string) error {
)
}

func NewErrModelNotFound(line, col int, viewName string) error {
return errors.New(
ErrModelNotFound,
fmt.Sprintf("[%d:%d] model '%s' not found", line, col, viewName),
)
}

func NewErrModelExists(line, col int, viewName string) error {
return errors.New(
ErrModelExists,
fmt.Sprintf("[%d:%d] model '%s' already exists", line, col, viewName),
)
}

func NewErrBadColumnConstraint(line, col int, constraint, columnType string) error {
return errors.New(
ErrBadColumnConstraint,
Expand Down Expand Up @@ -876,3 +904,10 @@ func NewErrDivideByZero(line, col int) error {
fmt.Sprintf("[%d:%d] divisor is equal to zero", line, col),
)
}

func NewErrRemoteUnauthorized(line, col int, remoteUrl string) error {
return errors.New(
ErrRemoteUnauthorized,
fmt.Sprintf("unauthorized on remote server '%s'", remoteUrl),
)
}

0 comments on commit 284f62d

Please sign in to comment.