From b40ee7099e544c7d6762ad0ae6cbba6e07ce3ce7 Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 21 Feb 2024 16:45:02 -0800 Subject: [PATCH 1/2] Add a test around nullability and empty_map types. --- .../textplan/parser/tests/TextPlanParserTest.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/substrait/textplan/parser/tests/TextPlanParserTest.cpp b/src/substrait/textplan/parser/tests/TextPlanParserTest.cpp index 9884f2ea..efe517bd 100644 --- a/src/substrait/textplan/parser/tests/TextPlanParserTest.cpp +++ b/src/substrait/textplan/parser/tests/TextPlanParserTest.cpp @@ -686,6 +686,8 @@ std::vector getTestCases() { R"(project relation literalexamples { expression {42 : "life", 32 : "everything"}_map; expression {}_map; + expression {}_map?; + expression {}_map; })", AsBinaryPlan(EqualsProto<::substrait::proto::Plan>( R"(relations { root { input { project { @@ -696,6 +698,12 @@ std::vector getTestCases() { } } } expressions { literal { empty_map { key { fp32 { nullability: NULLABILITY_REQUIRED } } value { string {nullability: NULLABILITY_REQUIRED } } nullability: NULLABILITY_REQUIRED} } } + } } + expressions { literal { + empty_map { key { fp32 { nullability: NULLABILITY_REQUIRED } } value { string {nullability: NULLABILITY_REQUIRED } } nullability: NULLABILITY_NULLABLE} } } + } } + expressions { literal { + empty_map { key { fp32 { nullability: NULLABILITY_REQUIRED } } value { string {nullability: NULLABILITY_NULLABLE } } nullability: NULLABILITY_REQUIRED} } } } } } })")), }, { From 476fa63e2030d068857055568e3f59a2aeab8540 Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 21 Feb 2024 16:56:31 -0800 Subject: [PATCH 2/2] Fix parentheses in empty_map test. --- src/substrait/textplan/parser/tests/TextPlanParserTest.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/substrait/textplan/parser/tests/TextPlanParserTest.cpp b/src/substrait/textplan/parser/tests/TextPlanParserTest.cpp index efe517bd..ddfe8094 100644 --- a/src/substrait/textplan/parser/tests/TextPlanParserTest.cpp +++ b/src/substrait/textplan/parser/tests/TextPlanParserTest.cpp @@ -698,10 +698,8 @@ std::vector getTestCases() { } } } expressions { literal { empty_map { key { fp32 { nullability: NULLABILITY_REQUIRED } } value { string {nullability: NULLABILITY_REQUIRED } } nullability: NULLABILITY_REQUIRED} } } - } } expressions { literal { empty_map { key { fp32 { nullability: NULLABILITY_REQUIRED } } value { string {nullability: NULLABILITY_REQUIRED } } nullability: NULLABILITY_NULLABLE} } } - } } expressions { literal { empty_map { key { fp32 { nullability: NULLABILITY_REQUIRED } } value { string {nullability: NULLABILITY_NULLABLE } } nullability: NULLABILITY_REQUIRED} } } } } } })")),