Skip to content

Commit

Permalink
Run pre-push
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-asawicki committed Dec 8, 2024
1 parent b5123b1 commit 086e202
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
1 change: 1 addition & 0 deletions pkg/acceptance/helpers/function_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func (c *FunctionClient) CreateSecure(t *testing.T, arguments ...sdk.DataType) *
}

func (c *FunctionClient) CreateSql(t *testing.T) (*sdk.Function, func()) {
t.Helper()
dataType := testdatatypes.DataTypeFloat
id := c.ids.RandomSchemaObjectIdentifierWithArguments(sdk.LegacyDataTypeFrom(dataType))
return c.CreateSqlWithIdentifierAndArgument(t, id.SchemaObjectId(), dataType)
Expand Down
28 changes: 14 additions & 14 deletions pkg/sdk/functions_ext.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,41 +109,41 @@ func (d *FunctionDetail) setOptionalBoolValueOrError(property string, field **bo
return nil
}

func (s *CreateForJavaFunctionRequest) WithFunctionDefinitionWrapped(FunctionDefinition string) *CreateForJavaFunctionRequest {
s.FunctionDefinition = String(fmt.Sprintf(`$$%s$$`, FunctionDefinition))
func (s *CreateForJavaFunctionRequest) WithFunctionDefinitionWrapped(functionDefinition string) *CreateForJavaFunctionRequest {
s.FunctionDefinition = String(fmt.Sprintf(`$$%s$$`, functionDefinition))
return s
}

func (s *CreateForPythonFunctionRequest) WithFunctionDefinitionWrapped(FunctionDefinition string) *CreateForPythonFunctionRequest {
s.FunctionDefinition = String(fmt.Sprintf(`$$%s$$`, FunctionDefinition))
func (s *CreateForPythonFunctionRequest) WithFunctionDefinitionWrapped(functionDefinition string) *CreateForPythonFunctionRequest {
s.FunctionDefinition = String(fmt.Sprintf(`$$%s$$`, functionDefinition))
return s
}

func (s *CreateForScalaFunctionRequest) WithFunctionDefinitionWrapped(FunctionDefinition string) *CreateForScalaFunctionRequest {
s.FunctionDefinition = String(fmt.Sprintf(`$$%s$$`, FunctionDefinition))
func (s *CreateForScalaFunctionRequest) WithFunctionDefinitionWrapped(functionDefinition string) *CreateForScalaFunctionRequest {
s.FunctionDefinition = String(fmt.Sprintf(`$$%s$$`, functionDefinition))
return s
}

func NewCreateForSQLFunctionRequestDefinitionWrapped(
name SchemaObjectIdentifier,
Returns FunctionReturnsRequest,
FunctionDefinition string,
returns FunctionReturnsRequest,
functionDefinition string,
) *CreateForSQLFunctionRequest {
s := CreateForSQLFunctionRequest{}
s.name = name
s.Returns = Returns
s.FunctionDefinition = fmt.Sprintf(`$$%s$$`, FunctionDefinition)
s.Returns = returns
s.FunctionDefinition = fmt.Sprintf(`$$%s$$`, functionDefinition)
return &s
}

func NewCreateForJavascriptFunctionRequestDefinitionWrapped(
name SchemaObjectIdentifier,
Returns FunctionReturnsRequest,
FunctionDefinition string,
returns FunctionReturnsRequest,
functionDefinition string,
) *CreateForJavascriptFunctionRequest {
s := CreateForJavascriptFunctionRequest{}
s.name = name
s.Returns = Returns
s.FunctionDefinition = fmt.Sprintf(`$$%s$$`, FunctionDefinition)
s.Returns = returns
s.FunctionDefinition = fmt.Sprintf(`$$%s$$`, functionDefinition)
return &s
}
4 changes: 2 additions & 2 deletions pkg/sdk/functions_gen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ func TestFunctions_CreateForScala(t *testing.T) {
opts.ReturnNullValues = ReturnNullValuesPointer(ReturnNullValuesNotNull)
opts.NullInputBehavior = NullInputBehaviorPointer(NullInputBehaviorCalledOnNullInput)
opts.ReturnResultsBehavior = ReturnResultsBehaviorPointer(ReturnResultsBehaviorImmutable)
opts.RuntimeVersion = String("2.0")
opts.RuntimeVersion = "2.0"
opts.Comment = String("comment")
opts.Imports = []FunctionImport{
{
Expand Down Expand Up @@ -859,7 +859,7 @@ func TestFunctions_CreateForScala(t *testing.T) {
opts.ReturnNullValues = ReturnNullValuesPointer(ReturnNullValuesNotNull)
opts.NullInputBehavior = NullInputBehaviorPointer(NullInputBehaviorCalledOnNullInput)
opts.ReturnResultsBehavior = ReturnResultsBehaviorPointer(ReturnResultsBehaviorImmutable)
opts.RuntimeVersion = String("2.0")
opts.RuntimeVersion = "2.0"
opts.Comment = String("comment")
opts.Imports = []FunctionImport{
{
Expand Down
5 changes: 3 additions & 2 deletions pkg/sdk/testint/functions_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func TestInt_Functions(t *testing.T) {
tmpPythonFunction := testClientHelper().CreateSamplePythonFunctionAndModule(t)

assertParametersSet := func(t *testing.T, functionParametersAssert *objectparametersassert.FunctionParametersAssert) {
t.Helper()
assertions.AssertThatObject(t, functionParametersAssert.
HasEnableConsoleOutput(true).
HasLogLevel(sdk.LogLevelWarn).
Expand Down Expand Up @@ -567,7 +568,7 @@ func TestInt_Functions(t *testing.T) {

assertions.AssertThatObject(t, objectassert.FunctionDetails(t, function.ID()).
HasSignature(fmt.Sprintf(`(%s %s)`, argName, dataType.ToLegacyDataTypeSql())).
HasReturns(strings.ReplaceAll(dataType.ToSql(), " ", "")). //TODO [SNOW-1348103]: do we care about this whitespace?
HasReturns(strings.ReplaceAll(dataType.ToSql(), " ", "")). // TODO [SNOW-1348103]: do we care about this whitespace?
HasLanguage("PYTHON").
HasBody(definition).
HasNullHandling(string(sdk.NullInputBehaviorCalledOnNullInput)).
Expand Down Expand Up @@ -1248,7 +1249,7 @@ func TestInt_Functions(t *testing.T) {
HasBody(definition).
HasNullHandlingNil().
// TODO [SNOW-1348103]: volatility is not returned and is present in create syntax
//HasVolatility(string(sdk.ReturnResultsBehaviorImmutable)).
// HasVolatility(string(sdk.ReturnResultsBehaviorImmutable)).
HasVolatilityNil().
HasExternalAccessIntegrationsNil().
HasSecretsNil().
Expand Down

0 comments on commit 086e202

Please sign in to comment.