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

Struct array elements are being serialized before writing to Array column #724

Closed
cchandurkar opened this issue Oct 16, 2023 · 4 comments
Closed
Assignees

Comments

@cchandurkar
Copy link

cchandurkar commented Oct 16, 2023

I have a field in avro schema that is an Array of Struct type. Table has an existing column that's of Array type. I'm seeing array elements being serialized (Seeing array of stringified JSON in the SF column). Since the column is Array, it can take an array of object (struct/variant). Is there any way to disable this serialization and treat the elements as a variant instead?

Here's a quick comparison:
Expected value in column:

[
  null,
  {
    "xCategory": null,
    "xEntityId": null,
    "xEntityName": null,
    "xId": "89asda9s0a"
  }
]

Actual:

[
  "null",
  "{\"xCategory\":null,\"xEntityId\":null,\"xId\":\"89asda9s0a\",\"xEntityName\":null}"
]
@cchandurkar cchandurkar changed the title Struct array elements are being serialized before writing to VARIANT column Struct array elements are being serialized before writing to Array column Oct 16, 2023
@cchandurkar
Copy link
Author

cchandurkar commented Oct 17, 2023

Was digging into the codebase. It looks like this RecordService#getMapFromJsonNodeForStreamingIngest() does not handle objects as array elements and just stringifies it. Is this intentional? What if you recursively build a List<Object> instead of List<String> ?

@sfc-gh-azagrebin
Copy link

This is indeed not clear why to stringify array elements. SDK would indeed treat it as a string.
@sfc-gh-japatel @sfc-gh-tzhang wdyt?

@sfc-gh-zefan is it expected this way for Snowpipe?

@sfc-gh-azagrebin
Copy link

Looks like this is being addressed in #730.

@cchandurkar
Copy link
Author

cchandurkar commented Nov 4, 2023

Closing as this is fixed in #730.

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

No branches or pull requests

3 participants