[ https://issues.apache.org/jira/browse/IOTDB-1216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17303034#comment-17303034 ]
Haonan Hou commented on IOTDB-1216: ----------------------------------- I think this is a wishing feature to be done but not a bug. [~suyurong] > User with 'READ_TIMESERIES' privilege execute UDTF query , "Msg: 602: No > permissions for this operation UDTF" > -------------------------------------------------------------------------------------------------------------- > > Key: IOTDB-1216 > URL: https://issues.apache.org/jira/browse/IOTDB-1216 > Project: Apache IoTDB > Issue Type: Bug > Components: Core/Engine > Reporter: 刘珍 > Priority: Minor > Attachments: image-2021-03-11-17-45-21-522.png > > > master branch > commit id : 5fcff40f2299caeb0c8a9ae42f68bc18ecf8fee7 > > root connect iotdb: > SET STORAGE GROUP TO root.sg3; > CREATE TIMESERIES root.sg3.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN; > CREATE TIMESERIES root.sg3.d1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN; > INSERT INTO root.sg3.d1(timestamp, s1, s2) VALUES (10, -11, 11); > INSERT INTO root.sg3.d1(timestamp, s1, s2) VALUES (11, -12, 12); > INSERT INTO root.sg3.d1(timestamp, s1, s2) VALUES (12, -13, 13); > > CREATE USER ln_write_user 'write_pwd' > grant user ln_write_user privileges 'READ_TIMESERIES' on root.sg3; > > ln_write_user connect iotdb to execute UDTF(max) query: > > select max(s1) from root.sg3.d1; > {color:#FF0000}Msg: 602: No permissions for this operation UDTF{color} > !image-2021-03-11-17-45-21-522.png! > > Max.java : > package org.apache.iotdb.udf; > import org.apache.iotdb.db.query.udf.api.UDTF; > import org.apache.iotdb.db.query.udf.api.access.Row; > import org.apache.iotdb.db.query.udf.api.collector.PointCollector; > import org.apache.iotdb.db.query.udf.api.customizer.config.UDTFConfigurations; > import org.apache.iotdb.db.query.udf.api.customizer.parameter.UDFParameters; > import > org.apache.iotdb.db.query.udf.api.customizer.strategy.RowByRowAccessStrategy; > import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType; > import java.io.IOException; > public class Max implements UDTF { > private Long time; > private int value; > @Override > public void beforeStart(UDFParameters parameters, UDTFConfigurations > configurations) { > configurations > .setOutputDataType(TSDataType.INT32) > .setAccessStrategy(new RowByRowAccessStrategy()); > } > @Override > public void transform(Row row, PointCollector collector) { > int candidateValue = row.getInt(0); > if (time == null || value < candidateValue) { > time = row.getTime(); > value = candidateValue; > } > } > @Override > public void terminate(PointCollector collector) throws IOException { > if (time != null) { > collector.putInt(time, value); > } > } > > create function max as "org.apache.iotdb.udf.Max"; > } > -- This message was sent by Atlassian Jira (v8.3.4#803005)