Skip to content

InfluxDB result values parsed incorrectly #59

@sievericcardo

Description

@sievericcardo

When running queries in InfluxDB, the result value is always casted into a Double, resulting in errors when the stream of data is saved in a different format into the database. Even more, sometimes the parser will not parse the data correctly. Specifically, In an instance of query that yielded as result 1012.00 on InfluxDB when executed on the database directly, on SMOL resulted in the following exception for the same query

java.lang.ClassCastException: class java.lang.Long cannot be cast to class java.lang.Double (java.lang.Long and java.lang.Double are in module java.base of loader 'bootstrap')
	at no.uio.microobject.runtime.InfluxDBConnection$queryOneSeries$1$1.invokeSuspend(Interpreter.kt:47)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:175)
	at kotlinx.coroutines.DispatchedTaskKt.resumeUnconfined(DispatchedTask.kt:137)
	at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:108)
	at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:308)
	at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:318)
	at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:250)

The query should not be casted to a Long, even though the decimals are both 0. It should be first treated as a Double, or at least trying to parse it as such if it is the return type declared.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions