Unnesting RECORD arrays in BigQuery SQL

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ธ.ค. 2024

ความคิดเห็น • 17

  • @gerritrindermann632
    @gerritrindermann632 4 ปีที่แล้ว +8

    I think conceptually you misunderstood something. It's not that you can't reference 3 levels deep. It's about unnesting is for arrays. What you did @4:54 with referencing into the second level is because that's actually a struct.
    You can see that in the schema. REPEATED means Array, RECORD means struct.
    In general what happens though that you have an array of structs. I think that's why you came up with the idea that the 3rd level needs to be unnested.
    I'm just leaning big query as well. So correct me if I'm wrong :)

    • @cacheworthy
      @cacheworthy  4 ปีที่แล้ว +2

      You may be right! I just do what gets the job done :)

    • @datacleaningchallenge2029
      @datacleaningchallenge2029 2 ปีที่แล้ว

      Can iHave your email? wanna ask a question if you don't mind

  • @arzoo7380
    @arzoo7380 4 ปีที่แล้ว +2

    Hey can you write unnest query that will flatten nested array or array inside array as well.

  • @judetoussaint3900
    @judetoussaint3900 4 ปีที่แล้ว +3

    I have a question. Why didn't you unnest Totals. It's also a record. Why unnest only hits. What's the difference?

  • @iamfavoured9142
    @iamfavoured9142 ปีที่แล้ว +1

    Thank you for This series
    God bless you

  • @thiagogramulha
    @thiagogramulha 4 ปีที่แล้ว +1

    What's the difference between CROSS JOIN and ","? It'll get different results? Or it is just another way to do the same thing?

    • @cacheworthy
      @cacheworthy  4 ปีที่แล้ว

      Hmm not sure I follow Thiago, can you drop an example here?

  • @jurges8544
    @jurges8544 5 ปีที่แล้ว

    Hello
    Thank you for the course, i wanted to unnest traffic but the error message said it need to be a string. I wanted to know the difference between hits and traffic is because hits is repeated not nullable?

    • @cacheworthy
      @cacheworthy  4 ปีที่แล้ว

      Hey Jurge, sorry I'm not 100% sure what you're referring to there, could you ask that another way?

  • @rahulkhare3040
    @rahulkhare3040 4 ปีที่แล้ว

    how to handle this error. new to bigquery. please help.
    error : Column name name is ambiguous at [2:1]

  • @ayisha924
    @ayisha924 4 ปีที่แล้ว

    Awesome video! Thanks for the good work!

  • @andreasbeschorner1215
    @andreasbeschorner1215 2 ปีที่แล้ว

    No need to perform a join on nested data, you can just select from unnest.

  • @andrewknight1751
    @andrewknight1751 2 ปีที่แล้ว

    I want to hug you. Thank you.