@@ -269,6 +269,37 @@ void from_json(const json& j, std::shared_ptr<RowExpression>& p) {
269269}
270270} // namespace facebook::presto::protocol
271271namespace facebook ::presto::protocol {
272+ // Loosly copied this here from NLOHMANN_JSON_SERIALIZE_ENUM()
273+
274+ // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays
275+ static const std::pair<Type, json> Type_enum_table[] =
276+ { // NOLINT: cert-err58-cpp
277+ {Type::INNER, " INNER" },
278+ {Type::LEFT, " LEFT" }};
279+ void to_json (json& j, const Type& e) {
280+ static_assert (std::is_enum<Type>::value, " Type must be an enum!" );
281+ const auto * it = std::find_if (
282+ std::begin (Type_enum_table),
283+ std::end (Type_enum_table),
284+ [e](const std::pair<Type, json>& ej_pair) -> bool {
285+ return ej_pair.first == e;
286+ });
287+ j = ((it != std::end (Type_enum_table)) ? it : std::begin (Type_enum_table))
288+ ->second ;
289+ }
290+ void from_json (const json& j, Type& e) {
291+ static_assert (std::is_enum<Type>::value, " Type must be an enum!" );
292+ const auto * it = std::find_if (
293+ std::begin (Type_enum_table),
294+ std::end (Type_enum_table),
295+ [&j](const std::pair<Type, json>& ej_pair) -> bool {
296+ return ej_pair.second == j;
297+ });
298+ e = ((it != std::end (Type_enum_table)) ? it : std::begin (Type_enum_table))
299+ ->first ;
300+ }
301+ } // namespace facebook::presto::protocol
302+ namespace facebook ::presto::protocol {
272303CallExpression::CallExpression () noexcept {
273304 _type = " call" ;
274305}
@@ -730,6 +761,10 @@ void to_json(json& j, const std::shared_ptr<PlanNode>& p) {
730761 j = *std::static_pointer_cast<SemiJoinNode>(p);
731762 return ;
732763 }
764+ if (type == " .SpatialJoinNode" ) {
765+ j = *std::static_pointer_cast<SpatialJoinNode>(p);
766+ return ;
767+ }
733768 if (type == " .TableScanNode" ) {
734769 j = *std::static_pointer_cast<TableScanNode>(p);
735770 return ;
@@ -898,6 +933,12 @@ void from_json(const json& j, std::shared_ptr<PlanNode>& p) {
898933 p = std::static_pointer_cast<PlanNode>(k);
899934 return ;
900935 }
936+ if (type == " .SpatialJoinNode" ) {
937+ std::shared_ptr<SpatialJoinNode> k = std::make_shared<SpatialJoinNode>();
938+ j.get_to (*k);
939+ p = std::static_pointer_cast<PlanNode>(k);
940+ return ;
941+ }
901942 if (type == " .TableScanNode" ) {
902943 std::shared_ptr<TableScanNode> k = std::make_shared<TableScanNode>();
903944 j.get_to (*k);
@@ -9294,6 +9335,77 @@ void from_json(const json& j, SortedRangeSet& p) {
92949335}
92959336} // namespace facebook::presto::protocol
92969337namespace facebook ::presto::protocol {
9338+ SpatialJoinNode::SpatialJoinNode () noexcept {
9339+ _type = " .SpatialJoinNode" ;
9340+ }
9341+
9342+ void to_json (json& j, const SpatialJoinNode& p) {
9343+ j = json::object ();
9344+ j[" @type" ] = " .SpatialJoinNode" ;
9345+ to_json_key (j, " id" , p.id , " SpatialJoinNode" , " PlanNodeId" , " id" );
9346+ to_json_key (j, " type" , p.type , " SpatialJoinNode" , " Type" , " type" );
9347+ to_json_key (j, " left" , p.left , " SpatialJoinNode" , " PlanNode" , " left" );
9348+ to_json_key (j, " right" , p.right , " SpatialJoinNode" , " PlanNode" , " right" );
9349+ to_json_key (
9350+ j,
9351+ " outputVariables" ,
9352+ p.outputVariables ,
9353+ " SpatialJoinNode" ,
9354+ " List<VariableReferenceExpression>" ,
9355+ " outputVariables" );
9356+ to_json_key (
9357+ j, " filter" , p.filter , " SpatialJoinNode" , " RowExpression" , " filter" );
9358+ to_json_key (
9359+ j,
9360+ " leftPartitionVariable" ,
9361+ p.leftPartitionVariable ,
9362+ " SpatialJoinNode" ,
9363+ " VariableReferenceExpression" ,
9364+ " leftPartitionVariable" );
9365+ to_json_key (
9366+ j,
9367+ " rightPartitionVariable" ,
9368+ p.rightPartitionVariable ,
9369+ " SpatialJoinNode" ,
9370+ " VariableReferenceExpression" ,
9371+ " rightPartitionVariable" );
9372+ to_json_key (j, " kdbTree" , p.kdbTree , " SpatialJoinNode" , " String" , " kdbTree" );
9373+ }
9374+
9375+ void from_json (const json& j, SpatialJoinNode& p) {
9376+ p._type = j[" @type" ];
9377+ from_json_key (j, " id" , p.id , " SpatialJoinNode" , " PlanNodeId" , " id" );
9378+ from_json_key (j, " type" , p.type , " SpatialJoinNode" , " Type" , " type" );
9379+ from_json_key (j, " left" , p.left , " SpatialJoinNode" , " PlanNode" , " left" );
9380+ from_json_key (j, " right" , p.right , " SpatialJoinNode" , " PlanNode" , " right" );
9381+ from_json_key (
9382+ j,
9383+ " outputVariables" ,
9384+ p.outputVariables ,
9385+ " SpatialJoinNode" ,
9386+ " List<VariableReferenceExpression>" ,
9387+ " outputVariables" );
9388+ from_json_key (
9389+ j, " filter" , p.filter , " SpatialJoinNode" , " RowExpression" , " filter" );
9390+ from_json_key (
9391+ j,
9392+ " leftPartitionVariable" ,
9393+ p.leftPartitionVariable ,
9394+ " SpatialJoinNode" ,
9395+ " VariableReferenceExpression" ,
9396+ " leftPartitionVariable" );
9397+ from_json_key (
9398+ j,
9399+ " rightPartitionVariable" ,
9400+ p.rightPartitionVariable ,
9401+ " SpatialJoinNode" ,
9402+ " VariableReferenceExpression" ,
9403+ " rightPartitionVariable" );
9404+ from_json_key (
9405+ j, " kdbTree" , p.kdbTree , " SpatialJoinNode" , " String" , " kdbTree" );
9406+ }
9407+ } // namespace facebook::presto::protocol
9408+ namespace facebook ::presto::protocol {
92979409// Loosly copied this here from NLOHMANN_JSON_SERIALIZE_ENUM()
92989410
92999411// NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays
0 commit comments