Class UDTFExample

  • All Implemented Interfaces:
    org.apache.iotdb.udf.api.UDF, org.apache.iotdb.udf.api.UDTF

    public class UDTFExample
    extends Object
    implements org.apache.iotdb.udf.api.UDTF
    This is an internal example of the UDTF implementation.
    • Constructor Summary

      Constructors 
      Constructor Description
      UDTFExample()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void beforeStart​(org.apache.iotdb.udf.api.customizer.parameter.UDFParameters parameters, org.apache.iotdb.udf.api.customizer.config.UDTFConfigurations configurations)  
      void transform​(org.apache.iotdb.udf.api.access.Row row, org.apache.iotdb.udf.api.collector.PointCollector collector)  
      void validate​(org.apache.iotdb.udf.api.customizer.parameter.UDFParameterValidator validator)
      CREATE DATABASE root.sg1; CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN; CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN; INSERT INTO root.sg1.d1(timestamp, s1, s2) VALUES (0, -1, 1); INSERT INTO root.sg1.d1(timestamp, s1, s2) VALUES (1, -2, 2); INSERT INTO root.sg1.d1(timestamp, s1, s2) VALUES (2, -3, 3);
      • Methods inherited from interface org.apache.iotdb.udf.api.UDF

        beforeDestroy
      • Methods inherited from interface org.apache.iotdb.udf.api.UDTF

        terminate, transform, transform, transform
    • Constructor Detail

      • UDTFExample

        public UDTFExample()
    • Method Detail

      • validate

        public void validate​(org.apache.iotdb.udf.api.customizer.parameter.UDFParameterValidator validator)
                      throws Exception
        CREATE DATABASE root.sg1; CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN; CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN; INSERT INTO root.sg1.d1(timestamp, s1, s2) VALUES (0, -1, 1); INSERT INTO root.sg1.d1(timestamp, s1, s2) VALUES (1, -2, 2); INSERT INTO root.sg1.d1(timestamp, s1, s2) VALUES (2, -3, 3);

        CREATE FUNCTION example AS 'org.apache.iotdb.udf.UDTFExample'; SHOW FUNCTIONS; SELECT s1, example(s1), s2, example(s2) FROM root.sg1.d1;

        Specified by:
        validate in interface org.apache.iotdb.udf.api.UDF
        Throws:
        Exception
      • beforeStart

        public void beforeStart​(org.apache.iotdb.udf.api.customizer.parameter.UDFParameters parameters,
                                org.apache.iotdb.udf.api.customizer.config.UDTFConfigurations configurations)
        Specified by:
        beforeStart in interface org.apache.iotdb.udf.api.UDTF
      • transform

        public void transform​(org.apache.iotdb.udf.api.access.Row row,
                              org.apache.iotdb.udf.api.collector.PointCollector collector)
                       throws IOException
        Specified by:
        transform in interface org.apache.iotdb.udf.api.UDTF
        Throws:
        IOException