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

fix(sink): fix decimal jdbc sink #16230

Merged
merged 3 commits into from
Apr 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/jni_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use risingwave_common::array::{ArrayError, StreamChunk};
use risingwave_common::hash::VirtualNode;
use risingwave_common::row::{OwnedRow, Row};
use risingwave_common::test_prelude::StreamChunkTestExt;
use risingwave_common::types::ScalarRefImpl;
use risingwave_common::types::{Decimal, ScalarRefImpl};
use risingwave_common::util::panic::rw_catch_unwind;
use risingwave_pb::connector_service::{
GetEventStreamResponse, SinkCoordinatorStreamRequest, SinkCoordinatorStreamResponse,
Expand Down Expand Up @@ -767,11 +767,20 @@ extern "system" fn Java_com_risingwave_java_binding_Binding_iteratorGetDecimalVa
idx: jint,
) -> JObject<'a> {
execute_and_catch(env, move |env: &mut EnvParam<'_>| {
let value = pointer
let decimal_value = pointer
.as_ref()
.datum_at(idx as usize)
.unwrap()
.into_decimal()
.into_decimal();

match decimal_value {
Decimal::NaN | Decimal::NegativeInf | Decimal::PositiveInf => {
return Ok(JObject::null());
}
Decimal::Normalized(_) => {}
};

let value = decimal_value
.to_string();
let string_value = env.new_string(value)?;
let (decimal_class_ref, constructor) = pointer
Expand Down
Loading