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

Incorrect IPC schema encoding for multiple dictionaries #7058

Open
XiangpengHao opened this issue Feb 1, 2025 · 2 comments
Open

Incorrect IPC schema encoding for multiple dictionaries #7058

XiangpengHao opened this issue Feb 1, 2025 · 2 comments
Labels

Comments

@XiangpengHao
Copy link
Contributor

Describe the bug

The following test case should pass, but it errors:

thread 'tests::test_dict_schema' panicked at arrow-flight/src/lib.rs:851:56:
called `Result::unwrap()` on an `Err` value: ParseError("Unable to convert flight info to a message: Type `i64` at position 100 is unaligned.\n\twhile verifying table field `id` at position 100\n\twhile verifying table field `dictionary` at position 76\n\twhile verifying vector element 1 at position 56\n\twhile verifying table field `fields` at position 44\n\t while verifying union variant `MessageHeader::Schema` at position 24\n\twhile verifying table field `header` at position 24\n\n")

To Reproduce

    #[test]
    fn test_dict_schema() {
        let schema = Schema::new(vec![
            Field::new(
                "a",
                DataType::Dictionary(Box::new(DataType::UInt16), Box::new(DataType::Utf8)),
                false,
            ),
            Field::new(
                "b",
                DataType::Dictionary(Box::new(DataType::UInt16), Box::new(DataType::Utf8)),
                false,
            ),
        ]);

        let flight_info = FlightInfo::new().try_with_schema(&schema).unwrap();

        let new_schema = Schema::try_from(flight_info).unwrap();
        assert_eq!(schema, new_schema);
    }

Expected behavior

If the schema only has one dictionary, it would work just fine.

Additional context

@XiangpengHao
Copy link
Contributor Author

Update: my latest finding is that it will panic whenever the dict_id is not 0

Probably related to: #5981

@XiangpengHao
Copy link
Contributor Author

For anyone following along, I think the bug is from flatbuffer, and the workaround is to turnoff the verifier on receiving the data. The data seems to be correct, just the verifier is not happy with it:
XiangpengHao@be255bc

I don't have the bandwidth to fix it from flatbuffer, but if anyone wants to push this, I'm happy to share more my findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant