将不同模式的结构放入数组spark

0yycz8jy  于 2021-07-12  发布在  Spark
关注(0)|答案(0)|浏览(188)

我面临一个Spark逻辑问题。我有一个包含struct(bfe0)的struct(itfs)。。。以及其他一些随机的名字)。
我想把所有的子结构放到一个数组中,这样我就可以分解它们为每个itf生成行。
但我不能,因为模式问题。dea01和bfe0没有相同的架构。
有没有一种方法可以过滤子结构,只保留带有ifs cols的子结构,然后将它们放入数组中,或者将dea01转换为bfe0的模式?
ITF中的子结构的名称是随机的,这增加了一点复杂性。。。

  1. |-- itfs: struct (nullable = true)
  2. | |-- Bfe0: struct (nullable = true)
  3. | | |-- if6: string (nullable = true)
  4. | | |-- if5: string (nullable = true)
  5. | | |-- if4: string (nullable = true)
  6. | | |-- ifIndex: string (nullable = true)
  7. | | |-- ifName: string (nullable = true)
  8. | | |-- if3: string (nullable = true)
  9. | | |-- if2: string (nullable = true)
  10. | | |-- if1: string (nullable = true)
  11. | |-- dea01: struct (nullable = true)
  12. | | |-- ifName: string (nullable = true)
  13. | |-- daa02: struct (nullable = true)
  14. | | |-- ifName: string (nullable = true)
  15. | |-- int1: struct (nullable = true)
  16. | | |-- if6: string (nullable = true)
  17. | | |-- if5: string (nullable = true)
  18. | | |-- if4: string (nullable = true)
  19. | | |-- ifIndex: string (nullable = true)
  20. | | |-- ifName: string (nullable = true)
  21. | | |-- if3: string (nullable = true)
  22. | | |-- if2: string (nullable = true)
  23. | | |-- if1: string (nullable = true)```

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题