Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid stream value created by the MySQL client #7359

Open
MaryamZi opened this issue Nov 13, 2024 · 0 comments
Open

Invalid stream value created by the MySQL client #7359

MaryamZi opened this issue Nov 13, 2024 · 0 comments
Labels
module/mysql Team/DIU Data, IO, and Util packages related issues Type/Bug

Comments

@MaryamZi
Copy link
Member

Description

$title.

May apply to other clients too.

Steps to Reproduce

public isolated function getBooks() returns Book[]|sql:Error {
    stream<Book, sql:Error?> resultStream = dbClient->query(getQuery());
    
    if resultStream is stream<Book> {
        return from Book book in resultStream select book;
    }
    
    return error("Error fetching books");
}
  1. The is check should never evaluate to true, should it? But it evaluates to true.

  2. Then if there's an error (e.g., mismatched column/record names), crashes

[2024-11-13 11:08:24,871] SEVERE {b7a.log.crash} - class io.ballerina.runtime.internal.values.ErrorValue cannot be cast to class io.ballerina.runtime.internal.values.ArrayValue (io.ballerina.runtime.internal.values.ErrorValue and io.ballerina.runtime.internal.values.ArrayValue are in unnamed module of loader 'app') 
java.lang.ClassCastException: class io.ballerina.runtime.internal.values.ErrorValue cannot be cast to class io.ballerina.runtime.internal.values.ArrayValue (io.ballerina.runtime.internal.values.ErrorValue and io.ballerina.runtime.internal.values.ArrayValue are in unnamed module of loader 'app')
        at temp.getBooks(temp.bal:80)
        at temp.main(temp.bal:90)
        at $_init.$moduleExecute(.)
        at $_init.$lambda$$moduleExecute$(.)
        at io.ballerina.runtime.internal.scheduling.SchedulerItem.execute(SchedulerItem.java:54)
        at io.ballerina.runtime.internal.scheduling.Scheduler.run(Scheduler.java:320)
        at io.ballerina.runtime.internal.scheduling.Scheduler.runSafely(Scheduler.java:287)
        at java.base/java.lang.Thread.run(Thread.java:833)

Version

2201.10.0

Environment Details (with versions)

No response

@MaryamZi MaryamZi added Type/Bug module/mysql Team/DIU Data, IO, and Util packages related issues labels Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/mysql Team/DIU Data, IO, and Util packages related issues Type/Bug
Projects
None yet
Development

No branches or pull requests

1 participant