Skip to content

Commit

Permalink
end-to-end-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
priyanshi-yb committed Dec 30, 2024
1 parent f1f30ee commit c93c816
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
},
{
"ObjectType": "TABLE",
"TotalCount": 3,
"InvalidCount": 0,
"ObjectNames": "analytics.metrics, sales.events, sales.orders"
"TotalCount": 4,
"InvalidCount": 1,
"ObjectNames": "sales.json_data, analytics.metrics, sales.events, sales.orders"
},
{
"ObjectType": "VIEW",
"TotalCount": 1,
"InvalidCount": 1,
"TotalCount": 2,
"InvalidCount": 2,
"ObjectNames": "sales.event_analysis_view, sales.employ_depart_view"
}
]
Expand All @@ -42,9 +42,10 @@
"ColocatedTables": [
"sales.orders",
"analytics.metrics",
"sales.events"
"sales.events",
"sales.json_data"
],
"ColocatedReasoning": "Recommended instance type with 4 vCPU and 16 GiB memory could fit 3 objects (3 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 @@ -56,22 +57,39 @@
},
"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(events.event_range) AS all_event_ranges,\n range_intersect_agg(events.event_range) AS overlapping_range,\n lower(range_agg(events.event_range)) AS earliest_start,\n upper(range_agg(events.event_range)) AS latest_end\n FROM sales.events;"
"SqlStatement": "CREATE VIEW sales.event_analysis_view AS\n SELECT range_agg(event_range) AS all_event_ranges,\n range_intersect_agg(event_range) AS overlapping_range,\n lower(range_agg(event_range)) AS earliest_start,\n upper(range_agg(event_range)) AS latest_end\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 data_column text NOT NULL,\n object_column text,\n array_column text,\n scalar_column text,\n unique_keys_column text,\n CONSTRAINT json_data_array_column_check CHECK ((array_column IS JSON ARRAY)),\n CONSTRAINT json_data_data_column_check CHECK ((data_column IS JSON)),\n CONSTRAINT json_data_object_column_check CHECK ((object_column IS JSON OBJECT)),\n CONSTRAINT json_data_scalar_column_check CHECK ((scalar_column IS JSON SCALAR)),\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 Down Expand Up @@ -104,6 +122,20 @@
"ParentTableName": null,
"SizeInBytes": 8192
},
{
"SchemaName": "sales",
"ObjectName": "json_data",
"RowCount": 0,
"ColumnCount": 6,
"Reads": 0,
"Writes": 0,
"ReadsPerSecond": 0,
"WritesPerSecond": 0,
"IsIndex": false,
"ObjectType": "",
"ParentTableName": null,
"SizeInBytes": 0
},
{
"SchemaName": "analytics",
"ObjectName": "metrics",
Expand Down Expand Up @@ -145,6 +177,12 @@
"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 @@ -68,21 +68,21 @@ FROM
sales.events;

-- PG 16 and above feature
-- CREATE TABLE sales.json_data (
-- id SERIAL PRIMARY KEY,
-- data_column TEXT NOT NULL CHECK (data_column IS JSON),
-- object_column TEXT CHECK (object_column IS JSON OBJECT),
-- array_column TEXT CHECK (array_column IS JSON ARRAY),
-- scalar_column TEXT CHECK (scalar_column IS JSON SCALAR),
-- unique_keys_column TEXT CHECK (unique_keys_column IS JSON WITH UNIQUE KEYS)
-- );
CREATE TABLE sales.json_data (
id int PRIMARY KEY,
data_column TEXT NOT NULL CHECK (data_column IS JSON),
object_column TEXT CHECK (object_column IS JSON OBJECT),
array_column TEXT CHECK (array_column IS JSON ARRAY),
scalar_column TEXT CHECK (scalar_column IS JSON SCALAR),
unique_keys_column TEXT CHECK (unique_keys_column IS JSON WITH UNIQUE KEYS)
);

-- INSERT INTO public.json_data (
-- data_column, object_column, array_column, scalar_column, unique_keys_column
-- ) VALUES (
-- '{"key": "value"}',
-- '{"name": "John", "age": 30}',
-- '[1, 2, 3, 4]',
-- '"hello"',
-- '{"uniqueKey1": "value1", "uniqueKey2": "value2"}'
-- );
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 @@ -35,6 +35,6 @@ SELECT range_intersect_agg(event_range) AS intersection_of_ranges
FROM sales.events;

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

0 comments on commit c93c816

Please sign in to comment.