Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions test/sql/integration/scalar/function_registration.test
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SELECT COUNT(*)
FROM duckdb_functions()
WHERE database_name = 'example' AND function_type = 'scalar';
----
39
41

query T
SELECT function_name
Expand Down Expand Up @@ -61,6 +61,8 @@ pair_type
random_bytes
random_int
return_secret_value
scale_by_setting
secret_field
smart_format
smart_format
sum_values
Expand Down Expand Up @@ -310,6 +312,30 @@ WHERE database_name = 'example' AND function_name = 'return_secret_value';
----
return_secret_value [] [] VARCHAR CONSISTENT Return a secret's value

# ----------------------------------------------------------------------------
# scale_by_setting — float Setting() parameter (read via get_f64, not visible)
# Parameters: value (DOUBLE) → DOUBLE
# ----------------------------------------------------------------------------

query TTTTTT
SELECT function_name, parameters, parameter_types, return_type, stability, description
FROM duckdb_functions()
WHERE database_name = 'example' AND function_name = 'scale_by_setting';
----
scale_by_setting [value] [DOUBLE] DOUBLE CONSISTENT Scale the input value by the float setting `scale_factor`

# ----------------------------------------------------------------------------
# secret_field — Secret() parameter, looks up individual fields by name
# Parameters: (none) → VARCHAR
# ----------------------------------------------------------------------------

query TTTTTT
SELECT function_name, parameters, parameter_types, return_type, stability, description
FROM duckdb_functions()
WHERE database_name = 'example' AND function_name = 'secret_field';
----
secret_field [] [] VARCHAR CONSISTENT Look up secret fields by name

# ----------------------------------------------------------------------------
# sum_values — Varargs with AnyArrow type and dynamic return type
# Parameters: (none positional), varargs=ANY → ANY
Expand Down Expand Up @@ -358,7 +384,7 @@ SELECT COUNT(*)
FROM duckdb_functions()
WHERE database_name = 'example' AND function_type = 'scalar' AND varargs IS NULL;
----
33
35

# ============================================================================
# Stability
Expand All @@ -379,7 +405,7 @@ SELECT COUNT(*)
FROM duckdb_functions()
WHERE database_name = 'example' AND function_type = 'scalar' AND stability = 'CONSISTENT';
----
37
39

# ============================================================================
# Cleanup
Expand Down
89 changes: 89 additions & 0 deletions test/sql/integration/scalar/numeric_promotion.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# name: test/sql/integration/scalar/numeric_promotion.test
# description: Exercises numeric type promotion across float/unsigned/decimal/mixed-sign inputs
# group: [vgi_integration_scalar]

require-env VGI_TEST_WORKER

require vgi

require httpfs

statement ok
ATTACH 'example' AS example (TYPE vgi, LOCATION '${VGI_TEST_WORKER}');

# ============================================================================
# double(value) — output type is promoted for overflow headroom.
# float32 -> float64 ; unsigned widens ; decimal gains one digit of precision.
# ============================================================================

query T
SELECT typeof(example.double(1.5::REAL));
----
DOUBLE

query I
SELECT example.double(1.5::REAL) = 3.0;
----
true

query T
SELECT typeof(example.double(10::UTINYINT));
----
USMALLINT

query I
SELECT example.double(10::UTINYINT);
----
20

query T
SELECT typeof(example.double(100::UINTEGER));
----
UBIGINT

query T
SELECT typeof(example.double(1.25::DECIMAL(10,2)));
----
DECIMAL(11,2)

query I
SELECT example.double(1.25::DECIMAL(10,2)) = 2.50;
----
true

# ============================================================================
# add_values(a, b) — common numeric type of the two inputs, then promoted.
# mixed-sign integers -> int64 ; same-sign widen ; decimals merge precision/scale.
# ============================================================================

query T
SELECT typeof(example.add_values(2::INTEGER, 3::UINTEGER));
----
BIGINT

query I
SELECT example.add_values(2::INTEGER, 3::UINTEGER);
----
5

query T
SELECT typeof(example.add_values(2::TINYINT, 3::INTEGER));
----
BIGINT

query I
SELECT example.add_values(2::TINYINT, 3::INTEGER);
----
5

# Decimal inputs exercise the decimal branch of the common-type computation. We
# assert only the value, not typeof: the exact result precision/scale of decimal
# addition is implementation-defined and differs between worker backends.

query I
SELECT example.add_values(1.50::DECIMAL(5,2), 2.250::DECIMAL(7,3)) = 3.750;
----
true

statement ok
DETACH example;
44 changes: 44 additions & 0 deletions test/sql/integration/secret/secret_fields.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# name: test/sql/integration/secret/secret_fields.test
# description: Exercises named/positional secret field accessors over a resolved secret
# group: [vgi_integration_secret]

require-env VGI_TEST_WORKER

require vgi

require httpfs

statement ok
ATTACH 'example' AS example (TYPE vgi, LOCATION '${VGI_TEST_WORKER}');

# ============================================================================
# secret_field() looks up a field on a named secret (named_field -> port) and
# the first secret carrying a field of any name (field -> secret_string).
# ============================================================================

statement ok
CREATE SECRET test_secret (TYPE vgi_example, secret_string 'hello_world', api_key 'key-abc-123', port 5432, use_ssl true, timeout 30.5);

query T
SELECT example.secret_field();
----
port=5432;name=hello_world

# Re-create with different values — the accessors reflect the new secret.

statement ok
DROP SECRET test_secret;

statement ok
CREATE SECRET test_secret (TYPE vgi_example, secret_string 'rotated', api_key 'y', port 9999, use_ssl false, timeout 7.0);

query T
SELECT example.secret_field();
----
port=9999;name=rotated

statement ok
DROP SECRET test_secret;

statement ok
DETACH example;
49 changes: 49 additions & 0 deletions test/sql/integration/settings/settings_types.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# name: test/sql/integration/settings/settings_types.test
# description: Validates a float (DOUBLE) setting read via the get_f64 accessor
# group: [vgi_integration_settings]

require-env VGI_TEST_WORKER

require vgi

require httpfs

statement ok
ATTACH 'example' AS example (TYPE vgi, LOCATION '${VGI_TEST_WORKER}');

# The float setting is registered and visible.

query I
SELECT COUNT(*) FROM duckdb_settings() WHERE name = 'scale_factor';
----
1

# scale_by_setting(value) multiplies its input by the DOUBLE setting scale_factor,
# read via Settings::get_f64.

statement ok
SET scale_factor = 2.5;

query I
SELECT example.scale_by_setting(4.0) = 10.0;
----
true

query I
SELECT example.scale_by_setting(value) = 5.0
FROM (VALUES (2.0)) AS t(value);
----
true

# A different float value is reflected on the next call.

statement ok
SET scale_factor = 0.5;

query I
SELECT example.scale_by_setting(10.0) = 5.0;
----
true

statement ok
DETACH example;
69 changes: 69 additions & 0 deletions test/sql/integration/table/filtered_columns_pushdown.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# name: test/sql/integration/table/filtered_columns_pushdown.test
# description: Pushed-filter column introspection — filtered_columns, has_filter_for_column, typed get_column_values_array
# group: [vgi_integration_table]

require-env VGI_TEST_WORKER

require vgi

require httpfs

statement ok
ATTACH 'example' AS example (TYPE vgi, LOCATION '${VGI_TEST_WORKER}');

# filtered_columns_echo(count) reports, per query, which columns the pushed-down
# filters reference (filtered_cols), whether a given column is filtered (has_n /
# has_tag), and the discrete value set resolved for the string column `tag` via
# the typed get_column_values_array accessor (tag_values).

# No filter — nothing is constrained.

query TTTT
SELECT DISTINCT filtered_cols, has_n, has_tag, tag_values
FROM example.filtered_columns_echo(5);
----
(empty) false false (none)

# Discrete IN on a string column — resolved as a typed value set.

query TTTT
SELECT DISTINCT filtered_cols, has_n, has_tag, tag_values
FROM example.filtered_columns_echo(5) WHERE tag IN ('t1','t3');
----
tag false true t1,t3

# Equality on a string column.

query TTTT
SELECT DISTINCT filtered_cols, has_n, has_tag, tag_values
FROM example.filtered_columns_echo(5) WHERE tag = 't2';
----
tag false true t2

# Both columns constrained (AND) — get_column_values_array digs into the AND child.

query TTTT
SELECT DISTINCT filtered_cols, has_n, has_tag, tag_values
FROM example.filtered_columns_echo(5) WHERE n IN (1, 2, 3) AND tag = 't2';
----
n,tag true true t2

# A non-enumerable range filter — column is reported as filtered, but no discrete set.

query TTTT
SELECT DISTINCT filtered_cols, has_n, has_tag, tag_values
FROM example.filtered_columns_echo(5) WHERE n >= 2;
----
n true false (none)

# The pushed filter is also applied to the rows (auto_apply_filters): the string
# IN keeps exactly the matching rows.

query IT
SELECT n, tag FROM example.filtered_columns_echo(5) WHERE tag IN ('t1', 't3') ORDER BY n;
----
1 t1
3 t3

statement ok
DETACH example;
6 changes: 4 additions & 2 deletions test/sql/integration/table/function_registration.test
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ ATTACH 'example' AS example (TYPE vgi, LOCATION '${VGI_TEST_WORKER}');
# see table/time_travel_pushdown.test) +
# 1 typed const-arg / typed-column emit fixture (typed_probe, see
# table/typed_probe.test)
# = 93
# 1 filter-column introspection fixture (filtered_columns_echo, see
# table/filtered_columns_pushdown.test)
# = 94
query I
SELECT COUNT(*)
FROM duckdb_functions()
WHERE database_name = 'example' AND function_type = 'table';
----
93
94

# The 33 pure table functions (no TABLE parameter type)
# Note: make_series appears 5 times (5 overloads), make_pairs appears 3 times,
Expand Down
Loading