databendlabs / databend-jdbc

jdbc implementation for databend cloud
Apache License 2.0
11 stars 10 forks source link

Get Null value at DBeaver when the field is absolutely not null. #232

Closed pengye91 closed 4 months ago

pengye91 commented 4 months ago

Hi team,

I'm using version 0.2.7 and through DBeaver, some queries will sometimes return null values when the column is absolutely not null.

I did some logging in the jdbc codes, and it turns out the values in the ResultsPageIterator are indeed not null.

and the same issue occurred when I changed from DBeaver to DbVisualizer with the same driver.

please help to check on this, thank you.

hantmac commented 4 months ago

The QuerySchema is :

schema: [QueryRowField{name=fiscal_week_year, type=DatabendRawType{type=Int32, subType=null, isNullable=true, dataType=DatabendDataType{sqlType=4, displayName=int32, signed=true, length=10, time=false, aliases=[Int32, INTEGER]}, columnSize=10, decimalDigits=null}}, QueryRowField{name=rtm, type=DatabendRawType{type=String, subType=null, isNullable=true, dataType=DatabendDataType{sqlType=12, displayName=string, signed=false, length=2147483647, time=false, aliases=[String, VARCHAR]}, columnSize=2147483647, decimalDigits=null}}, QueryRowField{name=rtm_l2, type=DatabendRawType{type=String, subType=null, isNullable=true, dataType=DatabendDataType{sqlType=12, displayName=string, signed=false, length=2147483647, time=false, aliases=[String, VARCHAR]}, columnSize=2147483647, decimalDigits=null}}, QueryRowField{name=disti_id, type=DatabendRawType{type=String, subType=null, isNullable=true, dataType=DatabendDataType{sqlType=12, displayName=string, signed=false, length=2147483647, time=false, aliases=[String, VARCHAR]}, columnSize=2147483647, decimalDigits=null}}, QueryRowField{name=disti_name, type=DatabendRawType{type=String, subType=null, isNullable=true, dataType=DatabendDataType{sqlType=12, displayName=string, signed=false, length=2147483647, time=false, aliases=[String, VARCHAR]}, columnSize=2147483647, decimalDigits=null}}, QueryRowField{name=hier_node_level_1_name, type=DatabendRawType{type=String, subType=null, isNullable=true, dataType=DatabendDataType{sqlType=12, displayName=string, signed=false, length=2147483647, time=false, aliases=[String, VARCHAR]}, columnSize=2147483647, decimalDigits=null}}, QueryRowField{name=total_pos_cnt, type=DatabendRawType{type=UInt64, subType=null, isNullable=false, dataType=DatabendDataType{sqlType=-5, displayName=uint64, signed=false, length=20, time=false, aliases=[UInt64, BIGINT UNSIGNED]}, columnSize=20, decimalDigits=null}}, QueryRowField{name=total_pos_so, type=DatabendRawType{type=Int64, subType=null, isNullable=true, dataType=DatabendDataType{sqlType=-5, displayName=int64, signed=true, length=19, time=false, aliases=[Int64, BIGINT]}, columnSize=19, decimalDigits=null}}]
resultSet: com.databend.jdbc.DatabendResultSet@fd5070
rows: [[202440, Multibrand, OTC, 523144, Telling, iPad, 1097, 8807], [202440, Multibrand, Mass Merchant, 268563, IM, Mac, 6, 18], [202440, Multibrand, Township, 3836640, HZZL, iPhone, 4001, 10102], [202440, Multibrand, OTC, 523144, Telling, Watch, 301, 845], [202440, Multibrand, OTC, 523144, Telling, AirPods, 398, 428], [202440, Multibrand, OTC, 1798225, Yueyang, Watch, 87, 109], [202440, Multibrand, Township, 3484362, JJYT, AirPods, 2257, 2316], [202440, Multibrand, OTC, 290541, ASD, NULL, 176, null], [202440, Multibrand, OTC, 523144, Telling, iPhone, 1638, 31218], [202440, Multibrand, Mass Merchant, 2933425, JRZJ, NULL, 21, null], [202440, Multibrand, OTC, 1798225, Yueyang, NULL, 153, null], [202440, Multibrand, Township, 3836640, HZZL, NULL, 5941, null], [202440, Multibrand, Township, 3836640, HZZL, AirPods, 2, 1], [202440, Multibrand, OTC, 290541, ASD, iPad, 679, 7308], [202440, Multibrand, Township, 3484362, JJYT, iPad, 677, 919], [202440, Multibrand, Mass Merchant, 3870416, SKPD, iPhone, 60, 150], [202440, Multibrand, Mass Merchant, 1650374, Zarva, Mac, 79, 193], [202440, Multibrand, Township, 3484362, JJYT, iPhone, 5636, 15369], [202440, Multibrand, Mass Merchant, 1650374, Zarva, iPhone, 312, 4392], [202440, Multibrand, Mass Merchant, 1650374, Zarva, iPad, 212, 1449], [202440, Multibrand, Mass Merchant, 268563, IM, Accessories, 9, 12], [202440, Multibrand, OTC, 290541, ASD, Watch, 10, 10], [202440, Multibrand, Mass Merchant, 268563, IM, AirPods, 7, 14], [202440, Multibrand, OTC, 1798225, Yueyang, iPhone, 636, 3156], [202440, Multibrand, Mass Merchant, 1650374, Zarva, Accessories, 39, 68], [202440, Multibrand, Mass Merchant, 268563, IM, iPhone, 92, 1600], [202440, Multibrand, Mass Merchant, 1650374, Zarva, AirPods, 91, 275], [202440, Multibrand, Mass Merchant, 268563, IM, Beats, 1, 1], [202440, Multibrand, OTC, 1798225, Yueyang, iPad, 310, 587], [202440, Multibrand, Mass Merchant, 268563, IM, NULL, 139, null], [202440, Multibrand, OTC, 523144, Telling, NULL, 59, null], [202440, Multibrand, Mass Merchant, 1650374, Zarva, NULL, 190, null], [202440, Multibrand, Mass Merchant, 1650374, Zarva, Watch, 146, 575], [202440, Multibrand, Mass Merchant, 2933425, JRZJ, AirPods, 1, 1], [202440, Multibrand, Mass Merchant, 2933425, JRZJ, iPhone, 64, 933], [202440, Multibrand, Mass Merchant, 268563, IM, iPad, 27, 49], [202440, Multibrand, Mass Merchant, 268563, IM, Watch, 14, 23], [202440, Multibrand, Township, 3484362, JJYT, NULL, 1620, null], [202440, Multibrand, Mass Merchant, 2933425, JRZJ, iPad, 10, 84], [202440, Multibrand, OTC, 290541, ASD, iPhone, 1812, 35185], [202440, Multibrand, Mass Merchant, 3870416, SKPD, NULL, 146, null], [202440, Multibrand, Mass Merchant, 2933425, JRZJ, Watch, 2, 1]]

but data shown in dbeaver is:

# |fiscal_week_year|rtm       |rtm_l2       |disti_id|disti_name|hier_node_level_1_name|total_pos_cnt|total_pos_so|
--+----------------+----------+-------------+--------+----------+----------------------+-------------+------------+
1 |          202440|Multibrand|OTC          |523144  |Telling   |iPad                  |         1097|        8807|
2 |          202440|Multibrand|Mass Merchant|268563  |IM        |Mac                   |            6|          18|
3 |          202440|Multibrand|Township     |3836640 |HZZL      |iPhone                |         4001|       10102|
4 |          202440|Multibrand|OTC          |523144  |Telling   |Watch                 |          301|         845|
5 |          202440|Multibrand|OTC          |523144  |Telling   |AirPods               |          398|         428|
6 |          202440|Multibrand|OTC          |1798225 |Yueyang   |Watch                 |           87|         109|
7 |          202440|Multibrand|Township     |3484362 |JJYT      |AirPods               |         2257|        2316|
8 |          202440|Multibrand|OTC          |290541  |ASD       |[NULL]                |          176|      [NULL]|
9 |          [NULL]|Multibrand|OTC          |523144  |Telling   |iPhone                |       [NULL]|      [NULL]|
10|          [NULL]|Multibrand|Mass Merchant|2933425 |JRZJ      |[NULL]                |           21|      [NULL]|
11|          [NULL]|Multibrand|OTC          |1798225 |Yueyang   |[NULL]                |          153|      [NULL]|
12|          [NULL]|Multibrand|Township     |3836640 |HZZL      |[NULL]                |         5941|      [NULL]|
13|          [NULL]|Multibrand|Township     |3836640 |HZZL      |AirPods               |       [NULL]|      [NULL]|
14|          [NULL]|Multibrand|OTC          |290541  |ASD       |iPad                  |       [NULL]|      [NULL]|
15|          [NULL]|Multibrand|Township     |3484362 |JJYT      |iPad                  |       [NULL]|      [NULL]|
16|          [NULL]|Multibrand|Mass Merchant|3870416 |SKPD      |iPhone                |       [NULL]|      [NULL]|
17|          [NULL]|Multibrand|Mass Merchant|1650374 |Zarva     |Mac                   |       [NULL]|      [NULL]|
18|          [NULL]|Multibrand|Township     |3484362 |JJYT      |iPhone                |       [NULL]|      [NULL]|
19|          [NULL]|Multibrand|Mass Merchant|1650374 |Zarva     |iPhone                |       [NULL]|      [NULL]|
20|          [NULL]|Multibrand|Mass Merchant|1650374 |Zarva     |iPad                  |       [NULL]|      [NULL]|
21|          [NULL]|Multibrand|Mass Merchant|268563  |IM        |Accessories           |       [NULL]|      [NULL]|
22|          [NULL]|Multibrand|OTC          |290541  |ASD       |Watch                 |       [NULL]|      [NULL]|
23|          [NULL]|Multibrand|Mass Merchant|268563  |IM        |AirPods               |       [NULL]|      [NULL]|
24|          [NULL]|Multibrand|OTC          |1798225 |Yueyang   |iPhone                |       [NULL]|      [NULL]|
25|          [NULL]|Multibrand|Mass Merchant|1650374 |Zarva     |Accessories           |       [NULL]|      [NULL]|
26|          [NULL]|Multibrand|Mass Merchant|268563  |IM        |iPhone                |       [NULL]|      [NULL]|
27|          [NULL]|Multibrand|Mass Merchant|1650374 |Zarva     |AirPods               |       [NULL]|      [NULL]|
28|          [NULL]|Multibrand|Mass Merchant|268563  |IM        |Beats                 |       [NULL]|      [NULL]|
29|          [NULL]|Multibrand|OTC          |1798225 |Yueyang   |iPad                  |       [NULL]|      [NULL]|
30|          [NULL]|Multibrand|Mass Merchant|268563  |IM        |[NULL]                |          139|      [NULL]|
31|          [NULL]|Multibrand|OTC          |523144  |Telling   |[NULL]                |           59|      [NULL]|
32|          [NULL]|Multibrand|Mass Merchant|1650374 |Zarva     |[NULL]                |          190|      [NULL]|
33|          [NULL]|Multibrand|Mass Merchant|1650374 |Zarva     |Watch                 |       [NULL]|      [NULL]|
34|          [NULL]|Multibrand|Mass Merchant|2933425 |JRZJ      |AirPods               |       [NULL]|      [NULL]|
35|          [NULL]|Multibrand|Mass Merchant|2933425 |JRZJ      |iPhone                |       [NULL]|      [NULL]|
36|          [NULL]|Multibrand|Mass Merchant|268563  |IM        |iPad                  |       [NULL]|      [NULL]|
37|          [NULL]|Multibrand|Mass Merchant|268563  |IM        |Watch                 |       [NULL]|      [NULL]|
38|          [NULL]|Multibrand|Township     |3484362 |JJYT      |[NULL]                |         1620|      [NULL]|
39|          [NULL]|Multibrand|Mass Merchant|2933425 |JRZJ      |iPad                  |       [NULL]|      [NULL]|
40|          [NULL]|Multibrand|OTC          |290541  |ASD       |iPhone                |       [NULL]|      [NULL]|
41|          [NULL]|Multibrand|Mass Merchant|3870416 |SKPD      |[NULL]                |          146|      [NULL]|
42|          [NULL]|Multibrand|Mass Merchant|2933425 |JRZJ      |Watch                 |       [NULL]|      [NULL]|
hantmac commented 4 months ago

Using jdbc code works well. Maybe something wrong with dbeaver.