@@ -669,13 +669,13 @@ private List<Attribute> resolveUsingColumns(List<Attribute> cols, List<Attribute
669669 List <Attribute > resolved = new ArrayList <>(cols .size ());
670670 for (Attribute col : cols ) {
671671 if (col instanceof UnresolvedAttribute ua ) {
672- Attribute resolvedCol = maybeResolveAttribute (ua , output );
673- if (resolvedCol instanceof UnresolvedAttribute ucol ) {
672+ Attribute resolvedField = maybeResolveAttribute (ua , output );
673+ if (resolvedField instanceof UnresolvedAttribute ucol ) {
674674 String message = ua .unresolvedMessage ();
675675 String match = "column [" + ucol .name () + "]" ;
676- resolvedCol = ucol .withUnresolvedMessage (message .replace (match , match + " in " + side + " side of join" ));
676+ resolvedField = ucol .withUnresolvedMessage (message .replace (match , match + " in " + side + " side of join" ));
677677 }
678- resolved .add (resolvedCol );
678+ resolved .add (resolvedField );
679679 } else {
680680 throw new IllegalStateException (
681681 "Surprised to discover column [ " + col .name () + "] already resolved when resolving JOIN keys"
@@ -686,16 +686,16 @@ private List<Attribute> resolveUsingColumns(List<Attribute> cols, List<Attribute
686686 }
687687
688688 private LogicalPlan resolveInsist (Insist insist , List <Attribute > childrenOutput , IndexResolution indexResolution ) {
689- Attribute resolvedCol = maybeResolveAttribute (insist .getInsistIdentifier (), childrenOutput );
689+ Attribute resolvedCol = maybeResolveAttribute (insist .attribute (), childrenOutput );
690690 // Field isn't mapped anywhere.
691691 if (resolvedCol instanceof UnresolvedAttribute ) {
692- return pushdownInsist (insist , attrs -> attrs .add (insistKeyword (insist )));
692+ return mergeInsist (insist , attrs -> attrs .add (insistKeyword (insist )));
693693 }
694694
695695 String name = resolvedCol .name ();
696696 // Field is partially unmapped.
697- if (resolvedCol instanceof FieldAttribute f && indexResolution .get ().partiallyUnmappedFields (). contains (name )) {
698- return pushdownInsist (insist , attrs -> {
697+ if (resolvedCol instanceof FieldAttribute f && indexResolution .get ().isPartiallyUnmappedField (name )) {
698+ return mergeInsist (insist , attrs -> {
699699 var index = CollectionUtils .findFirstIndex (attrs , e -> e .name ().equals (name )).getAsInt ();
700700 Attribute attribute = f .field ().getDataType () == KEYWORD ? insistKeyword (insist ) : invalidInsistAttribute (insist , f );
701701 attrs .set (index , attribute );
@@ -706,7 +706,8 @@ private LogicalPlan resolveInsist(Insist insist, List<Attribute> childrenOutput,
706706 return insist .child ();
707707 }
708708
709- private static EsRelation pushdownInsist (Insist insist , Consumer <List <Attribute >> updateAttributes ) {
709+ private static EsRelation mergeInsist (Insist insist , Consumer <List <Attribute >> updateAttributes ) {
710+ assert insist .child () instanceof EsRelation : "INSIST should be on top of a relation (see LogicalPlanBuilder)" ;
710711 var relation = (EsRelation ) insist .child ();
711712 List <Attribute > newOutput = new ArrayList <>(relation .output ());
712713 updateAttributes .accept (newOutput );
@@ -722,7 +723,7 @@ private static UnsupportedAttribute invalidInsistAttribute(Insist insist, FieldA
722723 }
723724
724725 private static FieldAttribute insistKeyword (Insist insist ) {
725- String name = insist .getInsistIdentifier ().name ();
726+ String name = insist .attribute ().name ();
726727 return new FieldAttribute (insist .source (), name , new PotentiallyUnmappedKeywordEsField (name ));
727728 }
728729
0 commit comments