Is it possible to rename _time column

I have read example of ‘rename’ function. However, I’m not sure if it’s possible to use it to rename “_time” field, and if so, how?

Hi @aaron_yang,
Can you describe your use case of why you would like to do this? You can use the rename function like so:

from(bucket: "Jetson")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "exec_jetson_stats")
  |> filter(fn: (r) => r["_field"] == "jetson_CPU1")
  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
  |> set(key: "tag", value: "foo")
  |> rename(columns: {_time: "time_new"})
  |> yield(name: "mean")

This does cause issues with graphing etc as its an important key field. Might I suggest mapping the time field to a new column?

from(bucket: "Jetson")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "exec_jetson_stats")
  |> filter(fn: (r) => r["_field"] == "jetson_CPU1")
  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
  |> set(key: "tag", value: "foo")
  |> map(fn: (r) => ({ r with time_new: r._time }))
  |> yield(name: "mean")

I need “_time” to named as “frame” in return results. This can do in client parser (parse annotated csv), just wonder if it can be done at server side, and if so, will the performance would be better.

Hi @aaron_yang, for that purpose using the first example I sent will work fine with the rename() function.