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

remote sinks process Decimal -inf, +inf, NaN data get error #15585

Closed
xuefengze opened this issue Mar 11, 2024 · 2 comments
Closed

remote sinks process Decimal -inf, +inf, NaN data get error #15585

xuefengze opened this issue Mar 11, 2024 · 2 comments
Assignees
Labels
help wanted Issues that need help from contributors type/bug Something isn't working
Milestone

Comments

@xuefengze
Copy link
Contributor

Describe the bug

No response

Error message/log

ERROR ThreadId(54) risingwave_connector_node: sink writer error: : java.lang.NumberFormatException: Character I is neither a decimal digit number, decimal point, nor "e" notation exponential mark.

ERROR ThreadId(55) risingwave_connector_node: sink writer error: : java.lang.NumberFormatException: Character N is neither a decimal digit number, decimal point, nor "e" notation exponential mark.

To Reproduce

pg:

CREATE TABLE decimal_test (
  id BIGINT PRIMARY KEY,
  d decimal
);

rw:

CREATE TABLE decimal_test (
  id BIGINT PRIMARY KEY,
  d decimal
);

INSERT INTO decimal_test VALUES (1, 'nan');
INSERT INTO decimal_test VALUES (2, 'inf');
INSERT INTO decimal_test VALUES (3, '-inf');

CREATE SINK decimal_sink
FROM
    decimal_test WITH(
    connector = 'jdbc',
    jdbc.url = 'jdbc:postgresql://postgres:5432/mydb?user=myuser&password=123456',
    table.name = 'decimal_test',
    type='append-only',
    primary_key = 'id',
    force_append_only = 'true',
);

Expected behavior

No response

How did you deploy RisingWave?

No response

The version of RisingWave

No response

Additional context

No response

@xuefengze xuefengze added the type/bug Something isn't working label Mar 11, 2024
@github-actions github-actions bot added this to the release-1.8 milestone Mar 11, 2024
@fuyufjh
Copy link
Member

fuyufjh commented Mar 11, 2024

extern "system" fn Java_com_risingwave_java_binding_Binding_iteratorGetDecimalValue<'a>(
env: EnvParam<'a>,
pointer: Pointer<'a, JavaBindingIterator<'a>>,
idx: jint,
) -> JObject<'a> {
execute_and_catch(env, move |env: &mut EnvParam<'_>| {
let value = pointer
.as_ref()
.datum_at(idx as usize)
.unwrap()
.into_decimal()
.to_string();
let string_value = env.new_string(value)?;
let (decimal_class_ref, constructor) = pointer
.as_ref()
.class_cache
.big_decimal_ctor
.get_or_try_init(|| {
let cls = env.find_class("java/math/BigDecimal")?;
let init_method = env.get_method_id(&cls, "<init>", "(Ljava/lang/String;)V")?;
Ok::<_, jni::errors::Error>((env.new_global_ref(cls)?, init_method))
})?;
unsafe {
let decimal_class = <&JClass<'_>>::from(decimal_class_ref.as_obj());
let date_obj = env.new_object_unchecked(
decimal_class,
*constructor,
&[jvalue {
l: string_value.into_raw(),
}],
)?;
Ok(date_obj)
}
})
}

@fuyufjh fuyufjh added the help wanted Issues that need help from contributors label Mar 11, 2024
@fuyufjh fuyufjh modified the milestones: release-1.8, release-1.9 Apr 8, 2024
@fuyufjh
Copy link
Member

fuyufjh commented Apr 11, 2024

Resolved by #16230

@fuyufjh fuyufjh closed this as completed Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issues that need help from contributors type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants