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

Numeric column as Protobuf uint64/uint32 #19528

Open
silentsokolov opened this issue Nov 21, 2024 · 2 comments
Open

Numeric column as Protobuf uint64/uint32 #19528

silentsokolov opened this issue Nov 21, 2024 · 2 comments

Comments

@silentsokolov
Copy link

silentsokolov commented Nov 21, 2024

Describe the bug

Cannot create a sink form a source with identical protobuf shema

Error message/log

[2024-11-21 12:26:42] [XX000] ERROR: Failed to execute the statement
[2024-11-21 12:26:42] Caused by these errors (recent errors listed first):
[2024-11-21 12:26:42] 1: gRPC request to meta service failed: Internal error
[2024-11-21 12:26:42] 2: failed to validate sink
[2024-11-21 12:26:42] 3: Encode error: encode 'uid' error: cannot encode numeric column as uint64 field
[2024-11-21 12:52:08] Caused by these errors (recent errors listed first):
[2024-11-21 12:52:08] 1: gRPC request to meta service failed: Internal error
[2024-11-21 12:52:08] 2: failed to validate sink
[2024-11-21 12:52:08] 3: Encode error: encode 'uid' error: cannot encode bigint column as uint32 field

To Reproduce

message Fact {
  string id = 1;
  uint64 uid = 2; // or uint32
}
protoc --include_imports --descriptor_set_out=schema.pb schema.proto 
CREATE SOURCE source_test
WITH (
   connector='kafka'
) FORMAT PLAIN ENCODE PROTOBUF (
   message='Fact',
   schema.location='file:https:/// ..schema.pb'
);

CREATE MATERIALIZED VIEW mv_test AS
SELECT
    *
FROM
    source_test;
CREATE SINK sink_test
FROM mv_test
WITH (
   connector='kafka'
) FORMAT PLAIN ENCODE PROTOBUF (
   message='Fact',
   schema.location='file:https:/// ..schema.pb'
);

Expected behavior

I expected that the sink created

How did you deploy RisingWave?

Homebrew

The version of RisingWave

PostgreSQL 13.14.0-RisingWave-2.0.2 (Homebrew)

Additional context

No response

@silentsokolov silentsokolov added the type/bug Something isn't working label Nov 21, 2024
@github-actions github-actions bot added this to the release-2.2 milestone Nov 21, 2024
@silentsokolov silentsokolov changed the title Numeric column as Protobuf uint64 Numeric column as Protobuf uint64/uint32 Nov 21, 2024
@xiangjinwu
Copy link
Contributor

This is because there is no unsigned data types in RisingWave, so we have been conservative on implicit conversion:

  • In source, uint32 is promoted to bigint and uint64 is promoted to numeric (aka decimal).
  • In sink, bigint may not fit back into a uint32, similarly numeric into uint64.

To allow such round trips, we may require an explicit acknowledgement such as allow_lossy_cast = true (name TBD). Better design alternatives are welcomed.

@silentsokolov
Copy link
Author

To allow such round trips, we may require an explicit acknowledgement such as allow_lossy_cast = true (name TBD).

LGM. At least it's better than change the scheme only for rw

@fuyufjh fuyufjh added type/feature user-feedback and removed type/bug Something isn't working labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants