Zhihao Shen created IOTDB-6319:
----------------------------------

             Summary: Append time column at the end of input columns in 
mappable UDTF
                 Key: IOTDB-6319
                 URL: https://issues.apache.org/jira/browse/IOTDB-6319
             Project: Apache IoTDB
          Issue Type: New Feature
            Reporter: Zhihao Shen
            Assignee: Zhihao Shen


For single row interface, you can call {{row.getTime()}} to get the timestamp 
value of current row.
@Overridepublic Object transform(Row row) throws Exception {  return 
row.getTime();
}
 
For batch interface, {*}the last column is the time column{*}, use 
{{.getLongs()}} to acquire the timestamp values of all rows.
@Overridepublic void transform(Column[] columns, ColumnBuilder builder) throws 
Exception {  long[] timestamps = columns[columns.size() - 1].getLongs();  int 
count = columns[0].getPositionCount();  for (int i = 0; i < count; i++) {    
builder.writeLong(timestamps[i]);
  }
}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to