@@ -308,7 +308,7 @@ bool AggNode::dsqlMatch(DsqlCompilerScratch* dsqlScratch, const ExprNode* other,
308308 // ASF: We compare name address. That should be ok, as we have only one AggInfo instance
309309 // per function.
310310 return aggInfo.blr == o->aggInfo .blr && aggInfo.name == o->aggInfo .name &&
311- distinct == o->distinct && dialect1 == o->dialect1 && sort == o-> sort ; ;
311+ distinct == o->distinct && dialect1 == o->dialect1 ;
312312}
313313
314314void AggNode::setParameterName (dsql_par* parameter) const
@@ -448,12 +448,14 @@ bool AggNode::aggPass(thread_db* tdbb, Request* request) const
448448 for (auto & nodeOrder : sort->expressions )
449449 {
450450 dsc toDesc = *(descOrder++);
451- toDesc.dsc_address = data + (IPTR)toDesc.dsc_address ;
451+ toDesc.dsc_address = data + (IPTR) toDesc.dsc_address ;
452452 if (const auto fromDsc = EVL_expr (tdbb, request, nodeOrder))
453453 {
454454 if (IS_INTL_DATA (fromDsc))
455+ {
455456 INTL_string_to_key (tdbb, INTL_TEXT_TO_INDEX (fromDsc->getTextType ()),
456457 fromDsc, &toDesc, INTL_KEY_UNIQUE);
458+ }
457459 else
458460 MOV_move (tdbb, fromDsc, &toDesc);
459461 }
@@ -465,7 +467,7 @@ bool AggNode::aggPass(thread_db* tdbb, Request* request) const
465467 }
466468
467469 dsc toDesc = asb->desc ;
468- toDesc.dsc_address = data + (IPTR)toDesc.dsc_address ;
470+ toDesc.dsc_address = data + (IPTR) toDesc.dsc_address ;
469471 MOV_move (tdbb, desc, &toDesc);
470472
471473 return true ;
@@ -522,7 +524,7 @@ dsc* AggNode::execute(thread_db* tdbb, Request* request) const
522524 if (distinct)
523525 desc.dsc_address = data + (asb->intl ? asb->keyItems [1 ].getSkdOffset () : 0 );
524526 else
525- desc.dsc_address = data + (IPTR)asb->desc .dsc_address ;
527+ desc.dsc_address = data + (IPTR) asb->desc .dsc_address ;
526528
527529 aggPass (tdbb, request, &desc);
528530 }
@@ -937,6 +939,20 @@ DmlNode* ListAggNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch*
937939 return node;
938940}
939941
942+ bool ListAggNode::dsqlMatch (DsqlCompilerScratch* dsqlScratch, const ExprNode* other, bool ignoreMapCast) const
943+ {
944+ if (!AggNode::dsqlMatch (dsqlScratch, other, ignoreMapCast))
945+ return false ;
946+
947+ const ListAggNode* o = nodeAs<ListAggNode>(other);
948+ fb_assert (o);
949+
950+ if (dsqlOrderClause || o->dsqlOrderClause )
951+ return PASS1_node_match (dsqlScratch, dsqlOrderClause, o->dsqlOrderClause , ignoreMapCast);
952+
953+ return true ;
954+ }
955+
940956void ListAggNode::make (DsqlCompilerScratch* dsqlScratch, dsc* desc)
941957{
942958 DsqlDescMaker::fromNode (dsqlScratch, desc, arg);
@@ -950,20 +966,6 @@ void ListAggNode::genBlr(DsqlCompilerScratch* dsqlScratch)
950966 GEN_sort (dsqlScratch, blr_sort, dsqlOrderClause);
951967}
952968
953- AggNode* ListAggNode::pass1 (thread_db* tdbb, CompilerScratch* csb)
954- {
955- if (sort && distinct)
956- {
957- ValueExprNode* const sortNode = *sort->expressions .begin ();
958- if (!arg->sameAs (sortNode, false ) || sort->expressions .getCount () > 1 )
959- {
960- ERR_post (Arg::Gds (isc_sqlerr) << Arg::Num (-104 ) << Arg::Gds (isc_dsql_command_err)
961- << Arg::Gds (isc_distinct_order_by_err));
962- }
963- }
964- return AggNode::pass1 (tdbb, csb);
965- }
966-
967969bool ListAggNode::setParameterType (DsqlCompilerScratch* dsqlScratch,
968970 std::function<void (dsc*)> makeDesc, bool forceVarChar)
969971{
0 commit comments