生成带标题的CSV文件 [英] Generate CSV files with headers

查看:102
本文介绍了生成带标题的CSV文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从元组生成CSV输出.我找不到在文件中生成标头的方法.谁能确认这是否可行?

I am generating CSV outputs from tuples. I can't find a way of generating headers in the files. Could anyone confirm whether this is possible or not?

推荐答案

这可能是可行的,但我还没有找到.我在上游添加了一个flatmap函数,该函数(a)将输出POJO转换为字符串,并且(b)一次性插入标题行.但是对于状态恢复存在一些担忧,以确保状态恢复始终且仅被写入一次.

it might be possible, but I haven't found it. I added a flatmap function upstream that (a) converted the output POJO to a string, and (b) did a one-shot injection of the header row. But there are concerns with state recovery, to ensure it always and only gets written out once.

这篇关于生成带标题的CSV文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆