[BUG]"columnNames" Parameter Not Working for Tag History

Issue Description:

When defining the “columnNames” parameter for the “system.historian.queryAggregatedPoints” function, the resulting dataset does not use the value of “columnNames” for its headers but instead the default header names. I tested this in a Python script within the Reporting module and the Script Console.

Expected Behavior:

The resulting dataset should have its headers replaced with the list of strings defined in “columnNames”. The function does return an exception when the length of the list is not correct, which is expected.

I was able to replicate the “columnNames” functionality with the “setColumnNames” dataset method in my script, but I don’t know why the parameter in the function does not work.

Ignition Version: 8.3.1

Please post your test script and see Wiki - how to post code on this forum.

I think you need to account for the first column in the return dataset. IIRC, it’s a ts/t_stamp column.

How many columns are in your return dataset vs your columnNames?

Looks like things have changed since I last used the Historian module (8.1). After testing in 8.3.1 you no longer need to include the timestamp column.

This is the code I was using to test in the Script Console:

histPath = "histprov:NBU_Main_DB:/sys:NBU_Main:/prov:NBU_Main:/tag:_Gateway/Performance/CPU Usage"
tagPath = "[NBU_Main]_Gateway/Performance/CPU Usage"

output1 = system.historian.queryAggregatedPoints(
	paths = [histPath],
	startTime = system.date.addDays(system.date.now(), -1),
	endTime = system.date.now()
)
print("Dataset with default headers: ")
print(output1.getColumnNames())
print(list(output1))

output2 = system.historian.queryAggregatedPoints(
	paths = [histPath],
	startTime = system.date.addDays(system.date.now(), -1),
	endTime = system.date.now(),
	columnNames = [tagPath]
)
print("Dataset with new headers: ")
print(output2.getColumnNames())
print(list(output2))

Result:

Dataset with default headers: 
[t_stamp, histprov:NBU_Main_DB:/sys:NBU_Main:/prov:NBU_Main:/tag:_Gateway/Performance/CPU Usage]
[[Sun Nov 23 15:46:41 CST 2025, 0.13377929849728076]]
Dataset with new headers: 
[t_stamp, histprov:NBU_Main_DB:/sys:NBU_Main:/prov:NBU_Main:/tag:_Gateway/Performance/CPU Usage]
[[Sun Nov 23 15:46:41 CST 2025, 0.13377952958085207]]

I’m only using one column in columnNames because I get an exception when adding more.

Example:

histPath = "histprov:NBU_Main_DB:/sys:NBU_Main:/prov:NBU_Main:/tag:_Gateway/Performance/CPU Usage"
tagPath = "[NBU_Main]_Gateway/Performance/CPU Usage"

output1 = system.historian.queryAggregatedPoints(
	paths = [histPath],
	startTime = system.date.addDays(system.date.now(), -1),
	endTime = system.date.now()
)
print("Dataset with default headers: ")
print(output1.getColumnNames())
print(list(output1))

output2 = system.historian.queryAggregatedPoints(
	paths = [histPath],
	startTime = system.date.addDays(system.date.now(), -1),
	endTime = system.date.now(),
	columnNames = ["t_stamp", tagPath]
)
print("Dataset with new headers: ")
print(output2.getColumnNames())
print(list(output2))

Result:

Dataset with default headers: 
[t_stamp, histprov:NBU_Main_DB:/sys:NBU_Main:/prov:NBU_Main:/tag:_Gateway/Performance/CPU Usage]
[[Sun Nov 23 15:48:34 CST 2025, 0.1348958872269098]]
Java Traceback:
Traceback (most recent call last):
  File "<input>", line 13, in <module>
	at com.inductiveautomation.historian.common.scripting.AbstractHistorianFunctions.queryAggregatedPoints(AbstractHistorianFunctions.kt:200)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: The paths and columnNames lists must be the same size


	at org.python.core.Py.JavaError(Py.java:545)

	at org.python.core.Py.JavaError(Py.java:536)

	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:192)

	at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(ScriptManager.java:563)

	at org.python.core.PyObject.__call__(PyObject.java:400)

	at org.python.pycode._pyx42.f$0(<input>:21)

	at org.python.pycode._pyx42.call_function(<input>)

	at org.python.core.PyTableCode.call(PyTableCode.java:173)

	at org.python.core.PyCode.call(PyCode.java:18)

	at org.python.core.Py.runCode(Py.java:1703)

	at org.python.core.Py.exec(Py.java:1747)

	at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:277)

	at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:130)

	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:628)

	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:616)

	at java.desktop/javax.swing.SwingWorker$1.call(Unknown Source)

	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)

	at java.desktop/javax.swing.SwingWorker.run(Unknown Source)

	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

	at java.base/java.lang.Thread.run(Unknown Source)

Caused by: java.lang.IllegalArgumentException: The paths and columnNames lists must be the same size

	at com.inductiveautomation.historian.common.scripting.AbstractHistorianFunctions.queryAggregatedPoints(AbstractHistorianFunctions.kt:200)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:190)

	... 18 more

Traceback (most recent call last):
  File "<input>", line 13, in <module>
	at com.inductiveautomation.historian.common.scripting.AbstractHistorianFunctions.queryAggregatedPoints(AbstractHistorianFunctions.kt:200)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: The paths and columnNames lists must be the same size

The stacktrace says:

Here's why.

Tip: When confronted to a java stacktrace, look for the lines that start with "caused by"

After testing in 8.3.1 this doesn’t seem to be the case.

The manual states for columnNames A list of alias column names for the returned dataset which isn’t true (it was true for 8.1 at some point). To alleviate future confusion it should note the columnNames length needs to match the paths length.

That being said, I could replicate the error issue if histPath contained a capital letter. If the path is all lowercase, then the columnNames work (note: the returned columnNames will also be lowercase).

@mjadams to test this add .lower() to the histPath. histPath = "histprov:NBU_Main_DB:/sys:NBU_Main:/prov:NBU_Main:/tag:_Gateway/Performance/CPU Usage".lower()

2 Likes

That seems to be the problem. It works for me if the histPath is lowercase.

However, I don’t know if this is intentional or not. The QueryTagHistory function, which is deprecated but still exists in 8.3, had a columnNames parameter, and it works with capital letters.

FWIW, when displaying datasets you’ll typically use a table or some component that offers column settings to style, adjust, rename columns, etc. Intentional or not, these workarounds are simple to implement.