当我试图编译时,它说:对于methode java.math.bigdecimal的方法重载,它的方法重载是不明确的,它还说:由于原型重叠,无法解析为[null]调用哪个方法between:...
def sql = ("Select d.*
from (select d.*,
lead( (case when length <> 'N/A' then length else length_to_fault end)::float) over (partition by port_nbr, pair order by port, pair, d.add_date) as lengthh
from diags d
) d")
def lastRow = [id:-1, port_nbr:-1, pair:'', lengthh:-1.0]
dst_db1.eachRow( sql ) { row ->
if ( row.port_nbr == lastRow.port_nbr && row.pair == lastRow.pair ) {
BigDecimal lengthChange =
new BigDecimal( row.lengthh ) - new BigDecimal( lastRow.lengthh )
if ( lengthChange > 30.0 ) {
print "Port ${row.port_nbr}, ${row.pair} length change: $lengthChange"
println "\tbetween row ID ${lastRow.id} and ${row.id}"
}
lastRow = row
} else {
println "Key changed"
lastRow = row
}
}
有人能修复这个错误吗?
编辑-新建完整错误:
Caught: java.lang.NumberFormatException: Character n is neither a decimal digit number, decimal point, nor "e" notation exponential mark.
java.lang.NumberFormatException: Character n is neither a decimal digit number, decimal point, nor "e" notation exponential mark.
at java.base/jdk.internal.reflect.GeneratedConstructorAccessor10.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at Main$_main_closure1.doCall(main.groovy:18)
at jdk.internal.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at Main.main(main.groovy:14)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
1条答案
按热度按时间ybzsozfc1#
它看起来像你的
row.length
字段不是代码所期望的字符串类型。您需要将其转换为字符串,或bigdecimal构造函数可以处理的其他类型,例如:如果问题仍然存在,则用以下方法确定问题类型: