Skip to content

Commit b6d23c3

Browse files
authored
Merge pull request #24 from goccy/support-templated-argument-func
Support templated function argument type
2 parents eec8087 + cb8d2c4 commit b6d23c3

File tree

10 files changed

+3218
-10
lines changed

10 files changed

+3218
-10
lines changed

Diff for: catalog_test.go

+14-3
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ func TestCatalog(t *testing.T) {
152152
langOpt := zetasql.NewLanguageOptions()
153153
langOpt.SetNameResolutionMode(zetasql.NameResolutionDefault)
154154
langOpt.SetProductMode(types.ProductExternal)
155+
langOpt.SetEnabledLanguageFeatures([]zetasql.LanguageFeature{
156+
zetasql.FeatureTemplateFunctions,
157+
})
155158
langOpt.SetSupportedStatementKinds([]resolved_ast.Kind{resolved_ast.QueryStmt})
156159
opt := zetasql.NewAnalyzerOptions()
157160
opt.SetAllowUndeclaredParameters(true)
@@ -176,14 +179,22 @@ func TestCatalog(t *testing.T) {
176179
types.ScalarMode,
177180
[]*types.FunctionSignature{
178181
types.NewFunctionSignature(
179-
types.NewFunctionArgumentType("", types.StringType()),
180-
nil,
182+
types.NewFunctionArgumentType(
183+
types.StringType(),
184+
types.NewFunctionArgumentTypeOptions(types.RequiredArgumentCardinality),
185+
),
186+
[]*types.FunctionArgumentType{
187+
types.NewTemplatedFunctionArgumentType(
188+
types.ArgTypeAny1,
189+
types.NewFunctionArgumentTypeOptions(types.RequiredArgumentCardinality),
190+
),
191+
},
181192
),
182193
},
183194
),
184195
},
185196
}
186-
query := `SELECT * FROM sample_table WHERE MY_FUNC() = 'foo'`
197+
query := `SELECT * FROM sample_table WHERE MY_FUNC(1.0) = 'foo'`
187198
if _, err := zetasql.AnalyzeStatement(query, catalog, opt); err != nil {
188199
t.Fatal(err)
189200
}

0 commit comments

Comments
 (0)