Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)
Use uname -a if on Linux.
JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)
Adopt JDK 11
Library Dependencies
N/A
Expected Behavior
Please describe the expected behavior of the issue, starting from the first action.
Use the scalar[Int].single on a column that unexpectedly contains a NULL
An error is thrown that says the column unexpectedly contains a null
Actual Behavior
Use the scalar[Int].single on a column that unexpectedly contains a NULL
This error is thrown: anorm.AnormException: '.completed_average' not found, available columns: completed_average, completed_average
The error makes it look like there was an issue with column name or column alias etc. The actual issue was that the column unexpectedly contains a NULL and the scalar[Option[Int]].single needs to be used instead
The issue seems to be with this code in Anorm:
@inline private def parseColumn[T](
row: Row,
name: String,
c: Column[T],
input: (Any, MetaDataItem)
): Either[SqlRequestError, T] = c.tupled(input).left.map {
case UnexpectedNullableFound(_) =>
ColumnNotFound(name, row)
case cause => cause
}
The UnexpectedNullableFound error is incorrectly mapped to the ColumnNotFound error
Reproducible Test Case
Please provide a PR with a failing test.
If the issue is more complex or requires configuration, please provide a link to a project on Github that reproduces the issue.
Are you looking for help?
No
Anorm Version (2.5.x / etc)
2.7.0 (latest version)
Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)
Use
uname -a
if on Linux.JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)
Adopt JDK 11
Library Dependencies
N/A
Expected Behavior
Please describe the expected behavior of the issue, starting from the first action.
scalar[Int].single
on a column that unexpectedly contains a NULLActual Behavior
scalar[Int].single
on a column that unexpectedly contains a NULLanorm.AnormException: '.completed_average' not found, available columns: completed_average, completed_average
scalar[Option[Int]].single
needs to be used insteadThe issue seems to be with this code in Anorm:
The
UnexpectedNullableFound
error is incorrectly mapped to theColumnNotFound
errorReproducible Test Case
Please provide a PR with a failing test.
If the issue is more complex or requires configuration, please provide a link to a project on Github that reproduces the issue.