Open chalindukodikara opened 4 months ago
This works as expected with a stream implementor, so could be an issue with how the stream is created or the value/type creator.
import ballerina/sql;
import ballerina/io;
type ComponentKindResultStream record {
string id;
string kind;
};
class StreamImplementor {
public isolated function next() returns record {|ComponentKindResultStream value;|}|sql:Error {
return error sql:Error("this is error");
}
}
public function main() {
stream<ComponentKindResultStream, sql:Error?> componentKindResultStream = new (new StreamImplementor());
if componentKindResultStream is stream<ComponentKindResultStream> {
io:println("Is stream<ComponentKindResultStream>");
ComponentKindResultStream[] _ = from var x in componentKindResultStream
let var idValue = x.id, var kindValue = x.kind
group by idValue, kindValue
select {
id: idValue,
kind: kindValue
};
} else {
io:println("Not stream<ComponentKindResultStream>");
}
}
Prints "Not stream\
Description
dbClient->query produces an error but if condition is true. It should not go inside the if condition since there is an error.
Steps to Reproduce
DB is PostgreSQL. 2 columns
kind (jsonb format)
kind example
{"kind": "Component", "spec": {"type": "byocService", "build": {"buildpack": {"port": 8080, "version": "1.x", "language": "java", "outputDir": "build/", "nodeVersion": "16.3.0", "buildCommand": "npm run build", "dockerfilePath": "multi-protocol-service/Dockerfile", "dockerContextPath": "multi-protocol-service"}}, "source": {"github": {"path": "go/greeter", "repository": "https://github.com/Mirage20/byoc-service"}, "bitbucket": {"path": "go/greeter", "repository": "https://bitbucket.example.com/Mirage20/byoc-service"}}}, "status": {"phase": "Pending", "createdAt": "2021-06-01T12:00:00Z", "updatedAt": "2021-06-01T12:00:00Z", "componentId": "12345678-1234-1234-1234-123456789012"}, "metadata": {"name": "component1", "description": "Component 1", "displayName": "Component 1", "projectName": "project1"}, "apiVersion": "core.choreo.dev/v1alpha1"}
Affected Version(s)
No response
OS, DB, other environment details and versions
No response
Related area
-> Compilation
Related issue(s) (optional)
No response
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response