[ 
https://issues.apache.org/jira/browse/CASSGO-118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18071450#comment-18071450
 ] 

Bohdan Siryk commented on CASSGO-118:
-------------------------------------

The issue comes from this 
[code|https://github.com/apache/cassandra-gocql-driver/blob/c65c762b83eccdb6a6a083c123a5935c4302745c/marshal.go#L2857-L2875]:
 # Iterating over the elements of the udt type
 # Check if the name of the UDT field is presented in the provided map
 # Map is nil, so _*val, ok := v[udt.Elements[i].Name]*_ doesn't panic and *_ok 
= false_*
 # Skip marshaling as ok is false
 # adds _*data*_ in result _*buf*_ by calling _*appendBytes*_ which encodes 
length of appended bytes as -1

> Nil map for UDT column inserts zero-valued UDT instead of NULL
> --------------------------------------------------------------
>
>                 Key: CASSGO-118
>                 URL: https://issues.apache.org/jira/browse/CASSGO-118
>             Project: Apache Cassandra Go driver
>          Issue Type: Bug
>            Reporter: Bohdan Siryk
>            Priority: Normal
>
> Inserting a row with a nil map for a UDT-typed column results in a non-NULL 
> value whose fields behave like defaults / zero values, instead of storing 
> NULL for the whole UDT.
> *Expected*
> The UDT column is NULL in DB.
> *Actual*
> The UDT column is present (not NULL) and fields appear as type defaults 
> (empty string, 0, false, etc.).
> To reproduce it, please use this code snippet on github  gist: 
> https://gist.github.com/worryg0d/22810cd6609cae985ca5c53725c3e3ae



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to