Caused by: org.apache.spark.sql.AnalysisException: Resolved attribute(s) w8apxp_value#542 missing from hxfln8_id#609,4yvfvk_value#314,gs5esz_value#362,eqcg2i_value#416,hxfln8_value#620,oe2w4p_value#475,p0wj6x_value#520,w8apxp_value#375 in operator !Aggregate [w8apxp_value#542], [w8apxp_value#542, CASE WHEN isnull(count(distinct hxfln8_value#620)) THEN 0 ELSE count(distinct hxfln8_value#620) END AS CASE WHEN (count(hxfln8_value) IS NULL) THEN 0 ELSE count(hxfln8_value) END#648L]. Attribute(s) with the same name appear in the operation: w8apxp_value. Please check if the right attribute(s) are used.;;
!Aggregate [w8apxp_value#542], [w8apxp_value#542, CASE WHEN isnull(count(distinct hxfln8_value#620)) THEN 0 ELSE count(distinct hxfln8_value#620) END AS CASE WHEN (count(hxfln8_value) IS NULL) THEN 0 ELSE count(hxfln8_value) END#648L]
+- Project [hxfln8_id#609, 4yvfvk_value#314, gs5esz_value#362, p0wj6x_value#520, oe2w4p_value#475, eqcg2i_value#416, w8apxp_value#375, hxfln8_value#620]
+- Project [gs5esz_id#358, 4yvfvk_value#314, gs5esz_value#362, p0wj6x_value#520, oe2w4p_value#475, eqcg2i_value#416, p0wj6x_id#511, w8apxp_value#375, w8apxp_id#537, hxfln8_id#609, gs5esz_value#362 AS hxfln8_value#620]
+- Project [gs5esz_id#358, 4yvfvk_value#314, gs5esz_value#362, p0wj6x_value#520, oe2w4p_value#475, eqcg2i_value#416, p0wj6x_id#511, w8apxp_value#375, w8apxp_id#537, gs5esz_id#358 AS hxfln8_id#609]
+- Filter p0wj6x_value#520: boolean
+- Join LeftOuter, (p0wj6x_id#511 = w8apxp_id#537)
:- Join LeftOuter, (gs5esz_id#358 = p0wj6x_id#511)
: :- Project [gs5esz_id#358, 4yvfvk_value#314, gs5esz_value#362]
: : +- Project [4yvfvk_id#273, 4yvfvk_value#314, gs5esz_id#358, 4yvfvk_value#314 AS gs5esz_value#362]
: : +- Project [4yvfvk_id#273, 4yvfvk_value#314, 4yvfvk_id#273 AS gs5esz_id#358]
: : +- Project [4yvfvk_id#273, 4yvfvk_value#314]
: : +- Project [id#0, meta#1, implicitRules#2, language#3, text#4, identifier#5, status#6, statusReason#7, intent#8, category#9, priority#10, doNotPerform#11, reportedBoolean#12, reportedReference#13, medicationCodeableConcept#14, medicationReference#15, subject#16, encounter#17, supportingInformation#18, authoredOn#19, requester#20, performer#21, performerType#22, recorder#23, ... 17 more fields]
: : +- Project [id#0, meta#1, implicitRules#2, language#3, text#4, identifier#5, status#6, statusReason#7, intent#8, category#9, priority#10, doNotPerform#11, reportedBoolean#12, reportedReference#13, medicationCodeableConcept#14, medicationReference#15, subject#16, encounter#17, supportingInformation#18, authoredOn#19, requester#20, performer#21, performerType#22, recorder#23, ... 16 more fields]
: : +- Relation[id#0,meta#1,implicitRules#2,language#3,text#4,identifier#5,status#6,statusReason#7,intent#8,category#9,priority#10,doNotPerform#11,reportedBoolean#12,reportedReference#13,medicationCodeableConcept#14,medicationReference#15,subject#16,encounter#17,supportingInformation#18,authoredOn#19,requester#20,performer#21,performerType#22,recorder#23,... 15 more fields] parquet
: +- Project [p0wj6x_value#520, oe2w4p_value#475, eqcg2i_value#416, p0wj6x_id#511, w8apxp_value#375]
: +- Project [p0wj6x_id#511, 4yvfvk_value#314, gs5esz_value#362, w8apxp_value#375, eqcg2i_value#416, oe2w4p_value#475, p0wj6x_value#520]
: +- Project [eqcg2i_id#409, 4yvfvk_value#314, gs5esz_value#362, w8apxp_value#375, eqcg2i_value#416, oe2w4p_value#475, oe2w4p_id#468, p0wj6x_id#511, (eqcg2i_value#416 AND oe2w4p_value#475) AS p0wj6x_value#520]
: +- Project [eqcg2i_id#409, 4yvfvk_value#314, gs5esz_value#362, w8apxp_value#375, eqcg2i_value#416, oe2w4p_value#475, oe2w4p_id#468, eqcg2i_id#409 AS p0wj6x_id#511]
: +- Join LeftOuter, (eqcg2i_id#409 = oe2w4p_id#468)
: :- Project [eqcg2i_id#409, 4yvfvk_value#314, gs5esz_value#362, w8apxp_value#375, eqcg2i_value#416]
: : +- Project [w8apxp_id#370, 4yvfvk_value#314, gs5esz_value#362, w8apxp_value#375, 9re1eq_id#385, eqcg2i_id#409, (to_timestamp(w8apxp_value#375, None) < to_timestamp(17532, None)) AS eqcg2i_value#416]
: : +- Project [w8apxp_id#370, 4yvfvk_value#314, gs5esz_value#362, w8apxp_value#375, 9re1eq_id#385, w8apxp_id#370 AS eqcg2i_id#409]
: : +- Join LeftOuter, (w8apxp_id#370 = 9re1eq_id#385)
: : :- Project [w8apxp_id#370, 4yvfvk_value#314, gs5esz_value#362, w8apxp_value#375]
: : : +- Project [gs5esz_id#358, 4yvfvk_value#314, gs5esz_value#362, w8apxp_id#370, gs5esz_value#362.authoredOn AS w8apxp_value#375]
: : : +- Project [gs5esz_id#358, 4yvfvk_value#314, gs5esz_value#362, gs5esz_id#358 AS w8apxp_id#370]
: : : +- Project [gs5esz_id#358, 4yvfvk_value#314, gs5esz_value#362]
: : : +- Project [4yvfvk_id#273, 4yvfvk_value#314, gs5esz_id#358, 4yvfvk_value#314 AS gs5esz_value#362]
: : : +- Project [4yvfvk_id#273, 4yvfvk_value#314, 4yvfvk_id#273 AS gs5esz_id#358]
: : : +- Project [4yvfvk_id#273, 4yvfvk_value#314]
: : : +- Project [id#0, meta#1, implicitRules#2, language#3, text#4, identifier#5, status#6, statusReason#7, intent#8, category#9, priority#10, doNotPerform#11, reportedBoolean#12, reportedReference#13, medicationCodeableConcept#14, medicationReference#15, subject#16, encounter#17, supportingInformation#18, authoredOn#19, requester#20, performer#21, performerType#22, recorder#23, ... 17 more fields]
: : : +- Project [id#0, meta#1, implicitRules#2, language#3, text#4, identifier#5, status#6, statusReason#7, intent#8, category#9, priority#10, doNotPerform#11, reportedBoolean#12, reportedReference#13, medicationCodeableConcept#14, medicationReference#15, subject#16, encounter#17, supportingInformation#18, authoredOn#19, requester#20, performer#21, performerType#22, recorder#23, ... 16 more fields]
: : : +- Relation[id#0,meta#1,implicitRules#2,language#3,text#4,identifier#5,status#6,statusReason#7,intent#8,category#9,priority#10,doNotPerform#11,reportedBoolean#12,reportedReference#13,medicationCodeableConcept#14,medicationReference#15,subject#16,encounter#17,supportingInformation#18,authoredOn#19,requester#20,performer#21,performerType#22,recorder#23,... 15 more fields] parquet
: : +- Project [9re1eq_id#385]
: : +- Project [9re1eq_id#385, 4yvfvk_value#314, gs5esz_value#362]
: : +- Project [gs5esz_id#358, 4yvfvk_value#314, gs5esz_value#362, gs5esz_id#358 AS 9re1eq_id#385]
: : +- Project [gs5esz_id#358, 4yvfvk_value#314, gs5esz_value#362]
: : +- Project [4yvfvk_id#273, 4yvfvk_value#314, gs5esz_id#358, 4yvfvk_value#314 AS gs5esz_value#362]
: : +- Project [4yvfvk_id#273, 4yvfvk_value#314, 4yvfvk_id#273 AS gs5esz_id#358]
: : +- Project [4yvfvk_id#273, 4yvfvk_value#314]
: : +- Project [id#0, meta#1, implicitRules#2, language#3, text#4, identifier#5, status#6, statusReason#7, intent#8, category#9, priority#10, doNotPerform#11, reportedBoolean#12, reportedReference#13, medicationCodeableConcept#14, medicationReference#15, subject#16, encounter#17, supportingInformation#18, authoredOn#19, requester#20, performer#21, performerType#22, recorder#23, ... 17 more fields]
: : +- Project [id#0, meta#1, implicitRules#2, language#3, text#4, identifier#5, status#6, statusReason#7, intent#8, category#9, priority#10, doNotPerform#11, reportedBoolean#12, reportedReference#13, medicationCodeableConcept#14, medicationReference#15, subject#16, encounter#17, supportingInformation#18, authoredOn#19, requester#20, performer#21, performerType#22, recorder#23, ... 16 more fields]
: : +- Relation[id#0,meta#1,implicitRules#2,language#3,text#4,identifier#5,status#6,statusReason#7,intent#8,category#9,priority#10,doNotPerform#11,reportedBoolean#12,reportedReference#13,medicationCodeableConcept#14,medicationReference#15,subject#16,encounter#17,supportingInformation#18,authoredOn#19,requester#20,performer#21,performerType#22,recorder#23,... 15 more fields] parquet
: +- Project [oe2w4p_value#475, oe2w4p_id#468]
: +- Project [oe2w4p_id#468, 4yvfvk_value#314, gs5esz_value#362, w8apxp_value#434, oe2w4p_value#475]
: +- Project [w8apxp_id#429, 4yvfvk_value#314, gs5esz_value#362, w8apxp_value#434, 95wnaa_id#444, oe2w4p_id#468, (to_timestamp(w8apxp_value#434, None) > to_timestamp(10957, None)) AS oe2w4p_value#475]
: +- Project [w8apxp_id#429, 4yvfvk_value#314, gs5esz_value#362, w8apxp_value#434, 95wnaa_id#444, w8apxp_id#429 AS oe2w4p_id#468]
: +- Join LeftOuter, (w8apxp_id#429 = 95wnaa_id#444)
: :- Project [w8apxp_id#429, 4yvfvk_value#314, gs5esz_value#362, w8apxp_value#434]
: : +- Project [gs5esz_id#358, 4yvfvk_value#314, gs5esz_value#362, w8apxp_id#429, gs5esz_value#362.authoredOn AS w8apxp_value#434]
: : +- Project [gs5esz_id#358, 4yvfvk_value#314, gs5esz_value#362, gs5esz_id#358 AS w8apxp_id#429]
: : +- Project [gs5esz_id#358, 4yvfvk_value#314, gs5esz_value#362]
: : +- Project [4yvfvk_id#273, 4yvfvk_value#314, gs5esz_id#358, 4yvfvk_value#314 AS gs5esz_value#362]
: : +- Project [4yvfvk_id#273, 4yvfvk_value#314, 4yvfvk_id#273 AS gs5esz_id#358]
: : +- Project [4yvfvk_id#273, 4yvfvk_value#314]
: : +- Project [id#0, meta#1, implicitRules#2, language#3, text#4, identifier#5, status#6, statusReason#7, intent#8, category#9, priority#10, doNotPerform#11, reportedBoolean#12, reportedReference#13, medicationCodeableConcept#14, medicationReference#15, subject#16, encounter#17, supportingInformation#18, authoredOn#19, requester#20, performer#21, performerType#22, recorder#23, ... 17 more fields]
: : +- Project [id#0, meta#1, implicitRules#2, language#3, text#4, identifier#5, status#6, statusReason#7, intent#8, category#9, priority#10, doNotPerform#11, reportedBoolean#12, reportedReference#13, medicationCodeableConcept#14, medicationReference#15, subject#16, encounter#17, supportingInformation#18, authoredOn#19, requester#20, performer#21, performerType#22, recorder#23, ... 16 more fields]
: : +- Relation[id#0,meta#1,implicitRules#2,language#3,text#4,identifier#5,status#6,statusReason#7,intent#8,category#9,priority#10,doNotPerform#11,reportedBoolean#12,reportedReference#13,medicationCodeableConcept#14,medicationReference#15,subject#16,encounter#17,supportingInformation#18,authoredOn#19,requester#20,performer#21,performerType#22,recorder#23,... 15 more fields] parquet
: +- Project [95wnaa_id#444]
: +- Project [95wnaa_id#444, 4yvfvk_value#314, gs5esz_value#362]
: +- Project [gs5esz_id#358, 4yvfvk_value#314, gs5esz_value#362, gs5esz_id#358 AS 95wnaa_id#444]
: +- Project [gs5esz_id#358, 4yvfvk_value#314, gs5esz_value#362]
: +- Project [4yvfvk_id#273, 4yvfvk_value#314, gs5esz_id#358, 4yvfvk_value#314 AS gs5esz_value#362]
: +- Project [4yvfvk_id#273, 4yvfvk_value#314, 4yvfvk_id#273 AS gs5esz_id#358]
: +- Project [4yvfvk_id#273, 4yvfvk_value#314]
: +- Project [id#0, meta#1, implicitRules#2, language#3, text#4, identifier#5, status#6, statusReason#7, intent#8, category#9, priority#10, doNotPerform#11, reportedBoolean#12, reportedReference#13, medicationCodeableConcept#14, medicationReference#15, subject#16, encounter#17, supportingInformation#18, authoredOn#19, requester#20, performer#21, performerType#22, recorder#23, ... 17 more fields]
: +- Project [id#0, meta#1, implicitRules#2, language#3, text#4, identifier#5, status#6, statusReason#7, intent#8, category#9, priority#10, doNotPerform#11, reportedBoolean#12, reportedReference#13, medicationCodeableConcept#14, medicationReference#15, subject#16, encounter#17, supportingInformation#18, authoredOn#19, requester#20, performer#21, performerType#22, recorder#23, ... 16 more fields]
: +- Relation[id#0,meta#1,implicitRules#2,language#3,text#4,identifier#5,status#6,statusReason#7,intent#8,category#9,priority#10,doNotPerform#11,reportedBoolean#12,reportedReference#13,medicationCodeableConcept#14,medicationReference#15,subject#16,encounter#17,supportingInformation#18,authoredOn#19,requester#20,performer#21,performerType#22,recorder#23,... 15 more fields] parquet
+- Project [w8apxp_id#537]
+- Project [w8apxp_id#537, 4yvfvk_value#314, gs5esz_value#362, w8apxp_value#542]
+- Project [gs5esz_id#358, 4yvfvk_value#314, gs5esz_value#362, w8apxp_id#537, gs5esz_value#362.status AS w8apxp_value#542]
+- Project [gs5esz_id#358, 4yvfvk_value#314, gs5esz_value#362, gs5esz_id#358 AS w8apxp_id#537]
+- Project [gs5esz_id#358, 4yvfvk_value#314, gs5esz_value#362]
+- Project [4yvfvk_id#273, 4yvfvk_value#314, gs5esz_id#358, 4yvfvk_value#314 AS gs5esz_value#362]
+- Project [4yvfvk_id#273, 4yvfvk_value#314, 4yvfvk_id#273 AS gs5esz_id#358]
+- Project [4yvfvk_id#273, 4yvfvk_value#314]
+- Project [id#0, meta#1, implicitRules#2, language#3, text#4, identifier#5, status#6, statusReason#7, intent#8, category#9, priority#10, doNotPerform#11, reportedBoolean#12, reportedReference#13, medicationCodeableConcept#14, medicationReference#15, subject#16, encounter#17, supportingInformation#18, authoredOn#19, requester#20, performer#21, performerType#22, recorder#23, ... 17 more fields]
+- Project [id#0, meta#1, implicitRules#2, language#3, text#4, identifier#5, status#6, statusReason#7, intent#8, category#9, priority#10, doNotPerform#11, reportedBoolean#12, reportedReference#13, medicationCodeableConcept#14, medicationReference#15, subject#16, encounter#17, supportingInformation#18, authoredOn#19, requester#20, performer#21, performerType#22, recorder#23, ... 16 more fields]
+- Relation[id#0,meta#1,implicitRules#2,language#3,text#4,identifier#5,status#6,statusReason#7,intent#8,category#9,priority#10,doNotPerform#11,reportedBoolean#12,reportedReference#13,medicationCodeableConcept#14,medicationReference#15,subject#16,encounter#17,supportingInformation#18,authoredOn#19,requester#20,performer#21,performerType#22,recorder#23,... 15 more fields] parquet
at org.apache.spark.sql.catalyst.analysis.CheckAnalysis.failAnalysis(CheckAnalysis.scala:49)
at org.apache.spark.sql.catalyst.analysis.CheckAnalysis.failAnalysis$(CheckAnalysis.scala:48)
at org.apache.spark.sql.catalyst.analysis.Analyzer.failAnalysis(Analyzer.scala:130)
at org.apache.spark.sql.catalyst.analysis.CheckAnalysis.$anonfun$checkAnalysis$1(CheckAnalysis.scala:582)
at org.apache.spark.sql.catalyst.analysis.CheckAnalysis.$anonfun$checkAnalysis$1$adapted(CheckAnalysis.scala:92)
at org.apache.spark.sql.catalyst.trees.TreeNode.foreachUp(TreeNode.scala:177)
at org.apache.spark.sql.catalyst.analysis.CheckAnalysis.checkAnalysis(CheckAnalysis.scala:92)
at org.apache.spark.sql.catalyst.analysis.CheckAnalysis.checkAnalysis$(CheckAnalysis.scala:89)
at org.apache.spark.sql.catalyst.analysis.Analyzer.checkAnalysis(Analyzer.scala:130)
at org.apache.spark.sql.catalyst.analysis.Analyzer.$anonfun$executeAndCheck$1(Analyzer.scala:156)
at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper$.markInAnalyzer(AnalysisHelper.scala:201)
at org.apache.spark.sql.catalyst.analysis.Analyzer.executeAndCheck(Analyzer.scala:153)
at org.apache.spark.sql.execution.QueryExecution.$anonfun$analyzed$1(QueryExecution.scala:68)
at org.apache.spark.sql.catalyst.QueryPlanningTracker.measurePhase(QueryPlanningTracker.scala:111)
at org.apache.spark.sql.execution.QueryExecution.$anonfun$executePhase$1(QueryExecution.scala:133)
at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:763)
at org.apache.spark.sql.execution.QueryExecution.executePhase(QueryExecution.scala:133)
at org.apache.spark.sql.execution.QueryExecution.analyzed$lzycompute(QueryExecution.scala:68)
at org.apache.spark.sql.execution.QueryExecution.analyzed(QueryExecution.scala:66)
at org.apache.spark.sql.execution.QueryExecution.assertAnalyzed(QueryExecution.scala:58)
at org.apache.spark.sql.Dataset$.$anonfun$ofRows$1(Dataset.scala:91)
at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:763)
at org.apache.spark.sql.Dataset$.ofRows(Dataset.scala:89)
at org.apache.spark.sql.RelationalGroupedDataset.toDF(RelationalGroupedDataset.scala:66)
at org.apache.spark.sql.RelationalGroupedDataset.agg(RelationalGroupedDataset.scala:256)
at org.apache.spark.sql.RelationalGroupedDataset.agg(RelationalGroupedDataset.scala:255)
at au.csiro.pathling.fhirpath.function.AggregateFunction.applyAggregation(AggregateFunction.java:43)
at au.csiro.pathling.fhirpath.function.CountFunction.invoke(CountFunction.java:51)
at au.csiro.pathling.fhirpath.parser.InvocationVisitor.visitFunctionInvocation(InvocationVisitor.java:157)
at au.csiro.pathling.fhirpath.parser.InvocationVisitor.visitFunctionInvocation(InvocationVisitor.java:39)
at au.csiro.pathling.fhir.FhirPathParser$FunctionInvocationContext.accept(FhirPathParser.java:1222)
at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
at au.csiro.pathling.fhirpath.parser.TermVisitor.visitInvocationTerm(TermVisitor.java:38)
at au.csiro.pathling.fhirpath.parser.TermVisitor.visitInvocationTerm(TermVisitor.java:26)
at au.csiro.pathling.fhir.FhirPathParser$InvocationTermContext.accept(FhirPathParser.java:816)
at au.csiro.pathling.fhirpath.parser.Visitor.visitTermExpression(Visitor.java:45)
at au.csiro.pathling.fhirpath.parser.Visitor.visitTermExpression(Visitor.java:27)
at au.csiro.pathling.fhir.FhirPathParser$TermExpressionContext.accept(FhirPathParser.java:405)
at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
at au.csiro.pathling.fhirpath.parser.Parser.parse(Parser.java:53)
at au.csiro.pathling.aggregate.FreshAggregateExecutor.parseAggregations(FreshAggregateExecutor.java:171)
at au.csiro.pathling.aggregate.FreshAggregateExecutor.execute(FreshAggregateExecutor.java:120)
at au.csiro.pathling.aggregate.AggregateProvider.aggregate(AggregateProvider.java:50)
... 46 common frames omitted