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

Bug: avro schema with default value for date cannot be parsed #13505

Closed
StrikeW opened this issue Nov 20, 2023 · 4 comments · Fixed by #13523 or #13530
Closed

Bug: avro schema with default value for date cannot be parsed #13505

StrikeW opened this issue Nov 20, 2023 · 4 comments · Fixed by #13523 or #13530
Assignees
Labels
type/bug Something isn't working
Milestone

Comments

@StrikeW
Copy link
Contributor

StrikeW commented Nov 20, 2023

Describe the bug

customer reported cannot create a Table with kafka connector in DEBEZIUM AVRO format.

CREATE TABLE data_item  WITH ( CONNECTOR = 'kafka', TOPIC = 'data_item', PROPERTIES.BOOTSTRAP.SERVER = 'xxx', SCAN.STARTUP.MODE = 'earliest' )  FORMAT DEBEZIUM ENCODE AVRO (schema.registry='xxx');

Error message/log

SQL ERROR: ExecuteError: Protocol error: Avro schema parse error One union type Date must match the `default`'s value type Long

To Reproduce

The schema which is suspected to be causing this problem:

{
	"name": "first_insert_dt",
	"type": [
		{
			"type": "int",
			"connect.version": 1,
			"connect.default": 0,
			"connect.name": "org.apache.kafka.connect.data.Date",
			"logicalType": "date"
		},
		"null"
	],
	"default": 0
},

Expected behavior

No response

How did you deploy RisingWave?

No response

The version of RisingWave

risingwave:nightly-20231102

Additional context

No response

@StrikeW StrikeW added the type/bug Something isn't working label Nov 20, 2023
@github-actions github-actions bot added this to the release-1.5 milestone Nov 20, 2023
@xiangjinwu
Copy link
Contributor

xiangjinwu commented Nov 20, 2023

Yet another upstream (apache_avro) bug: #12562 / #13030. I am working on migration from our fork to the official version. But may or may not have bandwidth this and next week.

It has been fixed in apache_avro v0.14.0

It was introduced in upstream since 2022-10-11 (after 0.14.0) and fixed 2023-09-07 (before 0.16.0).

Our fork is based on 2023-03-21, and there are some breaking API changes between 2023-03-21 and 2023-09-07.

    let s = apache_avro::Schema::parse_str(
        r#"{
            "name": "first_insert_dt",
            "type": [
                {
                        "type": "int",
                        "connect.version": 1,
                        "connect.default": 0,
                        "connect.name": "org.apache.kafka.connect.data.Date",
                        "logicalType": "date"
                },
                "null"
            ],
            "default": 0
        }"#,
    )
    .unwrap();

@tabVersion
Copy link
Contributor

I am working on migration from our fork to the official version.

we introduce our crate to handle ref type in Avro, without handling cycle dependency. I am not sure the official sdk has fixed that.

@xiangjinwu
Copy link
Contributor

we introduce our crate to handle ref type in Avro, without handling cycle dependency.

Yes. I have a prototype solution for both ref type and decimal, using the official version rather than our fork.

@xiangjinwu
Copy link
Contributor

Update: The aforementioned schema definition works in upstream apache_avro 0.16.0, but a similar schema definition still fails:

{
    "name": "Root",
    "type": "record",
    "fields": [
        {
        	"name": "first_insert_dt",
	        "type": [
        		{
	        		"type": "int",
		        	"connect.version": 1,
			        "connect.default": 0,
        			"connect.name": "org.apache.kafka.connect.data.Date",
	        		"logicalType": "date"
		        },
        		"null"
	        ],
	        "default": 0
        }
    ]
}

@xiangjinwu xiangjinwu reopened this Nov 20, 2023
@xiangjinwu xiangjinwu changed the title Bug: customer reported cannot create a Table with kafka connector in DEBEZIUM AVRO format Bug: avro schema with default value for date cannot be parsed Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
3 participants