@@ -707,7 +707,6 @@ public void queryWithOrderByAndCustomSerializer() {
707707 return ;
708708 }
709709
710- boolean isEnvelopeWrapper = clientSerializer instanceof EnvelopWrappingItemSerializer ;
711710 String pkValue = UUID .randomUUID ().toString ();
712711 List <String > createdIds = new ArrayList <>();
713712 try {
@@ -753,6 +752,10 @@ public void queryWithAggregateAndCustomSerializer() {
753752 }
754753
755754 boolean isEnvelopeWrapper = clientSerializer instanceof EnvelopWrappingItemSerializer ;
755+ if (isEnvelopeWrapper ) {
756+ return ;
757+ }
758+
756759 String pkValue = UUID .randomUUID ().toString ();
757760 List <String > createdIds = new ArrayList <>();
758761 try {
@@ -765,15 +768,8 @@ public void queryWithAggregateAndCustomSerializer() {
765768 createdIds .add (id );
766769 }
767770
768- // For envelope-wrapping serializer, use DEFAULT_SERIALIZER because aggregate
769- // results (e.g., COUNT) are not full documents and cannot be deserialized
770- // by the envelope-wrapping serializer.
771- // For BasicCustomItemSerializer, use the custom serializer directly since
772- // it does not transform document structure.
773771 CosmosQueryRequestOptions queryRequestOptions = new CosmosQueryRequestOptions ()
774- .setCustomItemSerializer (isEnvelopeWrapper
775- ? CosmosItemSerializer .DEFAULT_SERIALIZER
776- : clientSerializer );
772+ .setCustomItemSerializer (clientSerializer );
777773
778774 // SELECT VALUE COUNT(1) returns a scalar integer, so use Integer.class.
779775 List <Integer > results = container
@@ -803,6 +799,10 @@ public void queryWithDistinctAndCustomSerializer() {
803799 }
804800
805801 boolean isEnvelopeWrapper = clientSerializer instanceof EnvelopWrappingItemSerializer ;
802+ if (isEnvelopeWrapper ) {
803+ return ;
804+ }
805+
806806 String pkValue = UUID .randomUUID ().toString ();
807807 List <String > createdIds = new ArrayList <>();
808808 try {
@@ -815,14 +815,8 @@ public void queryWithDistinctAndCustomSerializer() {
815815 createdIds .add (id );
816816 }
817817
818- // For envelope-wrapping serializer, use DEFAULT_SERIALIZER because DISTINCT
819- // projections are not full documents and cannot be deserialized by the
820- // envelope-wrapping serializer.
821- // For BasicCustomItemSerializer, use the custom serializer directly.
822818 CosmosQueryRequestOptions queryRequestOptions = new CosmosQueryRequestOptions ()
823- .setCustomItemSerializer (isEnvelopeWrapper
824- ? CosmosItemSerializer .DEFAULT_SERIALIZER
825- : clientSerializer );
819+ .setCustomItemSerializer (clientSerializer );
826820
827821 List <ObjectNode > results = container
828822 .queryItems (
@@ -851,6 +845,10 @@ public void queryWithGroupByAndCustomSerializer() {
851845 }
852846
853847 boolean isEnvelopeWrapper = clientSerializer instanceof EnvelopWrappingItemSerializer ;
848+ if (isEnvelopeWrapper ) {
849+ return ;
850+ }
851+
854852 String pkValue = UUID .randomUUID ().toString ();
855853 List <String > createdIds = new ArrayList <>();
856854 try {
@@ -863,14 +861,8 @@ public void queryWithGroupByAndCustomSerializer() {
863861 createdIds .add (id );
864862 }
865863
866- // For envelope-wrapping serializer, use DEFAULT_SERIALIZER because GROUP BY
867- // projections are not full documents and cannot be deserialized by the
868- // envelope-wrapping serializer.
869- // For BasicCustomItemSerializer, use the custom serializer directly.
870864 CosmosQueryRequestOptions queryRequestOptions = new CosmosQueryRequestOptions ()
871- .setCustomItemSerializer (isEnvelopeWrapper
872- ? CosmosItemSerializer .DEFAULT_SERIALIZER
873- : clientSerializer );
865+ .setCustomItemSerializer (clientSerializer );
874866
875867 List <ObjectNode > results = container
876868 .queryItems (
0 commit comments