@@ -340,14 +340,18 @@ namespace {
340
340
else if (option.IsAtom (" join_algo" )) {
341
341
// do nothing
342
342
}
343
- else if (option.IsAtom (" shuffle_lhs_by" ) || option.IsAtom (" shuffle_rhs_by" )) {
344
- // do nothing
345
- }
346
343
else if (option.IsAtom (" compact" )) {
347
344
if (!EnsureTupleSize (*child, 1 , ctx)) {
348
345
return IGraphTransformer::TStatus::Error;
349
346
}
350
347
}
348
+ else if (IsCachedJoinLinkOption (option.Content ())) {
349
+ if (option.IsAtom (" shuffle_lhs_by" ) || option.IsAtom (" shuffle_rhs_by" )) {
350
+ // do nothing
351
+ } else {
352
+ YQL_ENSURE (false , " Cached join link option '" << option.Content () << " ' not handled" );
353
+ }
354
+ }
351
355
else {
352
356
ctx.AddError (TIssue (ctx.GetPosition (option.Pos ()), TStringBuilder () <<
353
357
" Unknown option name: " << option.Content ()));
@@ -787,40 +791,38 @@ IGraphTransformer::TStatus ValidateEquiJoinOptions(TPositionHandle positionHandl
787
791
options.Flatten = true ;
788
792
} else if (optionName == " strict_keys" ) {
789
793
options.StrictKeys = true ;
790
- } else if (optionName == " preferred_sort" ) {
791
- THashSet<TStringBuf> sortBySet;
792
- TVector<TStringBuf> sortBy;
793
- if (!EnsureTupleSize (*child, 2 , ctx)) {
794
- return IGraphTransformer::TStatus::Error;
795
- }
796
- if (!EnsureTupleMinSize (*child->Child (1 ), 1 , ctx)) {
797
- return IGraphTransformer::TStatus::Error;
798
- }
799
- for (auto column : child->Child (1 )->Children ()) {
800
- if (!EnsureAtom (*column, ctx)) {
794
+ } else if (IsCachedJoinOption (optionName)) {
795
+ if (optionName == " preferred_sort" ) {
796
+ THashSet<TStringBuf> sortBySet;
797
+ TVector<TStringBuf> sortBy;
798
+ if (!EnsureTupleSize (*child, 2 , ctx)) {
801
799
return IGraphTransformer::TStatus::Error;
802
800
}
803
- if (!sortBySet.insert (column->Content ()).second ) {
804
- ctx.AddError (TIssue (ctx.GetPosition (column->Pos ()), TStringBuilder () <<
805
- " Duplicated preferred_sort column: " << column->Content ()));
801
+ if (!EnsureTupleMinSize (*child->Child (1 ), 1 , ctx)) {
806
802
return IGraphTransformer::TStatus::Error;
807
803
}
808
- sortBy.push_back (column->Content ());
809
- }
810
- if (!options.PreferredSortSets .insert (sortBy).second ) {
811
- ctx.AddError (TIssue (ctx.GetPosition (child->Child (1 )->Pos ()), TStringBuilder () <<
812
- " Duplicated preferred_sort set: " << JoinSeq (" , " , sortBy)));
804
+ for (auto column : child->Child (1 )->Children ()) {
805
+ if (!EnsureAtom (*column, ctx)) {
806
+ return IGraphTransformer::TStatus::Error;
807
+ }
808
+ if (!sortBySet.insert (column->Content ()).second ) {
809
+ ctx.AddError (TIssue (ctx.GetPosition (column->Pos ()), TStringBuilder () <<
810
+ " Duplicated preferred_sort column: " << column->Content ()));
811
+ return IGraphTransformer::TStatus::Error;
812
+ }
813
+ sortBy.push_back (column->Content ());
814
+ }
815
+ if (!options.PreferredSortSets .insert (sortBy).second ) {
816
+ ctx.AddError (TIssue (ctx.GetPosition (child->Child (1 )->Pos ()), TStringBuilder () <<
817
+ " Duplicated preferred_sort set: " << JoinSeq (" , " , sortBy)));
818
+ }
819
+ } else if (optionName == " cbo_passed" ) {
820
+ // do nothing
821
+ } else if (optionName == " multiple_joins" ) {
822
+ // do nothing
823
+ } else {
824
+ YQL_ENSURE (false , " Cached join option '" << optionName << " ' not handled" );
813
825
}
814
- } else if (optionName == " cbo_passed" ) {
815
- // do nothing
816
- } else if (optionName == " join_algo" ) {
817
- // do nothing
818
- } else if (optionName == " shuffle_lhs_by" || optionName == " shuffle_rhs_by" ) {
819
- // do nothing
820
- } else if (optionName == " multiple_joins" ) {
821
- // do nothing
822
- } else if (optionName == " compact" ) {
823
- options.Compact = true ;
824
826
} else {
825
827
ctx.AddError (TIssue (position, TStringBuilder () <<
826
828
" Unknown option name: " << optionName));
@@ -2004,4 +2006,14 @@ void GatherJoinInputs(const TExprNode::TPtr& expr, const TExprNode& row,
2004
2006
}
2005
2007
}
2006
2008
2009
+ bool IsCachedJoinOption (TStringBuf name) {
2010
+ static THashSet<TStringBuf> CachedJoinOptions = {" preferred_sort" , " cbo_passed" , " multiple_joins" };
2011
+ return CachedJoinOptions.contains (name);
2012
+ }
2013
+
2014
+ bool IsCachedJoinLinkOption (TStringBuf name) {
2015
+ static THashSet<TStringBuf> CachedJoinLinkOptions = {" shuffle_lhs_by" , " shuffle_rhs_by" };
2016
+ return CachedJoinLinkOptions.contains (name);
2017
+ }
2018
+
2007
2019
} // namespace NYql
0 commit comments