Skip to content

Commit

Permalink
Per PR feedback, removes NULL/MISSING from Ion-encoded typing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
johnedquinn committed May 20, 2024
1 parent b82ac8c commit 8d5f1f9
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 124 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2446,11 +2446,6 @@ class PlanTyperTestsPorted {
catalog = "pql",
expected = StaticType.INT8
),
SuccessTestCase(
key = PartiQLTest.Key("basics", "case-when-08"),
catalog = "pql",
expected = StaticType.INT,
),
SuccessTestCase(
key = PartiQLTest.Key("basics", "case-when-09"),
catalog = "pql",
Expand Down Expand Up @@ -2638,11 +2633,6 @@ class PlanTyperTestsPorted {
catalog = "pql",
expected = StaticType.INT4
),
SuccessTestCase(
key = PartiQLTest.Key("basics", "nullif-10"),
catalog = "pql",
expected = StaticType.INT4
),
SuccessTestCase(
key = PartiQLTest.Key("basics", "nullif-11"),
catalog = "pql",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,93 +8,49 @@
name: "t_bool",
type: "bool",
},
{
name: "t_bool_nul",
type: "bool",
},
// Exact Numeric
// {
// name: "t_int8",
// type: "int8",
// },
// {
// name: "t_int8_null",
// type: "int8",
// },
{
name: "t_int16",
type: "int16",
},
{
name: "t_int16_null",
type: "int16",
},
{
name: "t_int32",
type: "int32",
},
{
name: "t_int32_null",
type: "int32",
},
{
name: "t_int64",
type: "int64",
},
{
name: "t_int64_null",
type: "int64",
},
{
name: "t_int",
type: "int",
},
{
name: "t_int_null",
type: "int",
},
{
name: "t_decimal",
type: "decimal",
},
{
name: "t_decimal_null",
type: "decimal",
},
// Approximate Numeric
{
name: "t_float32",
type: "float32",
},
{
name: "t_float32_null",
type: "float32",
},
{
name: "t_float64",
type: "float64",
},
{
name: "t_float64_null",
type: "float64",
},
// Strings
{
name: "t_string",
type: "string",
},
{
name: "t_string_null",
type: "string",
},
{
name: "t_clob",
type: "clob",
},
{
name: "t_clob_null",
type: "clob",
},
// collections
{
name: "t_bag",
Expand Down Expand Up @@ -159,10 +115,6 @@
name: "t_num_exact",
type: [ "int16", "int32", "int64", "int", "decimal" ],
},
{
name: "t_num_exact_null",
type: [ "int16", "int32", "int64", "int", "decimal" ],
},
{
name: "t_str",
type: [ "clob", "string" ],
Expand Down
47 changes: 21 additions & 26 deletions partiql-planner/src/testFixtures/resources/inputs/basics/case.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
-- noinspection SqlDialectInspectionForFile

-- noinspection SqlNoDataSourceInspectionForFile

-- -----------------------------
-- Exact Numeric
-- -----------------------------
Expand Down Expand Up @@ -58,25 +62,16 @@ CASE t_item.t_string
ELSE t_item.t_int16 -- cast(.. AS INT8)
END;

--#[case-when-08]
-- type: (int|null)
-- nullable default
CASE t_item.t_string
WHEN 'a' THEN t_item.t_int16 -- cast(.. AS INT)
WHEN 'b' THEN t_item.t_int32 -- cast(.. AS INT)
ELSE t_item.t_int_null -- INT
END;

--#[case-when-09]
-- type: (int|null)
-- type: (int)
CASE t_item.t_string
WHEN 'a' THEN t_item.t_int16_null -- cast(.. AS INT)
WHEN 'a' THEN t_item.t_int16 -- cast(.. AS INT)
WHEN 'b' THEN t_item.t_int32 -- cast(.. AS INT)
ELSE t_item.t_int
END;

--#[case-when-10]
-- type: (decimal|null)
-- type: (decimal)
-- nullable branch
CASE t_item.t_string
WHEN 'a' THEN t_item.t_decimal
Expand All @@ -103,7 +98,7 @@ CASE t_item.t_string
END;

--#[case-when-13]
-- type: (float64|null)
-- type: (float64)
-- nullable branch
CASE t_item.t_string
WHEN 'a' THEN t_item.t_int
Expand All @@ -123,7 +118,7 @@ CASE t_item.t_string
END;

--#[case-when-15]
-- type: (string|null)
-- type: (string)
-- null default
CASE t_item.t_string
WHEN 'a' THEN t_item.t_string
Expand All @@ -139,7 +134,7 @@ CASE t_item.t_string
END;

--#[case-when-17]
-- type: (clob|null)
-- type: (clob)
-- null default
CASE t_item.t_string
WHEN 'a' THEN t_item.t_string
Expand All @@ -152,14 +147,14 @@ END;
-- ----------------------------------

--#[case-when-18]
-- type: (string|null)
-- type: (string)
CASE t_item.t_string
WHEN 'a' THEN NULL
ELSE 'default'
END;

--#[case-when-19]
-- type: (string|null)
-- type: (string)
CASE t_item.t_string
WHEN 'a' THEN NULL
WHEN 'b' THEN NULL
Expand All @@ -169,14 +164,14 @@ CASE t_item.t_string
END;

--#[case-when-20]
-- type: null
-- type: any
-- no default, null anyways
CASE t_item.t_string
WHEN 'a' THEN NULL
END;

--#[case-when-21]
-- type: (string|null)
-- type: (string)
-- no default
CASE t_item.t_string
WHEN 'a' THEN 'ok!'
Expand All @@ -195,7 +190,7 @@ CASE t_item.t_string
END;

--#[case-when-25]
-- type: (int32|int64|string|null)
-- type: (int32|int64|string)
CASE t_item.t_string
WHEN 'a' THEN t_item.t_int32
WHEN 'b' THEN t_item.t_int64
Expand All @@ -204,10 +199,10 @@ CASE t_item.t_string
END;

--#[case-when-26]
-- type: (int32|int64|string|null)
-- type: (int32|int64|string)
CASE t_item.t_string
WHEN 'a' THEN t_item.t_int32
WHEN 'b' THEN t_item.t_int64_null
WHEN 'b' THEN t_item.t_int64
ELSE 'default'
END;

Expand All @@ -220,21 +215,21 @@ CASE t_item.t_string
END;

--#[case-when-28]
-- type: (int16|int32|int64|int|decimal|string|clob|null)
-- type: (int16|int32|int64|int|decimal|string|clob)
CASE t_item.t_string
WHEN 'a' THEN t_item.t_num_exact
WHEN 'b' THEN t_item.t_str
END;

--#[case-when-29]
-- type: (struct_a|struct_b|null)
-- type: (struct_a|struct_b)
CASE t_item.t_string
WHEN 'a' THEN t_item.t_struct_a
WHEN 'b' THEN t_item.t_struct_b
END;

--#[case-when-30]
-- type: missing
-- type: any
CASE t_item.t_string
WHEN 'a' THEN MISSING
WHEN 'b' THEN MISSING
Expand Down Expand Up @@ -272,7 +267,7 @@ END;
--#[case-when-34]
-- type: (any)
CASE t_item.t_string
WHEN 'a' THEN t_item.t_int32_null
WHEN 'a' THEN t_item.t_int32
WHEN 'b' THEN t_item.t_any
ELSE t_item.t_any
END;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ COALESCE(1, 2);
COALESCE(1, 1.23);

--#[coalesce-03]
-- type: (null | decimal)
-- type: (decimal)
COALESCE(NULL, 1, 1.23);

--#[coalesce-04]
-- type: (null | missing | decimal)
-- type: (decimal)
COALESCE(NULL, MISSING, 1, 1.23);

--#[coalesce-05]
-- type: (null | missing | decimal); same as above
-- type: (decimal); same as above
COALESCE(1, 1.23, NULL, MISSING);

--#[coalesce-06]
Expand All @@ -35,31 +35,31 @@ COALESCE(t_item.t_int32, t_item.t_int32);
COALESCE(t_item.t_int64, t_item.t_int32);

--#[coalesce-09]
-- type: (int64 | null)
COALESCE(t_item.t_int64_null, t_item.t_int32, t_item.t_int32_null);
-- type: (int64)
COALESCE(t_item.t_int64, t_item.t_int32, t_item.t_int32);

--#[coalesce-10]
-- type: (int64 | null | missing)
COALESCE(t_item.t_int64_null, t_item.t_int32, t_item.t_int32_null, MISSING);
-- type: (int64)
COALESCE(t_item.t_int64, t_item.t_int32, t_item.t_int32, MISSING);

--#[coalesce-11]
-- type: (int64 | string)
COALESCE(t_item.t_int64, t_item.t_string);

--#[coalesce-12]
-- type: (int64 | null | string)
COALESCE(t_item.t_int64_null, t_item.t_string);
-- type: (int64 | string)
COALESCE(t_item.t_int64, t_item.t_string);

--#[coalesce-13]
-- type: (int16 | int32 | int64 | int | decimal)
COALESCE(t_item.t_num_exact, t_item.t_int32);

--#[coalesce-14]
-- type: (int16 | int32 | int64 | int | decimal, string)
-- type: (int16 | int32 | int64 | int | decimal | string)
COALESCE(t_item.t_num_exact, t_item.t_string);

--#[coalesce-15]
-- type: (int16 | int32 | int64 | int | decimal, string, null)
-- type: (int16 | int32 | int64 | int | decimal | string)
COALESCE(t_item.t_num_exact, t_item.t_string, NULL);

--#[coalesce-16]
Expand Down
Loading

0 comments on commit 8d5f1f9

Please sign in to comment.