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: error occurs while the mysql external dictionary table contains null #16976

Closed
2 tasks done
Dragonliu2018 opened this issue Nov 30, 2024 · 0 comments · Fixed by #16978
Closed
2 tasks done

bug: error occurs while the mysql external dictionary table contains null #16976

Dragonliu2018 opened this issue Nov 30, 2024 · 0 comments · Fixed by #16978
Labels
C-bug Category: something isn't working

Comments

@Dragonliu2018
Copy link
Contributor

Search before asking

  • I had searched in the issues and found no similar issues.

Version

main(7f3ec69)

What's Wrong?

When querying an external dictionary using MySQL as the data source, if there are NULL values in the MySQL table and they are queried, the following error will occur.

error: APIError: ResponseError with 3115: Dictionary Sqlx Error, cause: error occurred while decoding column 1: unexpected null; try decoding as an `Option`

How to Reproduce?

  1. Create a table in the data source (MySQL) and insert data containing NULL values.

    CREATE TABLE user(id int, name varchar(100));
    
    insert into user values(1, 'Amy'), (2, null);
  2. Create the corresponding external dictionary in Databend and query.

    CREATE OR REPLACE DICTIONARY mysql_dic(id int, name string) PRIMARY KEY id SOURCE(mysql(host='localhost' port='3306' username='root' password='123456' db='test' table='user'));
    
    select dict_get(mysql_dic, 'name', 2);

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: something isn't working
Projects
None yet
1 participant