You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/07/02 09:40:57 UTC

[GitHub] [iotdb] flashzxi opened a new pull request, #6565: [IOTDB-3313] Mappable UDTF, Reduce boxing/unboxing overhead in UDF InputLayer / OutputLayer

flashzxi opened a new pull request, #6565:
URL: https://github.com/apache/iotdb/pull/6565

   ## Description
   
   Add MappableUDTF, udtf classes inherited from this class will not cache value in medium LayerPointReader
   
   MappableUDTFs can map a Row to a singule value as output


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] lancelly commented on a diff in pull request #6565: [IOTDB-3313] Mappable UDTF, Reduce boxing/unboxing overhead in UDF InputLayer / OutputLayer

Posted by GitBox <gi...@apache.org>.
lancelly commented on code in PR #6565:
URL: https://github.com/apache/iotdb/pull/6565#discussion_r913337392


##########
server/src/main/java/org/apache/iotdb/db/mpp/transformation/dag/transformer/multi/MappableUDFQueryRowTransformer.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * 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.mpp.transformation.dag.transformer.multi;
+
+import org.apache.iotdb.db.exception.query.QueryProcessException;
+import org.apache.iotdb.db.mpp.transformation.api.LayerRowReader;
+import org.apache.iotdb.db.mpp.transformation.api.YieldableState;
+import org.apache.iotdb.db.mpp.transformation.dag.udf.UDTFExecutor;
+import org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
+import org.apache.iotdb.tsfile.utils.Binary;
+
+import java.io.IOException;
+
+public class MappableUDFQueryRowTransformer extends UDFQueryTransformer {
+
+  protected final LayerRowReader layerRowReader;
+  private final boolean isLayerRowReaderConstant;
+
+  public MappableUDFQueryRowTransformer(LayerRowReader layerRowReader, UDTFExecutor executor) {
+    super(executor);
+    this.layerRowReader = layerRowReader;
+    this.isLayerRowReaderConstant = false;
+  }
+
+  @Override
+  protected boolean cacheValue() throws QueryProcessException, IOException {
+    if (!layerRowReader.next()) {
+      return false;
+    }
+
+    if (!isLayerRowReaderConstant) {
+      cachedTime = layerRowReader.currentTime();
+    }
+
+    executeUDFOnce();
+
+    layerRowReader.readyForNext();
+    return true;
+  }
+
+  @Override
+  protected YieldableState yieldValue() throws QueryProcessException, IOException {
+    final YieldableState yieldableState = layerRowReader.yield();
+    if (!YieldableState.YIELDABLE.equals(yieldableState)) {
+      return yieldableState;
+    }
+
+    if (!isLayerRowReaderConstant) {
+      cachedTime = layerRowReader.currentTime();
+    }
+
+    if (layerRowReader.isCurrentNull()) {
+      currentNull = true;
+    } else {
+      executeUDFOnce();
+    }

Review Comment:
   ```suggestion
         executeUDFOnce();
   ```



-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] JackieTien97 merged pull request #6565: [IOTDB-3313] Mappable UDTF, Reduce boxing/unboxing overhead in UDF InputLayer / OutputLayer

Posted by GitBox <gi...@apache.org>.
JackieTien97 merged PR #6565:
URL: https://github.com/apache/iotdb/pull/6565


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] lancelly commented on a diff in pull request #6565: [IOTDB-3313] Mappable UDTF, Reduce boxing/unboxing overhead in UDF InputLayer / OutputLayer

Posted by GitBox <gi...@apache.org>.
lancelly commented on code in PR #6565:
URL: https://github.com/apache/iotdb/pull/6565#discussion_r913336493


##########
server/src/main/java/org/apache/iotdb/db/mpp/transformation/dag/transformer/multi/MappableUDFQueryRowTransformer.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * 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.mpp.transformation.dag.transformer.multi;
+
+import org.apache.iotdb.db.exception.query.QueryProcessException;
+import org.apache.iotdb.db.mpp.transformation.api.LayerRowReader;
+import org.apache.iotdb.db.mpp.transformation.api.YieldableState;
+import org.apache.iotdb.db.mpp.transformation.dag.udf.UDTFExecutor;
+import org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
+import org.apache.iotdb.tsfile.utils.Binary;
+
+import java.io.IOException;
+
+public class MappableUDFQueryRowTransformer extends UDFQueryTransformer {
+
+  protected final LayerRowReader layerRowReader;
+  private final boolean isLayerRowReaderConstant;
+
+  public MappableUDFQueryRowTransformer(LayerRowReader layerRowReader, UDTFExecutor executor) {
+    super(executor);
+    this.layerRowReader = layerRowReader;
+    this.isLayerRowReaderConstant = false;
+  }
+
+  @Override
+  protected boolean cacheValue() throws QueryProcessException, IOException {
+    if (!layerRowReader.next()) {
+      return false;
+    }
+
+    if (!isLayerRowReaderConstant) {
+      cachedTime = layerRowReader.currentTime();
+    }
+
+    executeUDFOnce();
+
+    layerRowReader.readyForNext();
+    return true;
+  }
+
+  @Override
+  protected YieldableState yieldValue() throws QueryProcessException, IOException {
+    final YieldableState yieldableState = layerRowReader.yield();
+    if (!YieldableState.YIELDABLE.equals(yieldableState)) {
+      return yieldableState;
+    }
+
+    if (!isLayerRowReaderConstant) {
+      cachedTime = layerRowReader.currentTime();
+    }
+
+    if (layerRowReader.isCurrentNull()) {
+      currentNull = true;
+    } else {
+      executeUDFOnce();
+    }

Review Comment:
   executeUDFOnce();



-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org