qiaojialin commented on a change in pull request #1828:
URL: https://github.com/apache/iotdb/pull/1828#discussion_r544003329



##########
File path: 
server/src/main/java/org/apache/iotdb/db/query/udf/core/context/UDFContext.java
##########
@@ -0,0 +1,129 @@
+/*
+ * 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.iotdb.db.query.udf.core.context;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.iotdb.db.exception.metadata.MetadataException;
+import org.apache.iotdb.db.metadata.PartialPath;
+import org.apache.iotdb.db.service.IoTDB;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+
+public class UDFContext {
+
+  private final String name;
+  private final Map<String, String> attributes;
+  private final List<String> attributeKeysInOriginalOrder;

Review comment:
       LinkedHashMap

##########
File path: 
server/src/main/java/org/apache/iotdb/db/query/udf/core/context/UDFContext.java
##########
@@ -0,0 +1,129 @@
+/*
+ * 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.iotdb.db.query.udf.core.context;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.iotdb.db.exception.metadata.MetadataException;
+import org.apache.iotdb.db.metadata.PartialPath;
+import org.apache.iotdb.db.service.IoTDB;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+
+public class UDFContext {
+
+  private final String name;
+  private final Map<String, String> attributes;
+  private final List<String> attributeKeysInOriginalOrder;
+
+  private List<PartialPath> paths;
+  private List<TSDataType> dataTypes;
+
+  private String columnParameterPart;
+  private String column;
+
+  public UDFContext(String name) {
+    this.name = name;
+    attributes = new HashMap<>();
+    attributeKeysInOriginalOrder = new ArrayList<>();
+    paths = new ArrayList<>();
+  }
+
+  public UDFContext(String name, Map<String, String> attributes,
+      List<String> attributeKeysInOriginalOrder, List<PartialPath> paths) {
+    this.name = name;
+    this.attributes = attributes;
+    this.attributeKeysInOriginalOrder = attributeKeysInOriginalOrder;
+    this.paths = paths;
+  }
+
+  public void addAttribute(String key, String value) {
+    attributes.put(key, value);
+    attributeKeysInOriginalOrder.add(key);
+  }
+
+  public void addPath(PartialPath path) {
+    paths.add(path);
+  }
+
+  public void setPaths(List<PartialPath> paths) {
+    this.paths = paths;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public Map<String, String> getAttributes() {
+    return attributes;
+  }
+
+  public List<String> getAttributeKeysInOriginalOrder() {
+    return attributeKeysInOriginalOrder;
+  }
+
+  public List<PartialPath> getPaths() {
+    return paths;
+  }
+
+  public List<TSDataType> getDataTypes() throws MetadataException {
+    if (dataTypes == null) {
+      dataTypes = new ArrayList<>();
+      for (PartialPath path : paths) {
+        dataTypes.add(IoTDB.metaManager.getSeriesType(path));
+      }
+    }
+    return dataTypes;
+  }
+
+  public String getColumnName() {
+    if (column == null) {
+      column = name + "(" + getColumnNameParameterPart() + ")";
+    }
+    return column;
+  }
+
+  private String getColumnNameParameterPart() {

Review comment:
       javadoc




----------------------------------------------------------------
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.

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


Reply via email to