Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reporting range aggregate functions and IS JSON predicate clauses #2113

Merged
merged 50 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
56e5ab1
something
priyanshi-yb Dec 18, 2024
0d9261c
Merge branch 'main' into priyanshi/report-json-fn-any_agg-fn
priyanshi-yb Dec 19, 2024
7995ae2
JSON Constructor Functions and AnyValue aggregate function reporting
priyanshi-yb Dec 19, 2024
9785925
JSON_QUERY, JSON_EXISTS, JSON_VALUE reporting
priyanshi-yb Dec 19, 2024
d465efa
Merge branch 'main' into priyanshi/report-json-fn-any_agg-fn
priyanshi-yb Dec 19, 2024
4a0fdf6
fix JSON_QUERY and other by adding pg_query_go v6
priyanshi-yb Dec 20, 2024
2348e26
some fix
priyanshi-yb Dec 20, 2024
3700e44
fix
priyanshi-yb Dec 20, 2024
6a96cdd
fix analyze test
priyanshi-yb Dec 21, 2024
1bb6de4
add function names in details
priyanshi-yb Dec 21, 2024
078a6a1
range agg type funca
priyanshi-yb Dec 21, 2024
5b1fe49
sort function names
priyanshi-yb Dec 21, 2024
d5d2fd7
Merge branch 'priyanshi/report-json-fn-any_agg-fn' into priyanshi/rep…
priyanshi-yb Dec 21, 2024
facaced
add tests for aggregate fns
priyanshi-yb Dec 21, 2024
ea061d7
added json predicate detector and tests
priyanshi-yb Dec 21, 2024
133bf75
add test in yb version test
priyanshi-yb Dec 21, 2024
bac4011
Merge branch 'main' into priyanshi/report-json-fn-any_agg-fn
priyanshi-yb Dec 23, 2024
37f73b9
add gh issue link filed on parser end
priyanshi-yb Dec 23, 2024
31d3d6b
fixed the Docs link of PLPGSQL section to put N/A in case Docs link i…
priyanshi-yb Dec 23, 2024
db5e6e4
Merge branch 'main' into priyanshi/report-json-fn-any_agg-fn
priyanshi-yb Dec 23, 2024
f954155
Added features in assessmigration unsupported feature
priyanshi-yb Dec 23, 2024
8b66a73
added end to end tests for aggregate functions
priyanshi-yb Dec 23, 2024
64b9c02
Merge branch 'priyanshi/report-json-fn-any_agg-fn' into priyanshi/rep…
priyanshi-yb Dec 23, 2024
7144ffb
minor changes
priyanshi-yb Dec 23, 2024
375c546
Not upgarding the PG from 15->16 as there are changes in the way of d…
priyanshi-yb Dec 23, 2024
9c2e2f7
undo expected file changes
priyanshi-yb Dec 23, 2024
84a4a24
review comments
priyanshi-yb Dec 24, 2024
a944ba6
Merge branch 'priyanshi/report-json-fn-any_agg-fn' into priyanshi/rep…
priyanshi-yb Dec 24, 2024
b6f3054
enable tests
priyanshi-yb Dec 24, 2024
f3a8bd4
fix unit test
priyanshi-yb Dec 24, 2024
46b2f66
fix tests
priyanshi-yb Dec 24, 2024
b4b8f54
Merge branch 'main' into priyanshi/report-json-fn-any_agg-fn
priyanshi-yb Dec 24, 2024
734860d
run the testJsonConstr/queryFunc in testDML
priyanshi-yb Dec 24, 2024
d18c0ef
Merge branch 'priyanshi/report-json-fn-any_agg-fn' into priyanshi/rep…
priyanshi-yb Dec 24, 2024
5546fad
run the testAggFunctions in TestDML
priyanshi-yb Dec 24, 2024
1bc41ca
fix merge
priyanshi-yb Dec 24, 2024
b285424
fix testaggfuns - change tbl name
priyanshi-yb Dec 24, 2024
54aaa97
Merge branch 'main' into priyanshi/report-isjson-range-type
priyanshi-yb Dec 24, 2024
bed3120
end-to-end-test aggregate function
priyanshi-yb Dec 24, 2024
df1420d
revert 'enable tests'
priyanshi-yb Dec 24, 2024
8d28862
add feature in assess migration
priyanshi-yb Dec 24, 2024
1116517
added tests in analyze for IS JSON
priyanshi-yb Dec 24, 2024
c87cd8e
added Is json end-to-end-test but commented for now
priyanshi-yb Dec 24, 2024
4183bd9
miss while merging
priyanshi-yb Dec 24, 2024
babfad0
minor miss
priyanshi-yb Dec 25, 2024
f1f30ee
Merge branch 'main' into priyanshi/report-isjson-range-type
priyanshi-yb Dec 30, 2024
c93c816
end-to-end-tests
priyanshi-yb Dec 30, 2024
1d666b1
review comments
priyanshi-yb Jan 3, 2025
29491dd
minor review comments
priyanshi-yb Jan 6, 2025
fccdd99
Merge branch 'main' into priyanshi/report-isjson-range-type
priyanshi-yb Jan 6, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -362,30 +362,39 @@ CREATE TABLE test_udt (
employee_name VARCHAR(100),
home_address address_type,
some_field enum_test,
home_address1 non_public.address_type1
home_address1 non_public.address_type1,
scalar_column TEXT CHECK (scalar_column IS JSON SCALAR)
);

CREATE TABLE test_arr_enum (
id int,
arr text[],
arr_enum enum_test[]
arr_enum enum_test[],
object_column TEXT CHECK (object_column IS JSON OBJECT)
sanyamsinghal marked this conversation as resolved.
Show resolved Hide resolved
);

CREATE TABLE public.locations (
id integer NOT NULL,
name character varying(100),
geom geometry(Point,4326)
geom geometry(Point,4326),
array_column TEXT CHECK (array_column IS JSON ARRAY)
);

CREATE TABLE public.xml_data_example (
id SERIAL PRIMARY KEY,
name VARCHAR(255),
description XML DEFAULT xmlparse(document '<product><name>Default Product</name><price>100.00</price><category>Electronics</category></product>'),
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
unique_keys_column TEXT CHECK (unique_keys_column IS JSON WITH UNIQUE KEYS)
);

CREATE TABLE image (title text, raster lo);

-- IS JSON Predicate
CREATE TABLE public.json_data (
id SERIAL PRIMARY KEY,
data_column TEXT NOT NULL CHECK (data_column IS JSON)
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add separate tables for each of the IS JSON clauses (not even each but at least 2 or three different clauses in different tables)? Currently the tables might just be getting reported due to the first IS JSON clause and the rest seem kind of useless.

CREATE TABLE employees (id INT PRIMARY KEY, salary INT);
-- create table with multirange data types

Expand Down
62 changes: 56 additions & 6 deletions migtests/tests/analyze-schema/expected_issues.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,56 @@
"GH": "",
"MinimumVersionsFixedIn": null
},
{
"IssueType": "unsupported_features",
"ObjectType": "TABLE",
"ObjectName": "public.json_data",
"Reason": "Json Type Predicate",
"SqlStatement": "CREATE TABLE public.json_data (\n id SERIAL PRIMARY KEY,\n data_column TEXT NOT NULL CHECK (data_column IS JSON)\n);",
"Suggestion": "",
"GH": "",
"MinimumVersionsFixedIn": null
},
{
"IssueType": "unsupported_features",
"ObjectType": "TABLE",
"ObjectName": "test_arr_enum",
"Reason": "Json Type Predicate",
"SqlStatement": "CREATE TABLE test_arr_enum (\n\tid int,\n\tarr text[],\n\tarr_enum enum_test[],\n object_column TEXT CHECK (object_column IS JSON OBJECT)\n);",
"Suggestion": "",
"GH": "",
"MinimumVersionsFixedIn": null
},
{
"IssueType": "unsupported_features",
"ObjectType": "TABLE",
"ObjectName": "test_udt",
"Reason": "Json Type Predicate",
"SqlStatement": "CREATE TABLE test_udt (\n\temployee_id SERIAL PRIMARY KEY,\n\temployee_name VARCHAR(100),\n\thome_address address_type,\n\tsome_field enum_test,\n\thome_address1 non_public.address_type1,\n scalar_column TEXT CHECK (scalar_column IS JSON SCALAR)\n);",
"Suggestion": "",
"GH": "",
"MinimumVersionsFixedIn": null
},
{
"IssueType": "unsupported_features",
"ObjectType": "TABLE",
"ObjectName": "public.xml_data_example",
"Reason": "Json Type Predicate",
"SqlStatement": " CREATE TABLE public.xml_data_example (\n id SERIAL PRIMARY KEY,\n name VARCHAR(255),\n description XML DEFAULT xmlparse(document '\u003cproduct\u003e\u003cname\u003eDefault Product\u003c/name\u003e\u003cprice\u003e100.00\u003c/price\u003e\u003ccategory\u003eElectronics\u003c/category\u003e\u003c/product\u003e'),\n created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n unique_keys_column TEXT CHECK (unique_keys_column IS JSON WITH UNIQUE KEYS)\n);",
"Suggestion": "",
"GH": "",
"MinimumVersionsFixedIn": null
},
{
"IssueType": "unsupported_features",
"ObjectType": "TABLE",
"ObjectName": "public.locations",
"Reason": "Json Type Predicate",
"SqlStatement": "CREATE TABLE public.locations (\n id integer NOT NULL,\n name character varying(100),\n geom geometry(Point,4326),\n array_column TEXT CHECK (array_column IS JSON ARRAY)\n );",
"Suggestion": "",
"GH": "",
"MinimumVersionsFixedIn": null
},
{
"IssueType": "unsupported_features",
"ObjectType": "VIEW",
Expand All @@ -55,7 +105,7 @@
"ObjectType": "TABLE",
"ObjectName": "public.xml_data_example",
"Reason": "XML Functions",
"SqlStatement": " CREATE TABLE public.xml_data_example (\n id SERIAL PRIMARY KEY,\n name VARCHAR(255),\n description XML DEFAULT xmlparse(document '\u003cproduct\u003e\u003cname\u003eDefault Product\u003c/name\u003e\u003cprice\u003e100.00\u003c/price\u003e\u003ccategory\u003eElectronics\u003c/category\u003e\u003c/product\u003e'),\n created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP\n);",
"SqlStatement": " CREATE TABLE public.xml_data_example (\n id SERIAL PRIMARY KEY,\n name VARCHAR(255),\n description XML DEFAULT xmlparse(document '\u003cproduct\u003e\u003cname\u003eDefault Product\u003c/name\u003e\u003cprice\u003e100.00\u003c/price\u003e\u003ccategory\u003eElectronics\u003c/category\u003e\u003c/product\u003e'),\n created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n unique_keys_column TEXT CHECK (unique_keys_column IS JSON WITH UNIQUE KEYS)\n);",
"Suggestion": "",
"GH": "",
"DocsLink": "https://docs.yugabyte.com/preview/yugabyte-voyager/known-issues/postgresql/#xml-functions-is-not-yet-supported",
Expand All @@ -66,7 +116,7 @@
"ObjectType": "TABLE",
"ObjectName": "public.xml_data_example",
"Reason": "Unsupported datatype - xml on column - description",
"SqlStatement": " CREATE TABLE public.xml_data_example (\n id SERIAL PRIMARY KEY,\n name VARCHAR(255),\n description XML DEFAULT xmlparse(document '\u003cproduct\u003e\u003cname\u003eDefault Product\u003c/name\u003e\u003cprice\u003e100.00\u003c/price\u003e\u003ccategory\u003eElectronics\u003c/category\u003e\u003c/product\u003e'),\n created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP\n);",
"SqlStatement": " CREATE TABLE public.xml_data_example (\n id SERIAL PRIMARY KEY,\n name VARCHAR(255),\n description XML DEFAULT xmlparse(document '\u003cproduct\u003e\u003cname\u003eDefault Product\u003c/name\u003e\u003cprice\u003e100.00\u003c/price\u003e\u003ccategory\u003eElectronics\u003c/category\u003e\u003c/product\u003e'),\n created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n unique_keys_column TEXT CHECK (unique_keys_column IS JSON WITH UNIQUE KEYS)\n);",
"Suggestion": "Data ingestion is not supported for this type in YugabyteDB so handle this type in different way. Refer link for more details.",
"GH": "https://github.com/yugabyte/yugabyte-db/issues/1043",
"DocsLink": "https://docs.yugabyte.com/preview/yugabyte-voyager/known-issues/postgresql/#data-ingestion-on-xml-data-type-is-not-supported",
Expand Down Expand Up @@ -275,7 +325,7 @@
"ObjectType": "TABLE",
"ObjectName": "test_udt",
"Reason": "Unsupported datatype for Live migration with fall-forward/fallback - address_type on column - home_address",
"SqlStatement": "CREATE TABLE test_udt (\n\temployee_id SERIAL PRIMARY KEY,\n\temployee_name VARCHAR(100),\n\thome_address address_type,\n\tsome_field enum_test,\n\thome_address1 non_public.address_type1\n);",
"SqlStatement": "CREATE TABLE test_udt (\n\temployee_id SERIAL PRIMARY KEY,\n\temployee_name VARCHAR(100),\n\thome_address address_type,\n\tsome_field enum_test,\n\thome_address1 non_public.address_type1,\n scalar_column TEXT CHECK (scalar_column IS JSON SCALAR)\n);",
"Suggestion": "",
"GH": "https://github.com/yugabyte/yb-voyager/issues/1731",
"DocsLink": "https://docs.yugabyte.com/preview/yugabyte-voyager/known-issues/postgresql/#unsupported-datatypes-by-voyager-during-live-migration",
Expand All @@ -286,7 +336,7 @@
"ObjectType": "TABLE",
"ObjectName": "test_arr_enum",
"Reason": "Unsupported datatype for Live migration with fall-forward/fallback - enum_test[] on column - arr_enum",
"SqlStatement": "CREATE TABLE test_arr_enum (\n\tid int,\n\tarr text[],\n\tarr_enum enum_test[]\n);",
"SqlStatement": "CREATE TABLE test_arr_enum (\n\tid int,\n\tarr text[],\n\tarr_enum enum_test[],\n object_column TEXT CHECK (object_column IS JSON OBJECT)\n);",
"Suggestion": "",
"GH": "https://github.com/yugabyte/yb-voyager/issues/1731",
"DocsLink": "https://docs.yugabyte.com/preview/yugabyte-voyager/known-issues/postgresql/#unsupported-datatypes-by-voyager-during-live-migration",
Expand All @@ -297,7 +347,7 @@
"ObjectType": "TABLE",
"ObjectName": "test_udt",
"Reason": "Unsupported datatype for Live migration with fall-forward/fallback - non_public.address_type1 on column - home_address1",
"SqlStatement": "CREATE TABLE test_udt (\n\temployee_id SERIAL PRIMARY KEY,\n\temployee_name VARCHAR(100),\n\thome_address address_type,\n\tsome_field enum_test,\n\thome_address1 non_public.address_type1\n);",
"SqlStatement": "CREATE TABLE test_udt (\n\temployee_id SERIAL PRIMARY KEY,\n\temployee_name VARCHAR(100),\n\thome_address address_type,\n\tsome_field enum_test,\n\thome_address1 non_public.address_type1,\n scalar_column TEXT CHECK (scalar_column IS JSON SCALAR)\n);",
"Suggestion": "",
"GH": "https://github.com/yugabyte/yb-voyager/issues/1731",
"DocsLink": "https://docs.yugabyte.com/preview/yugabyte-voyager/known-issues/postgresql/#unsupported-datatypes-by-voyager-during-live-migration",
Expand Down Expand Up @@ -1212,7 +1262,7 @@
"ObjectType": "TABLE",
"ObjectName": "public.locations",
"Reason": "Unsupported datatype - geometry on column - geom",
"SqlStatement": "CREATE TABLE public.locations (\n id integer NOT NULL,\n name character varying(100),\n geom geometry(Point,4326)\n );",
"SqlStatement": "CREATE TABLE public.locations (\n id integer NOT NULL,\n name character varying(100),\n geom geometry(Point,4326),\n array_column TEXT CHECK (array_column IS JSON ARRAY)\n );",
"Suggestion": "",
"GH": "https://github.com/yugabyte/yugabyte-db/issues/11323",
"DocsLink": "https://docs.yugabyte.com/preview/yugabyte-voyager/known-issues/postgresql/#unsupported-datatypes-by-yugabytedb",
Expand Down
6 changes: 3 additions & 3 deletions migtests/tests/analyze-schema/summary.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
},
{
"ObjectType": "TABLE",
"TotalCount": 58,
"InvalidCount": 49,
"ObjectNames": "employees, image, public.xml_data_example, combined_tbl1, test_arr_enum, public.locations, test_udt, combined_tbl, public.ts_query_table, public.documents, public.citext_type, public.inet_type, public.test_jsonb, test_xml_type, test_xid_type, public.range_columns_partition_test_copy, anydata_test, uritype_test, public.foreign_def_test, test_4, enum_example.bugs, table_abc, anydataset_test, unique_def_test1, test_2, table_1, public.range_columns_partition_test, table_xyz, public.users, test_3, test_5, test_7, foreign_def_test2, unique_def_test, sales_data, table_test, test_interval, test_non_pk_multi_column_list, test_9, test_8, order_details, public.employees4, anytype_test, public.meeting, test_table_in_type_file, sales, test_1, \"Test\", foreign_def_test1, salaries2, test_6, public.pr, bigint_multirange_table, date_multirange_table, int_multirange_table, numeric_multirange_table, timestamp_multirange_table, timestamptz_multirange_table" },
"TotalCount": 59,
"InvalidCount": 50,
"ObjectNames": "public.json_data, employees, image, public.xml_data_example, combined_tbl1, test_arr_enum, public.locations, test_udt, combined_tbl, public.ts_query_table, public.documents, public.citext_type, public.inet_type, public.test_jsonb, test_xml_type, test_xid_type, public.range_columns_partition_test_copy, anydata_test, uritype_test, public.foreign_def_test, test_4, enum_example.bugs, table_abc, anydataset_test, unique_def_test1, test_2, table_1, public.range_columns_partition_test, table_xyz, public.users, test_3, test_5, test_7, foreign_def_test2, unique_def_test, sales_data, table_test, test_interval, test_non_pk_multi_column_list, test_9, test_8, order_details, public.employees4, anytype_test, public.meeting, test_table_in_type_file, sales, test_1, \"Test\", foreign_def_test1, salaries2, test_6, public.pr, bigint_multirange_table, date_multirange_table, int_multirange_table, numeric_multirange_table, timestamp_multirange_table, timestamptz_multirange_table" },

{
"ObjectType": "INDEX",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,27 @@
},
{
"ObjectType": "TABLE",
"TotalCount": 2,
"InvalidCount": 0,
"ObjectNames": "analytics.metrics, sales.orders"
"TotalCount": 4,
"InvalidCount": 1,
"ObjectNames": "sales.json_data, analytics.metrics, sales.events, sales.orders"
},
{
"ObjectType": "VIEW",
"TotalCount": 1,
"InvalidCount": 1,
"ObjectNames": "sales.employ_depart_view"
"TotalCount": 3,
"InvalidCount": 3,
"ObjectNames": "sales.event_analysis_view, sales.event_analysis_view2, sales.employ_depart_view"
}
]
},
"Sizing": {
"SizingRecommendation": {
"ColocatedTables": [
"sales.orders",
"analytics.metrics"
"analytics.metrics",
"sales.events",
"sales.json_data"
],
"ColocatedReasoning": "Recommended instance type with 4 vCPU and 16 GiB memory could fit 2 objects (2 tables/materialized views and 0 explicit/implicit indexes) with 0.00 MB size and throughput requirement of 0 reads/sec and 0 writes/sec as colocated. Non leaf partition tables/indexes and unsupported tables/indexes were not considered.",
"ColocatedReasoning": "Recommended instance type with 4 vCPU and 16 GiB memory could fit 4 objects (4 tables/materialized views and 0 explicit/implicit indexes) with 0.00 MB size and throughput requirement of 0 reads/sec and 0 writes/sec as colocated. Non leaf partition tables/indexes and unsupported tables/indexes were not considered.",
"ShardedTables": null,
"NumNodes": 3,
"VCPUsPerInstance": 4,
Expand All @@ -55,18 +57,43 @@
},
"FailureReasoning": ""
},
"UnsupportedDataTypes": null,
"UnsupportedDataTypes": [
{
"SchemaName": "sales",
"TableName": "event_analysis_view",
"ColumnName": "all_event_ranges",
"DataType": "datemultirange"
}
],
"UnsupportedDataTypesDesc": "Data types of the source database that are not supported on the target YugabyteDB.",
"UnsupportedFeatures": [
{
"FeatureName": "Aggregate Functions",
"Objects": [
{
"ObjectName": "sales.event_analysis_view",
"SqlStatement": "CREATE VIEW sales.event_analysis_view AS\n SELECT range_agg(event_range) AS all_event_ranges\n FROM sales.events;"
},
{
"ObjectName": "sales.event_analysis_view2",
"SqlStatement": "CREATE VIEW sales.event_analysis_view2 AS\n SELECT range_intersect_agg(event_range) AS overlapping_range\n FROM sales.events;"
},
{
"ObjectName": "sales.employ_depart_view",
"SqlStatement": "CREATE VIEW sales.employ_depart_view AS\n SELECT any_value(name) AS any_employee\n FROM public.employees;"
}
],
"MinimumVersionsFixedIn": null
},
{
"FeatureName": "Json Type Predicate",
"Objects": [
{
"ObjectName": "sales.json_data",
"SqlStatement": "CREATE TABLE sales.json_data (\n id integer NOT NULL,\n array_column text,\n unique_keys_column text,\n CONSTRAINT json_data_array_column_check CHECK ((array_column IS JSON ARRAY)),\n CONSTRAINT json_data_unique_keys_column_check CHECK ((unique_keys_column IS JSON WITH UNIQUE KEYS))\n);"
}
],
"MinimumVersionsFixedIn": null
}
],
"UnsupportedFeaturesDesc": "Features of the source database that are not supported on the target YugabyteDB.",
Expand All @@ -85,6 +112,34 @@
"ParentTableName": null,
"SizeInBytes": 8192
},
{
"SchemaName": "sales",
"ObjectName": "events",
"RowCount": 3,
"ColumnCount": 2,
"Reads": 6,
"Writes": 3,
"ReadsPerSecond": 0,
"WritesPerSecond": 0,
"IsIndex": false,
"ObjectType": "",
"ParentTableName": null,
"SizeInBytes": 8192
},
{
"SchemaName": "sales",
"ObjectName": "json_data",
"RowCount": 0,
"ColumnCount": 3,
"Reads": 0,
"Writes": 0,
"ReadsPerSecond": 0,
"WritesPerSecond": 0,
"IsIndex": false,
"ObjectType": "",
"ParentTableName": null,
"SizeInBytes": 0
},
{
"SchemaName": "analytics",
"ObjectName": "metrics",
Expand All @@ -109,11 +164,29 @@
"DocsLink": "https://docs.yugabyte.com/preview/yugabyte-voyager/known-issues/postgresql/#advisory-locks-is-not-yet-implemented",
"MinimumVersionsFixedIn": null
},
{
"ConstructTypeName": "Aggregate Functions",
"Query": "SELECT range_intersect_agg(event_range) AS intersection_of_ranges\nFROM sales.events",
"DocsLink": "",
"MinimumVersionsFixedIn": null
},
{
"ConstructTypeName": "Aggregate Functions",
"Query": "SELECT range_agg(event_range) AS union_of_ranges\nFROM sales.events",
"DocsLink": "",
"MinimumVersionsFixedIn": null
},
{
"ConstructTypeName": "Aggregate Functions",
"Query": "SELECT\n any_value(name) AS any_employee\n FROM employees",
"DocsLink": "",
"MinimumVersionsFixedIn": null
},
{
"ConstructTypeName": "Json Type Predicate",
"Query": "SELECT * \nFROM sales.json_data\nWHERE array_column IS JSON ARRAY",
"DocsLink": "",
"MinimumVersionsFixedIn": null
}
],
"UnsupportedPlPgSqlObjects": null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,44 @@ INSERT INTO analytics.metrics (metric_name, metric_value) VALUES ('ConversionRat

create view sales.employ_depart_view AS SELECT
any_value(name) AS any_employee
FROM employees;
FROM employees;

CREATE TABLE sales.events (
id int PRIMARY KEY,
event_range daterange
);

-- Insert some ranges
INSERT INTO sales.events (id, event_range) VALUES
(1,'[2024-01-01, 2024-01-10]'::daterange),
(2,'[2024-01-05, 2024-01-15]'::daterange),
(3,'[2024-01-20, 2024-01-25]'::daterange);

CREATE VIEW sales.event_analysis_view AS
SELECT
range_agg(event_range) AS all_event_ranges
FROM
sales.events;

CREATE VIEW sales.event_analysis_view2 AS
SELECT
range_intersect_agg(event_range) AS overlapping_range
FROM
sales.events;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, currently the view has multiple unsupported functions. Better to split it into multiple views to ensure that all the function types are getting caught.


-- PG 16 and above feature
CREATE TABLE sales.json_data (
id int PRIMARY KEY,
array_column TEXT CHECK (array_column IS JSON ARRAY),
unique_keys_column TEXT CHECK (unique_keys_column IS JSON WITH UNIQUE KEYS)
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above for this table too.

sanyamsinghal marked this conversation as resolved.
Show resolved Hide resolved

INSERT INTO public.json_data (
id, data_column, object_column, array_column, scalar_column, unique_keys_column
) VALUES (
1, '{"key": "value"}',
2, '{"name": "John", "age": 30}',
3, '[1, 2, 3, 4]',
4, '"hello"',
5, '{"uniqueKey1": "value1", "uniqueKey2": "value2"}'
);
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,16 @@ WHERE metric_value > 0.02;
-- Aggregate functions UQC NOT REPORTING as it need PG16 upgarde in pipeline from PG15
SELECT
any_value(name) AS any_employee
FROM employees;
FROM employees;

--PG15
SELECT range_agg(event_range) AS union_of_ranges
FROM sales.events;

SELECT range_intersect_agg(event_range) AS intersection_of_ranges
FROM sales.events;

-- -- PG 16 and above feature
SELECT *
FROM sales.json_data
WHERE array_column IS JSON ARRAY;
Loading