MCPcopy Create free account
hub / github.com/rilldata/rill / createTableFunction

Function createTableFunction

runtime/pkg/duckdbsql/ast_rewrite.go:118–158  ·  view source on GitHub ↗
(name string, paths []string, props map[string]any, ast astNode)

Source from the content-addressed store, hash-verified

116}
117
118func createTableFunction(name string, paths []string, props map[string]any, ast astNode) (astNode, error) {
119 var n astNode
120 err := json.Unmarshal([]byte(fmt.Sprintf(`{
121 "type": "TABLE_FUNCTION",
122 "alias": "%s",
123 "sample": null,
124 "function": {},
125 "column_name_alias": []
126}`, toString(ast, astKeyAlias))), &n)
127 if err != nil {
128 return nil, err
129 }
130
131 fn, err := createFunctionCall("", name, "")
132 if err != nil {
133 return nil, err
134 }
135 n[astKeyFunction] = fn
136
137 pa, err := createListValue[string]("", paths)
138 if err != nil {
139 return nil, err
140 }
141 // create the list of args with the 1st arg being the list of path
142 args := []astNode{pa}
143
144 for k, v := range props {
145 vn, err := createKeyedFunctionArg(k, v)
146 if err != nil {
147 return nil, err
148 }
149 if vn == nil {
150 continue
151 }
152 args = append(args, vn)
153 }
154
155 fn[astKeyChildren] = args
156
157 return n, nil
158}
159
160// TODO: offsets
161func createConstantLimit(limit int) (astNode, error) {

Callers 1

Calls 3

toStringFunction · 0.85
createFunctionCallFunction · 0.85
createKeyedFunctionArgFunction · 0.85

Tested by

no test coverage detected