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

KSQL should support nested AVRO records #638

Closed
getachew opened this issue Jan 17, 2018 · 35 comments
Closed

KSQL should support nested AVRO records #638

getachew opened this issue Jan 17, 2018 · 35 comments

Comments

@getachew
Copy link

Hello folks,
I get this error while creating a stream for an Avro schema that has a nested type declaration. Not sure if this is an issue on my side but appreciate any input.

Could not fetch the AVRO schema from schema registry. Cannot find correct type for avro type: AddressUSRecord for a schema that looks like

{
    "name": "person",
    "type": "record",
    "fields": [
        {"name": "firstname", "type": "string"},
        {"name": "lastname", "type": "string"},
        {
            "name": "address",
            "type": {
                        "type" : "record",
                        "name" : "AddressUSRecord",
                        "fields" : [
                            {"name": "streetaddress", "type": "string"},
                            {"name": "city", "type": "string"}
                        ]
                    },
        }
    ]
}
@hjafarpour
Copy link
Contributor

@getachew KSQL does not support nested column types yet. You need to flatten your records first. We plan to add support to the nested types.

@getachew
Copy link
Author

Thanks @hjafarpour
I will start looking into the source to see if I can add support and contribute.

@peoplemerge
Copy link

+1

@miguno
Copy link
Contributor

miguno commented Feb 8, 2018

For the record, support for nested data structures is something that we are planning to add. It's just not available right now.

@apurvam apurvam changed the title Cannot find correct type for nested AVRO records KSQL should support nested AVRO records Feb 13, 2018
@KyleJamesWalker
Copy link

KyleJamesWalker commented Feb 14, 2018

With the title change and labels, is this a good place to track progress on KSQL supporting nesting? @apurvam if not is there anything tracking this?

@apurvam
Copy link
Contributor

apurvam commented Feb 14, 2018

@KyleJamesWalker this is the place to track progress on this feature. We are going to standardize on using these issues to gauge interest in features, and that will help with prioritization.

As things go, this is pretty high up on the feature requests.

@conorfennell
Copy link

Just to add for priorities, this is a blocker on my team for using KSQL

@julienmmm
Copy link

+1.

@tommyshiou
Copy link

+1

@peoplemerge
Copy link

+1'd already but a blocker for me too.

@VladMl
Copy link

VladMl commented Mar 19, 2018

+1

@zamirarif
Copy link

I need this desperately :)

I hope it will be accommodated soon.

@jdlindu
Copy link

jdlindu commented Mar 24, 2018

+1

2 similar comments
@dongbin
Copy link

dongbin commented Mar 26, 2018

+1

@betocols
Copy link

+1

@jay999123
Copy link

I'm too facing this issue. Hope this will be fixed soon

@piotr-yuxuan
Copy link

+1

@Igosuki
Copy link

Igosuki commented Mar 30, 2018

  • 1

@Igosuki
Copy link

Igosuki commented Mar 30, 2018

In order to implement this, you simply have to allow columns to have a delimiter and use that to recursively go through structs, nothing more.

@jay999123
Copy link

@Igosuki , Could you please provide more details on your comment? like some examples?
You mean to say that, while querying a topic using KSQL, the topic schema should have
"have to allow columns to have a delimiter" ?

Thanks.

@Igosuki
Copy link

Igosuki commented Apr 2, 2018

Over the top of my head :

select user_agent.os from tracking;

'.' being the delimiter here and the avro schema of records in the tracking stream being :

record Event {
  user_agent UserAgent
}

record UserAgent {
  os string
}

@Igosuki
Copy link

Igosuki commented Apr 2, 2018

When sequencing the query to match fields you can remove the leftmost member of a column name if it corresponds to a table alias of the from clause so delimiters don't clash

@jay999123
Copy link

Has this issue been addressed in the latest release of confluent 4.1?

@apurvam
Copy link
Contributor

apurvam commented Apr 18, 2018

@JanardhanVarikuti no, it isn't in the 4.1 release, but it will be in the next release, sometime in July. Hopefully we will get it in a monthly preview release before that though.

@jay999123
Copy link

@apurvam Thanks for the update.

@lhayhurst
Copy link

Hello! Is this still on track for a July release with a monthly preview release prior to that?
Thank you for prioritizing this :-)

@miguno
Copy link
Contributor

miguno commented May 29, 2018

Yes, this is still on track @lhayhurst.

@gunjanarora
Copy link

Hi,

Is there a developer preview version available to support this?

@apurvam
Copy link
Contributor

apurvam commented Jul 24, 2018

@apurvam
Copy link
Contributor

apurvam commented Jul 31, 2018

This is now available in KSQL 5.0.0.

@apurvam apurvam closed this as completed Jul 31, 2018
@dmi3zkm
Copy link

dmi3zkm commented Sep 27, 2018

@apurvam @miguno
Sorry to bother.
I know there is a note in docs saying that it's not possible to create nested STRUCT as the result of a query. Just curious are there any plans to implement this feature?
Is it possible to accomplish by means of UDF ?

@apurvam
Copy link
Contributor

apurvam commented Sep 27, 2018

It's on the roadmap, but not likely to be tackled any time soon, @dmi3zkm .

@suresh1784
Copy link

@apurvam any update on this?

@agavra
Copy link
Contributor

agavra commented Aug 31, 2020

Hello @suresh1784 - I'm not sure which issue you are referring to, but both the issue in the original description and the one referred to by dmi3zkm are both resolved. To see how to create a struct, please see https://docs.ksqldb.io/en/latest/how-to-guides/query-structured-data/#structs

@suresh1784
Copy link

@agavra , Thanks.

I have one other query, can I get the offset and partition of the topic on which I am creating the KSQL table.

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

No branches or pull requests