singlestoredb 1.12.4__py3-none-any.whl → 1.13.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of singlestoredb might be problematic. Click here for more details.

Files changed (35) hide show
  1. singlestoredb/__init__.py +1 -1
  2. singlestoredb/ai/__init__.py +1 -0
  3. singlestoredb/ai/chat.py +26 -0
  4. singlestoredb/ai/embeddings.py +18 -15
  5. singlestoredb/apps/__init__.py +1 -0
  6. singlestoredb/apps/_config.py +6 -0
  7. singlestoredb/apps/_connection_info.py +8 -0
  8. singlestoredb/apps/_python_udfs.py +85 -0
  9. singlestoredb/config.py +14 -2
  10. singlestoredb/functions/__init__.py +15 -1
  11. singlestoredb/functions/decorator.py +102 -252
  12. singlestoredb/functions/dtypes.py +545 -198
  13. singlestoredb/functions/ext/asgi.py +421 -129
  14. singlestoredb/functions/ext/json.py +29 -36
  15. singlestoredb/functions/ext/mmap.py +1 -1
  16. singlestoredb/functions/ext/rowdat_1.py +50 -70
  17. singlestoredb/functions/signature.py +816 -144
  18. singlestoredb/functions/typing.py +41 -0
  19. singlestoredb/functions/utils.py +421 -0
  20. singlestoredb/http/connection.py +3 -1
  21. singlestoredb/management/inference_api.py +101 -0
  22. singlestoredb/management/manager.py +6 -1
  23. singlestoredb/management/organization.py +17 -0
  24. singlestoredb/management/utils.py +2 -2
  25. singlestoredb/tests/ext_funcs/__init__.py +476 -237
  26. singlestoredb/tests/test_ext_func.py +192 -3
  27. singlestoredb/tests/test_management.py +5 -5
  28. singlestoredb/tests/test_udf.py +101 -131
  29. singlestoredb/tests/test_udf_returns.py +459 -0
  30. {singlestoredb-1.12.4.dist-info → singlestoredb-1.13.1.dist-info}/METADATA +2 -1
  31. {singlestoredb-1.12.4.dist-info → singlestoredb-1.13.1.dist-info}/RECORD +35 -29
  32. {singlestoredb-1.12.4.dist-info → singlestoredb-1.13.1.dist-info}/LICENSE +0 -0
  33. {singlestoredb-1.12.4.dist-info → singlestoredb-1.13.1.dist-info}/WHEEL +0 -0
  34. {singlestoredb-1.12.4.dist-info → singlestoredb-1.13.1.dist-info}/entry_points.txt +0 -0
  35. {singlestoredb-1.12.4.dist-info → singlestoredb-1.13.1.dist-info}/top_level.txt +0 -0
@@ -16,7 +16,7 @@ import pydantic
16
16
 
17
17
  from ..functions import dtypes as dt
18
18
  from ..functions import signature as sig
19
- from ..functions import tvf
19
+ from ..functions import Table
20
20
  from ..functions import udf
21
21
 
22
22
 
@@ -45,7 +45,7 @@ class TestUDF(unittest.TestCase):
45
45
 
46
46
  # NULL return value
47
47
  def foo() -> None: ...
48
- assert to_sql(foo) == '`foo`() RETURNS NULL'
48
+ assert to_sql(foo) == '`foo`() RETURNS TINYINT NULL'
49
49
 
50
50
  # Simple return value
51
51
  def foo() -> int: ...
@@ -101,28 +101,24 @@ class TestUDF(unittest.TestCase):
101
101
  to_sql(foo)
102
102
 
103
103
  # Tuple
104
- def foo() -> Tuple[int, float, str]: ...
105
- assert to_sql(foo) == '`foo`() RETURNS RECORD(`a` BIGINT NOT NULL, ' \
106
- '`b` DOUBLE NOT NULL, ' \
107
- '`c` TEXT NOT NULL) NOT NULL'
104
+ with self.assertRaises(TypeError):
105
+ def foo() -> Tuple[int, float, str]: ...
106
+ to_sql(foo)
108
107
 
109
108
  # Optional tuple
110
- def foo() -> Optional[Tuple[int, float, str]]: ...
111
- assert to_sql(foo) == '`foo`() RETURNS RECORD(`a` BIGINT NOT NULL, ' \
112
- '`b` DOUBLE NOT NULL, ' \
113
- '`c` TEXT NOT NULL) NULL'
109
+ with self.assertRaises(TypeError):
110
+ def foo() -> Optional[Tuple[int, float, str]]: ...
111
+ to_sql(foo)
114
112
 
115
113
  # Optional tuple with optional element
116
- def foo() -> Optional[Tuple[int, float, Optional[str]]]: ...
117
- assert to_sql(foo) == '`foo`() RETURNS RECORD(`a` BIGINT NOT NULL, ' \
118
- '`b` DOUBLE NOT NULL, ' \
119
- '`c` TEXT NULL) NULL'
114
+ with self.assertRaises(TypeError):
115
+ def foo() -> Optional[Tuple[int, float, Optional[str]]]: ...
116
+ to_sql(foo)
120
117
 
121
118
  # Optional tuple with optional union element
122
- def foo() -> Optional[Tuple[int, Optional[Union[float, int]], str]]: ...
123
- assert to_sql(foo) == '`foo`() RETURNS RECORD(`a` BIGINT NOT NULL, ' \
124
- '`b` DOUBLE NULL, ' \
125
- '`c` TEXT NOT NULL) NULL'
119
+ with self.assertRaises(TypeError):
120
+ def foo() -> Optional[Tuple[int, Optional[Union[float, int]], str]]: ...
121
+ to_sql(foo)
126
122
 
127
123
  # Unknown type
128
124
  def foo() -> set: ...
@@ -139,44 +135,44 @@ class TestUDF(unittest.TestCase):
139
135
 
140
136
  # Simple parameter
141
137
  def foo(x: int) -> None: ...
142
- assert to_sql(foo) == '`foo`(`x` BIGINT NOT NULL) RETURNS NULL'
138
+ assert to_sql(foo) == '`foo`(`x` BIGINT NOT NULL) RETURNS TINYINT NULL'
143
139
 
144
140
  # Optional parameter
145
141
  def foo(x: Optional[int]) -> None: ...
146
- assert to_sql(foo) == '`foo`(`x` BIGINT NULL) RETURNS NULL'
142
+ assert to_sql(foo) == '`foo`(`x` BIGINT NULL) RETURNS TINYINT NULL'
147
143
 
148
144
  # Optional parameter
149
145
  def foo(x: Union[int, None]) -> None: ...
150
- assert to_sql(foo) == '`foo`(`x` BIGINT NULL) RETURNS NULL'
146
+ assert to_sql(foo) == '`foo`(`x` BIGINT NULL) RETURNS TINYINT NULL'
151
147
 
152
148
  # Optional multiple parameter types
153
149
  def foo(x: Union[int, float, None]) -> None: ...
154
- assert to_sql(foo) == '`foo`(`x` DOUBLE NULL) RETURNS NULL'
150
+ assert to_sql(foo) == '`foo`(`x` DOUBLE NULL) RETURNS TINYINT NULL'
155
151
 
156
152
  # Optional parameter with custom type
157
153
  def foo(x: Optional[B]) -> None: ...
158
- assert to_sql(foo) == '`foo`(`x` DOUBLE NULL) RETURNS NULL'
154
+ assert to_sql(foo) == '`foo`(`x` DOUBLE NULL) RETURNS TINYINT NULL'
159
155
 
160
156
  # Optional parameter with nested custom type
161
157
  def foo(x: Optional[C]) -> None: ...
162
- assert to_sql(foo) == '`foo`(`x` DOUBLE NULL) RETURNS NULL'
158
+ assert to_sql(foo) == '`foo`(`x` DOUBLE NULL) RETURNS TINYINT NULL'
163
159
 
164
160
  # Optional parameter with collection type
165
161
  def foo(x: Optional[List[str]]) -> None: ...
166
- assert to_sql(foo) == '`foo`(`x` ARRAY(TEXT NOT NULL) NULL) RETURNS NULL'
162
+ assert to_sql(foo) == '`foo`(`x` ARRAY(TEXT NOT NULL) NULL) RETURNS TINYINT NULL'
167
163
 
168
164
  # Optional parameter with nested collection type
169
165
  def foo(x: Optional[List[List[str]]]) -> None: ...
170
166
  assert to_sql(foo) == '`foo`(`x` ARRAY(ARRAY(TEXT NOT NULL) NOT NULL) NULL) ' \
171
- 'RETURNS NULL'
167
+ 'RETURNS TINYINT NULL'
172
168
 
173
169
  # Optional parameter with collection type with nulls
174
170
  def foo(x: Optional[List[Optional[str]]]) -> None: ...
175
- assert to_sql(foo) == '`foo`(`x` ARRAY(TEXT NULL) NULL) RETURNS NULL'
171
+ assert to_sql(foo) == '`foo`(`x` ARRAY(TEXT NULL) NULL) RETURNS TINYINT NULL'
176
172
 
177
173
  # Custom type with bound
178
174
  def foo(x: D) -> None: ...
179
- assert to_sql(foo) == '`foo`(`x` TEXT NOT NULL) RETURNS NULL'
175
+ assert to_sql(foo) == '`foo`(`x` TEXT NOT NULL) RETURNS TINYINT NULL'
180
176
 
181
177
  # Incompatible types
182
178
  def foo(x: Union[int, str]) -> None: ...
@@ -184,22 +180,21 @@ class TestUDF(unittest.TestCase):
184
180
  to_sql(foo)
185
181
 
186
182
  # Tuple
187
- def foo(x: Tuple[int, float, str]) -> None: ...
188
- assert to_sql(foo) == '`foo`(`x` RECORD(`a` BIGINT NOT NULL, ' \
189
- '`b` DOUBLE NOT NULL, ' \
190
- '`c` TEXT NOT NULL) NOT NULL) RETURNS NULL'
183
+ with self.assertRaises(TypeError):
184
+ def foo(x: Tuple[int, float, str]) -> None: ...
185
+ to_sql(foo)
191
186
 
192
187
  # Optional tuple with optional element
193
- def foo(x: Optional[Tuple[int, float, Optional[str]]]) -> None: ...
194
- assert to_sql(foo) == '`foo`(`x` RECORD(`a` BIGINT NOT NULL, ' \
195
- '`b` DOUBLE NOT NULL, ' \
196
- '`c` TEXT NULL) NULL) RETURNS NULL'
188
+ with self.assertRaises(TypeError):
189
+ def foo(x: Optional[Tuple[int, float, Optional[str]]]) -> None: ...
190
+ to_sql(foo)
197
191
 
198
192
  # Optional tuple with optional union element
199
- def foo(x: Optional[Tuple[int, Optional[Union[float, int]], str]]) -> None: ...
200
- assert to_sql(foo) == '`foo`(`x` RECORD(`a` BIGINT NOT NULL, ' \
201
- '`b` DOUBLE NULL, ' \
202
- '`c` TEXT NOT NULL) NULL) RETURNS NULL'
193
+ with self.assertRaises(TypeError):
194
+ def foo(
195
+ x: Optional[Tuple[int, Optional[Union[float, int]], str]],
196
+ ) -> None: ...
197
+ to_sql(foo)
203
198
 
204
199
  # Unknown type
205
200
  def foo(x: set) -> None: ...
@@ -211,15 +206,15 @@ class TestUDF(unittest.TestCase):
211
206
 
212
207
  # Datetime
213
208
  def foo(x: datetime.datetime) -> None: ...
214
- assert to_sql(foo) == '`foo`(`x` DATETIME NOT NULL) RETURNS NULL'
209
+ assert to_sql(foo) == '`foo`(`x` DATETIME NOT NULL) RETURNS TINYINT NULL'
215
210
 
216
211
  # Date
217
212
  def foo(x: datetime.date) -> None: ...
218
- assert to_sql(foo) == '`foo`(`x` DATE NOT NULL) RETURNS NULL'
213
+ assert to_sql(foo) == '`foo`(`x` DATE NOT NULL) RETURNS TINYINT NULL'
219
214
 
220
215
  # Time
221
216
  def foo(x: datetime.timedelta) -> None: ...
222
- assert to_sql(foo) == '`foo`(`x` TIME NOT NULL) RETURNS NULL'
217
+ assert to_sql(foo) == '`foo`(`x` TIME NOT NULL) RETURNS TINYINT NULL'
223
218
 
224
219
  # Datetime + Date
225
220
  def foo(x: Union[datetime.datetime, datetime.date]) -> None: ...
@@ -231,75 +226,76 @@ class TestUDF(unittest.TestCase):
231
226
  # Ints
232
227
  #
233
228
  def foo(x: int) -> None: ...
234
- assert to_sql(foo) == '`foo`(`x` BIGINT NOT NULL) RETURNS NULL'
229
+ assert to_sql(foo) == '`foo`(`x` BIGINT NOT NULL) RETURNS TINYINT NULL'
235
230
 
236
231
  def foo(x: np.int8) -> None: ...
237
- assert to_sql(foo) == '`foo`(`x` TINYINT NOT NULL) RETURNS NULL'
232
+ assert to_sql(foo) == '`foo`(`x` TINYINT NOT NULL) RETURNS TINYINT NULL'
238
233
 
239
234
  def foo(x: np.int16) -> None: ...
240
- assert to_sql(foo) == '`foo`(`x` SMALLINT NOT NULL) RETURNS NULL'
235
+ assert to_sql(foo) == '`foo`(`x` SMALLINT NOT NULL) RETURNS TINYINT NULL'
241
236
 
242
237
  def foo(x: np.int32) -> None: ...
243
- assert to_sql(foo) == '`foo`(`x` INT NOT NULL) RETURNS NULL'
238
+ assert to_sql(foo) == '`foo`(`x` INT NOT NULL) RETURNS TINYINT NULL'
244
239
 
245
240
  def foo(x: np.int64) -> None: ...
246
- assert to_sql(foo) == '`foo`(`x` BIGINT NOT NULL) RETURNS NULL'
241
+ assert to_sql(foo) == '`foo`(`x` BIGINT NOT NULL) RETURNS TINYINT NULL'
247
242
 
248
243
  #
249
244
  # Unsigned ints
250
245
  #
251
246
  def foo(x: np.uint8) -> None: ...
252
- assert to_sql(foo) == '`foo`(`x` TINYINT UNSIGNED NOT NULL) RETURNS NULL'
247
+ assert to_sql(foo) == '`foo`(`x` TINYINT UNSIGNED NOT NULL) RETURNS TINYINT NULL'
253
248
 
254
249
  def foo(x: np.uint16) -> None: ...
255
- assert to_sql(foo) == '`foo`(`x` SMALLINT UNSIGNED NOT NULL) RETURNS NULL'
250
+ assert to_sql(foo) == '`foo`(`x` SMALLINT UNSIGNED NOT NULL) RETURNS TINYINT NULL'
256
251
 
257
252
  def foo(x: np.uint32) -> None: ...
258
- assert to_sql(foo) == '`foo`(`x` INT UNSIGNED NOT NULL) RETURNS NULL'
253
+ assert to_sql(foo) == '`foo`(`x` INT UNSIGNED NOT NULL) RETURNS TINYINT NULL'
259
254
 
260
255
  def foo(x: np.uint64) -> None: ...
261
- assert to_sql(foo) == '`foo`(`x` BIGINT UNSIGNED NOT NULL) RETURNS NULL'
256
+ assert to_sql(foo) == '`foo`(`x` BIGINT UNSIGNED NOT NULL) RETURNS TINYINT NULL'
262
257
 
263
258
  #
264
259
  # Floats
265
260
  #
266
261
  def foo(x: float) -> None: ...
267
- assert to_sql(foo) == '`foo`(`x` DOUBLE NOT NULL) RETURNS NULL'
262
+ assert to_sql(foo) == '`foo`(`x` DOUBLE NOT NULL) RETURNS TINYINT NULL'
268
263
 
269
264
  def foo(x: np.float32) -> None: ...
270
- assert to_sql(foo) == '`foo`(`x` FLOAT NOT NULL) RETURNS NULL'
265
+ assert to_sql(foo) == '`foo`(`x` FLOAT NOT NULL) RETURNS TINYINT NULL'
271
266
 
272
267
  def foo(x: np.float64) -> None: ...
273
- assert to_sql(foo) == '`foo`(`x` DOUBLE NOT NULL) RETURNS NULL'
268
+ assert to_sql(foo) == '`foo`(`x` DOUBLE NOT NULL) RETURNS TINYINT NULL'
274
269
 
275
270
  #
276
271
  # Type collapsing
277
272
  #
278
273
  def foo(x: Union[np.int8, np.int16]) -> None: ...
279
- assert to_sql(foo) == '`foo`(`x` SMALLINT NOT NULL) RETURNS NULL'
274
+ assert to_sql(foo) == '`foo`(`x` SMALLINT NOT NULL) RETURNS TINYINT NULL'
280
275
 
281
276
  def foo(x: Union[np.int64, np.double]) -> None: ...
282
- assert to_sql(foo) == '`foo`(`x` DOUBLE NOT NULL) RETURNS NULL'
277
+ assert to_sql(foo) == '`foo`(`x` DOUBLE NOT NULL) RETURNS TINYINT NULL'
283
278
 
284
279
  def foo(x: Union[int, float]) -> None: ...
285
- assert to_sql(foo) == '`foo`(`x` DOUBLE NOT NULL) RETURNS NULL'
280
+ assert to_sql(foo) == '`foo`(`x` DOUBLE NOT NULL) RETURNS TINYINT NULL'
286
281
 
287
282
  def test_positional_and_keyword_parameters(self):
288
283
  # Keyword only
289
284
  def foo(x: int = 100) -> None: ...
290
- assert to_sql(foo) == '`foo`(`x` BIGINT NOT NULL DEFAULT 100) RETURNS NULL'
285
+ assert to_sql(foo) == \
286
+ '`foo`(`x` BIGINT NOT NULL DEFAULT 100) RETURNS TINYINT NULL'
291
287
 
292
288
  # Multiple keywords
293
289
  def foo(x: int = 100, y: float = 3.14) -> None: ...
294
290
  assert to_sql(foo) == '`foo`(`x` BIGINT NOT NULL DEFAULT 100, ' \
295
- '`y` DOUBLE NOT NULL DEFAULT 3.14e0) RETURNS NULL'
291
+ '`y` DOUBLE NOT NULL DEFAULT 3.14e0) RETURNS TINYINT NULL'
296
292
 
297
293
  # Keywords and positional
298
294
  def foo(a: str, b: str, x: int = 100, y: float = 3.14) -> None: ...
299
295
  assert to_sql(foo) == '`foo`(`a` TEXT NOT NULL, ' \
300
296
  '`b` TEXT NOT NULL, ' \
301
297
  '`x` BIGINT NOT NULL DEFAULT 100, ' \
302
- '`y` DOUBLE NOT NULL DEFAULT 3.14e0) RETURNS NULL'
298
+ '`y` DOUBLE NOT NULL DEFAULT 3.14e0) RETURNS TINYINT NULL'
303
299
 
304
300
  # Variable positional
305
301
  def foo(*args: int) -> None: ...
@@ -336,9 +332,8 @@ class TestUDF(unittest.TestCase):
336
332
  # Override multiple params with one type
337
333
  @udf(args=dt.SMALLINT(nullable=False))
338
334
  def foo(x: int, y: float, z: np.int8) -> int: ...
339
- assert to_sql(foo) == '`foo`(`x` SMALLINT NOT NULL, ' \
340
- '`y` SMALLINT NOT NULL, ' \
341
- '`z` SMALLINT NOT NULL) RETURNS BIGINT NOT NULL'
335
+ with self.assertRaises(ValueError):
336
+ to_sql(foo)
342
337
 
343
338
  # Override with list
344
339
  @udf(args=[dt.SMALLINT, dt.FLOAT, dt.CHAR(30)])
@@ -350,13 +345,13 @@ class TestUDF(unittest.TestCase):
350
345
  # Override with too short of a list
351
346
  @udf(args=[dt.SMALLINT, dt.FLOAT])
352
347
  def foo(x: int, y: float, z: str) -> int: ...
353
- with self.assertRaises(TypeError):
348
+ with self.assertRaises(ValueError):
354
349
  to_sql(foo)
355
350
 
356
351
  # Override with too long of a list
357
352
  @udf(args=[dt.SMALLINT, dt.FLOAT, dt.CHAR(30), dt.TEXT])
358
353
  def foo(x: int, y: float, z: str) -> int: ...
359
- with self.assertRaises(TypeError):
354
+ with self.assertRaises(ValueError):
360
355
  to_sql(foo)
361
356
 
362
357
  # Override with list
@@ -367,32 +362,10 @@ class TestUDF(unittest.TestCase):
367
362
  '`z` CHAR(30) NULL) RETURNS BIGINT NOT NULL'
368
363
 
369
364
  # Override with dict
370
- @udf(args=dict(x=dt.SMALLINT, z=dt.CHAR(30)))
371
- def foo(x: int, y: float, z: str) -> int: ...
372
- assert to_sql(foo) == '`foo`(`x` SMALLINT NULL, ' \
373
- '`y` DOUBLE NOT NULL, ' \
374
- '`z` CHAR(30) NULL) RETURNS BIGINT NOT NULL'
375
-
376
- # Override with empty dict
377
- @udf(args=dict())
378
- def foo(x: int, y: float, z: str) -> int: ...
379
- assert to_sql(foo) == '`foo`(`x` BIGINT NOT NULL, ' \
380
- '`y` DOUBLE NOT NULL, ' \
381
- '`z` TEXT NOT NULL) RETURNS BIGINT NOT NULL'
382
-
383
- # Override with dict with extra keys
384
- @udf(args=dict(bar=dt.INT))
385
- def foo(x: int, y: float, z: str) -> int: ...
386
- assert to_sql(foo) == '`foo`(`x` BIGINT NOT NULL, ' \
387
- '`y` DOUBLE NOT NULL, ' \
388
- '`z` TEXT NOT NULL) RETURNS BIGINT NOT NULL'
389
-
390
- # Override parameters and return value
391
- @udf(args=dict(x=dt.SMALLINT, z=dt.CHAR(30)), returns=dt.SMALLINT(nullable=False))
392
- def foo(x: int, y: float, z: str) -> int: ...
393
- assert to_sql(foo) == '`foo`(`x` SMALLINT NULL, ' \
394
- '`y` DOUBLE NOT NULL, ' \
395
- '`z` CHAR(30) NULL) RETURNS SMALLINT NOT NULL'
365
+ with self.assertRaises(TypeError):
366
+ @udf(args=dict(x=dt.SMALLINT, z=dt.CHAR(30)))
367
+ def foo(x: int, y: float, z: str) -> int: ...
368
+ assert to_sql(foo)
396
369
 
397
370
  # Change function name
398
371
  @udf(name='hello_world')
@@ -411,26 +384,19 @@ class TestUDF(unittest.TestCase):
411
384
  two: str
412
385
  three: float
413
386
 
414
- @udf
415
- def foo(x: int) -> MyData: ...
416
- assert to_sql(foo) == '`foo`(`x` BIGINT NOT NULL) ' \
417
- 'RETURNS RECORD(`one` BIGINT NULL, `two` TEXT NOT NULL, ' \
418
- '`three` DOUBLE NOT NULL) NOT NULL'
419
-
420
- @udf(returns=MyData)
421
- def foo(x: int) -> Tuple[int, int, int]: ...
422
- assert to_sql(foo) == '`foo`(`x` BIGINT NOT NULL) ' \
423
- 'RETURNS RECORD(`one` BIGINT NULL, `two` TEXT NOT NULL, ' \
424
- '`three` DOUBLE NOT NULL) NOT NULL'
387
+ with self.assertRaises(TypeError):
388
+ @udf
389
+ def foo(x: int) -> MyData: ...
390
+ to_sql(foo)
425
391
 
426
- @tvf
427
- def foo(x: int) -> MyData: ...
392
+ @udf
393
+ def foo(x: int) -> Table[List[MyData]]: ...
428
394
  assert to_sql(foo) == '`foo`(`x` BIGINT NOT NULL) ' \
429
395
  'RETURNS TABLE(`one` BIGINT NULL, `two` TEXT NOT NULL, ' \
430
396
  '`three` DOUBLE NOT NULL)'
431
397
 
432
- @tvf(returns=MyData)
433
- def foo(x: int) -> Tuple[int, int, int]: ...
398
+ @udf(returns=MyData)
399
+ def foo(x: int) -> Table[List[Tuple[int, int, int]]]: ...
434
400
  assert to_sql(foo) == '`foo`(`x` BIGINT NOT NULL) ' \
435
401
  'RETURNS TABLE(`one` BIGINT NULL, `two` TEXT NOT NULL, ' \
436
402
  '`three` DOUBLE NOT NULL)'
@@ -441,25 +407,13 @@ class TestUDF(unittest.TestCase):
441
407
  three: float
442
408
 
443
409
  @udf
444
- def foo(x: int) -> MyData: ...
445
- assert to_sql(foo) == '`foo`(`x` BIGINT NOT NULL) ' \
446
- 'RETURNS RECORD(`one` BIGINT NULL, `two` TEXT NOT NULL, ' \
447
- '`three` DOUBLE NOT NULL) NOT NULL'
448
-
449
- @udf(returns=MyData)
450
- def foo(x: int) -> Tuple[int, int, int]: ...
451
- assert to_sql(foo) == '`foo`(`x` BIGINT NOT NULL) ' \
452
- 'RETURNS RECORD(`one` BIGINT NULL, `two` TEXT NOT NULL, ' \
453
- '`three` DOUBLE NOT NULL) NOT NULL'
454
-
455
- @tvf
456
- def foo(x: int) -> MyData: ...
410
+ def foo(x: int) -> Table[List[MyData]]: ...
457
411
  assert to_sql(foo) == '`foo`(`x` BIGINT NOT NULL) ' \
458
412
  'RETURNS TABLE(`one` BIGINT NULL, `two` TEXT NOT NULL, ' \
459
413
  '`three` DOUBLE NOT NULL)'
460
414
 
461
- @tvf(returns=MyData)
462
- def foo(x: int) -> Tuple[int, int, int]: ...
415
+ @udf(returns=MyData)
416
+ def foo(x: int) -> Table[List[Tuple[int, int, int]]]: ...
463
417
  assert to_sql(foo) == '`foo`(`x` BIGINT NOT NULL) ' \
464
418
  'RETURNS TABLE(`one` BIGINT NULL, `two` TEXT NOT NULL, ' \
465
419
  '`three` DOUBLE NOT NULL)'
@@ -728,12 +682,28 @@ class TestUDF(unittest.TestCase):
728
682
  assert dt.GEOGRAPHY(nullable=False) == 'GEOGRAPHY NOT NULL'
729
683
  assert dt.GEOGRAPHY(default='hi') == "GEOGRAPHY NULL DEFAULT 'hi'"
730
684
 
731
- with self.assertRaises(AssertionError):
732
- dt.RECORD()
733
- assert dt.RECORD(('a', dt.INT), ('b', dt.FLOAT)) == \
734
- 'RECORD(`a` INT NULL, `b` FLOAT NULL) NULL'
735
- assert dt.RECORD(('a', dt.INT), ('b', dt.FLOAT), nullable=False) == \
736
- 'RECORD(`a` INT NULL, `b` FLOAT NULL) NOT NULL'
737
-
738
- assert dt.ARRAY(dt.INT) == 'ARRAY(INT NULL) NULL'
739
- assert dt.ARRAY(dt.INT, nullable=False) == 'ARRAY(INT NULL) NOT NULL'
685
+ # with self.assertRaises(AssertionError):
686
+ # dt.RECORD()
687
+ # assert dt.RECORD(('a', dt.INT), ('b', dt.FLOAT)) == \
688
+ # 'RECORD(`a` INT NULL, `b` FLOAT NULL) NULL'
689
+ # assert dt.RECORD(('a', dt.INT), ('b', dt.FLOAT), nullable=False) == \
690
+ # 'RECORD(`a` INT NULL, `b` FLOAT NULL) NOT NULL'
691
+
692
+ # assert dt.ARRAY(dt.INT) == 'ARRAY(INT NULL) NULL'
693
+ # assert dt.ARRAY(dt.INT, nullable=False) == 'ARRAY(INT NULL) NOT NULL'
694
+
695
+ # assert dt.VECTOR(8) == 'VECTOR(8, F32) NULL'
696
+ # assert dt.VECTOR(8, dt.F32) == 'VECTOR(8, F32) NULL'
697
+ # assert dt.VECTOR(8, dt.F64) == 'VECTOR(8, F64) NULL'
698
+ # assert dt.VECTOR(8, dt.I8) == 'VECTOR(8, I8) NULL'
699
+ # assert dt.VECTOR(8, dt.I16) == 'VECTOR(8, I16) NULL'
700
+ # assert dt.VECTOR(8, dt.I32) == 'VECTOR(8, I32) NULL'
701
+ # assert dt.VECTOR(8, dt.I64) == 'VECTOR(8, I64) NULL'
702
+
703
+ # assert dt.VECTOR(8, nullable=False) == 'VECTOR(8, F32) NOT NULL'
704
+ # assert dt.VECTOR(8, dt.F32, nullable=False) == 'VECTOR(8, F32) NOT NULL'
705
+ # assert dt.VECTOR(8, dt.F64, nullable=False) == 'VECTOR(8, F64) NOT NULL'
706
+ # assert dt.VECTOR(8, dt.I8, nullable=False) == 'VECTOR(8, I8) NOT NULL'
707
+ # assert dt.VECTOR(8, dt.I16, nullable=False) == 'VECTOR(8, I16) NOT NULL'
708
+ # assert dt.VECTOR(8, dt.I32, nullable=False) == 'VECTOR(8, I32) NOT NULL'
709
+ # assert dt.VECTOR(8, dt.I64, nullable=False) == 'VECTOR(8, I64) NOT NULL'