@@ -2871,19 +2871,33 @@ CTranslatorDXLToPlStmt::TranslateDXLWindow(
2871
2871
win_frame_leading_dxlnode->GetOperator ())
2872
2872
->ParseDXLFrameBoundary ();
2873
2873
if (lead_boundary_type == EdxlfbUnboundedPreceding)
2874
+ {
2874
2875
window->frameOptions |= FRAMEOPTION_END_UNBOUNDED_PRECEDING;
2876
+ }
2875
2877
if (lead_boundary_type == EdxlfbBoundedPreceding)
2878
+ {
2876
2879
window->frameOptions |= FRAMEOPTION_END_OFFSET_PRECEDING;
2880
+ }
2877
2881
if (lead_boundary_type == EdxlfbCurrentRow)
2882
+ {
2878
2883
window->frameOptions |= FRAMEOPTION_END_CURRENT_ROW;
2884
+ }
2879
2885
if (lead_boundary_type == EdxlfbBoundedFollowing)
2886
+ {
2880
2887
window->frameOptions |= FRAMEOPTION_END_OFFSET_FOLLOWING;
2888
+ }
2881
2889
if (lead_boundary_type == EdxlfbUnboundedFollowing)
2890
+ {
2882
2891
window->frameOptions |= FRAMEOPTION_END_UNBOUNDED_FOLLOWING;
2892
+ }
2883
2893
if (lead_boundary_type == EdxlfbDelayedBoundedPreceding)
2894
+ {
2884
2895
window->frameOptions |= FRAMEOPTION_END_OFFSET_PRECEDING;
2896
+ }
2885
2897
if (lead_boundary_type == EdxlfbDelayedBoundedFollowing)
2898
+ {
2886
2899
window->frameOptions |= FRAMEOPTION_END_OFFSET_FOLLOWING;
2900
+ }
2887
2901
if (0 != win_frame_leading_dxlnode->Arity ())
2888
2902
{
2889
2903
window->endOffset =
@@ -2899,19 +2913,33 @@ CTranslatorDXLToPlStmt::TranslateDXLWindow(
2899
2913
win_frame_trailing_dxlnode->GetOperator ())
2900
2914
->ParseDXLFrameBoundary ();
2901
2915
if (trail_boundary_type == EdxlfbUnboundedPreceding)
2916
+ {
2902
2917
window->frameOptions |= FRAMEOPTION_START_UNBOUNDED_PRECEDING;
2918
+ }
2903
2919
if (trail_boundary_type == EdxlfbBoundedPreceding)
2920
+ {
2904
2921
window->frameOptions |= FRAMEOPTION_START_OFFSET_PRECEDING;
2922
+ }
2905
2923
if (trail_boundary_type == EdxlfbCurrentRow)
2924
+ {
2906
2925
window->frameOptions |= FRAMEOPTION_START_CURRENT_ROW;
2926
+ }
2907
2927
if (trail_boundary_type == EdxlfbBoundedFollowing)
2928
+ {
2908
2929
window->frameOptions |= FRAMEOPTION_START_OFFSET_FOLLOWING;
2930
+ }
2909
2931
if (trail_boundary_type == EdxlfbUnboundedFollowing)
2932
+ {
2910
2933
window->frameOptions |= FRAMEOPTION_START_UNBOUNDED_FOLLOWING;
2934
+ }
2911
2935
if (trail_boundary_type == EdxlfbDelayedBoundedPreceding)
2936
+ {
2912
2937
window->frameOptions |= FRAMEOPTION_START_OFFSET_PRECEDING;
2938
+ }
2913
2939
if (trail_boundary_type == EdxlfbDelayedBoundedFollowing)
2940
+ {
2914
2941
window->frameOptions |= FRAMEOPTION_START_OFFSET_FOLLOWING;
2942
+ }
2915
2943
if (0 != win_frame_trailing_dxlnode->Arity ())
2916
2944
{
2917
2945
window->startOffset =
@@ -2923,7 +2951,9 @@ CTranslatorDXLToPlStmt::TranslateDXLWindow(
2923
2951
child_contexts->Release ();
2924
2952
}
2925
2953
else
2954
+ {
2926
2955
window->frameOptions = FRAMEOPTION_DEFAULTS;
2956
+ }
2927
2957
}
2928
2958
2929
2959
SetParamIds (plan);
@@ -3128,7 +3158,9 @@ ContainsSetReturningFuncOrOp(const CDXLNode *project_list_dxlnode,
3128
3158
{
3129
3159
case EdxlopScalarFuncExpr:
3130
3160
if (CDXLScalarFuncExpr::Cast (op)->ReturnsSet ())
3161
+ {
3131
3162
return true ;
3163
+ }
3132
3164
break ;
3133
3165
case EdxlopScalarOpExpr:
3134
3166
{
@@ -3137,7 +3169,9 @@ ContainsSetReturningFuncOrOp(const CDXLNode *project_list_dxlnode,
3137
3169
const IMDFunction *md_func =
3138
3170
md_accessor->RetrieveFunc (md_sclar_op->FuncMdId ());
3139
3171
if (md_func->ReturnsSet ())
3172
+ {
3140
3173
return true ;
3174
+ }
3141
3175
break ;
3142
3176
}
3143
3177
default :
@@ -3161,16 +3195,24 @@ SanityCheckProjectSetTargetList(List *targetlist)
3161
3195
(IsA (expr, OpExpr) && ((OpExpr *) expr)->opretset ))
3162
3196
{
3163
3197
if (IsA (expr, FuncExpr))
3198
+ {
3164
3199
args = ((FuncExpr *) expr)->args ;
3200
+ }
3165
3201
else
3202
+ {
3166
3203
args = ((OpExpr *) expr)->args ;
3204
+ }
3167
3205
if (gpdb::ExpressionReturnsSet ((Node *) args))
3206
+ {
3168
3207
return false ;
3208
+ }
3169
3209
continue ;
3170
3210
}
3171
3211
3172
3212
if (gpdb::ExpressionReturnsSet ((Node *) expr))
3213
+ {
3173
3214
return false ;
3215
+ }
3174
3216
}
3175
3217
return true ;
3176
3218
}
@@ -3185,9 +3227,11 @@ CTranslatorDXLToPlStmt::TranslateDXLProjectSet(
3185
3227
// GPDB_12_MERGE_FIXME: had we generated a DXLProjectSet in ORCA we wouldn't
3186
3228
// have needed to be defensive here...
3187
3229
if ((*result_dxlnode)[EdxlresultIndexFilter]->Arity () > 0 )
3230
+ {
3188
3231
GPOS_RAISE (
3189
3232
gpdxl::ExmaDXL, gpdxl::ExmiQuery2DXLUnsupportedFeature,
3190
3233
GPOS_WSZ_LIT (" Unsupported one-time filter in ProjectSet node" ));
3234
+ }
3191
3235
3192
3236
// create project set (nee result) plan node
3193
3237
ProjectSet *project_set = MakeNode (ProjectSet);
@@ -3241,9 +3285,11 @@ CTranslatorDXLToPlStmt::TranslateDXLProjectSet(
3241
3285
// double check the targetlist is kosher
3242
3286
// we are only doing this because ORCA didn't do it...
3243
3287
if (!SanityCheckProjectSetTargetList (plan->targetlist ))
3288
+ {
3244
3289
GPOS_RAISE (
3245
3290
gpdxl::ExmaDXL, gpdxl::ExmiQuery2DXLUnsupportedFeature,
3246
3291
GPOS_WSZ_LIT (" Unexpected target list entries in ProjectSet node" ));
3292
+ }
3247
3293
3248
3294
return (Plan *) project_set;
3249
3295
}
@@ -3267,8 +3313,10 @@ CTranslatorDXLToPlStmt::TranslateDXLResult(
3267
3313
// actual result node
3268
3314
if (ContainsSetReturningFuncOrOp ((*result_dxlnode)[EdxlresultIndexProjList],
3269
3315
m_md_accessor))
3316
+ {
3270
3317
return TranslateDXLProjectSet (result_dxlnode, output_context,
3271
3318
ctxt_translation_prev_siblings);
3319
+ }
3272
3320
3273
3321
// create result plan node
3274
3322
Result *result = MakeNode (Result);
@@ -3331,9 +3379,11 @@ CTranslatorDXLToPlStmt::TranslateDXLResult(
3331
3379
// double check the targetlist is kosher
3332
3380
// we are only doing this because ORCA didn't do it...
3333
3381
if (!SanityCheckProjectSetTargetList (plan->targetlist ))
3382
+ {
3334
3383
GPOS_RAISE (
3335
3384
gpdxl::ExmaDXL, gpdxl::ExmiQuery2DXLUnsupportedFeature,
3336
3385
GPOS_WSZ_LIT (" Unexpected target list entries in ProjectSet node" ));
3386
+ }
3337
3387
3338
3388
return (Plan *) result;
3339
3389
}
@@ -3974,9 +4024,11 @@ CTranslatorDXLToPlStmt::TranslateDXLDml(
3974
4024
// partition Oid in the child's target list, but we don't use it for
3975
4025
// anything in GPDB.
3976
4026
if (m_cmd_type == CMD_UPDATE)
4027
+ {
3977
4028
(void ) AddJunkTargetEntryForColId (&dml_target_list, &child_context,
3978
4029
phy_dml_dxlop->ActionColId (),
3979
4030
" DMLAction" );
4031
+ }
3980
4032
3981
4033
if (m_cmd_type == CMD_UPDATE || m_cmd_type == CMD_DELETE)
3982
4034
{
@@ -3987,8 +4039,10 @@ CTranslatorDXLToPlStmt::TranslateDXLDml(
3987
4039
" gp_segment_id" );
3988
4040
}
3989
4041
if (m_cmd_type == CMD_UPDATE && phy_dml_dxlop->IsOidsPreserved ())
4042
+ {
3990
4043
AddJunkTargetEntryForColId (&dml_target_list, &child_context,
3991
4044
phy_dml_dxlop->GetTupleOid (), " oid" );
4045
+ }
3992
4046
3993
4047
// Add a Result node on top of the child plan, to coerce the target
3994
4048
// list to match the exact physical layout of the target table,
@@ -4020,7 +4074,9 @@ CTranslatorDXLToPlStmt::TranslateDXLDml(
4020
4074
4021
4075
// ORCA plans all updates as split updates
4022
4076
if (m_cmd_type == CMD_UPDATE)
4077
+ {
4023
4078
dml->isSplitUpdates = ListMake1Int ((int ) true );
4079
+ }
4024
4080
4025
4081
plan->targetlist = NIL;
4026
4082
plan->plan_node_id = m_dxl_to_plstmt_context->GetNextPlanId ();
0 commit comments