Can the writer support the scenario when the output is a positional file with header&data?

未关闭
#843 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
42/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
冷清
技术栈
scala, spark
领域
data

调研方向

检查 writer 的 positional-file 路径,以及它如何接受 Spark DataFrames 和 copybooks。将提议的 header/data 拆分和文件合并与 writer 的现有行为进行比较;当 issue 中记录了受支持的方法,或有一个范围明确且包含测试的实现计划时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

question

Question

Can the writer support the scenario when the output is a positional file with header&data?

Considering header and data as two different sets of records having different schemas, usually header is 1 row while data is N row.

What I was considering:

  • manage header and data in same Spark Dataframe. Resulting in a Df with schema the union of columns of header and columns of data. Headers column will have values only in first row and nulls in the rest N rows, while data columns will have nulls in first row and values only in N rows after the first one (where N is the number of records in my df)
  • write the df with 2 different copybooks: 1 with the header schema (writing only top 1 row), 1 with the data schema (writing all rows except first one). when writing all the columns not in the copybook will not be written to outputs
  • the results: 2 separate files
  • merge them together following the order header>data.

Do you think it will work? Is there something smarter?

主要语言
Scala
星标
170
派生
96
平均合并
7 天 5 小时
30 天内合并 PR
4

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AbsaOSS/cobrix 的其他 Issue

查看 AbsaOSS/cobrix 的全部 Issue

相似的 Issue

更多 Scala Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。