YaoFly commented on code in PR #33808:
URL: https://github.com/apache/shardingsphere/pull/33808#discussion_r1870547875


##########
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/aggregation/DistinctGroupConcatAggregationUnit.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sharding.merge.dql.groupby.aggregation;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.List;
+
+/**
+ *  Distinct group concat aggregation unit.
+ */
+public final class DistinctGroupConcatAggregationUnit implements 
AggregationUnit {
+    
+    private static final String DEFAULT_SEPARATOR = ",";
+    
+    private final Collection<String> values = new LinkedHashSet<>();
+    
+    private final String separator;
+    
+    public DistinctGroupConcatAggregationUnit(final String separator) {
+        this.separator = null == separator ? DEFAULT_SEPARATOR : separator;
+    }
+    
+    @Override
+    public void merge(final List<Comparable<?>> values) {
+        if (null == values || null == values.get(0)) {
+            return;
+        }
+        this.values.add(String.valueOf(values.get(0)));

Review Comment:
   For GROUP_CONCAT, this function returns a string result with the 
concatenated non-NULL values from a group. It returns NULL if there are no 
non-NULL values.
   It seems that only AVG can provide multi-element collection scenes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to