【发布时间】:2020-07-23 09:55:41
【问题描述】:
当我尝试编译时,它说: 用于方法 java.math.BigDecimal 的方法重载的模糊方法重载# 它还说: 由于以下之间的原型重叠,无法解析为 [null] 调用哪个方法:...
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)
【问题讨论】:
-
row.length的数据类型是什么?您应该能够使用println row.length.class.name来确定这一点。 -
数据库中的长度为char,与length_to_fault相同。但它们是十进制数字,所以我认为我需要将其更改为在选择部分中浮动,这样我就可以在常规代码部分中使用长度。我想将length和length_to_fault合并为一列并将其定义为lengthh,所以我可以在代码中调用lengthh
标签: sql groovy bigdecimal