从 Pig 获取字段模式的名称

发布于 2024-10-07 21:22:43 字数 313 浏览 0 评论 0原文

我正在为 Pig 开发 JsonStorage。一切工作正常,但至少我需要从猪模式中获取字段的名称(即 crdate、名称、位置)。

| A | crdate: bytearray | name: bytearray | positions: bytearray |

实际上,我通过 StoreFunc 扩展了我的类,它没有提供获取字段名称的函数。

public class PigJsonStorage extends StoreFunc { .. }

有人可以帮助我吗:)

I'm working on a JsonStorage for Pig. Everything works fine, but at least I need to get the names of the fields (i.e. crdate, name, positions) from the pig schema.

| A | crdate: bytearray | name: bytearray | positions: bytearray |

Actually I extend my class by StoreFunc that provides no function to get the names of the fields.

public class PigJsonStorage extends StoreFunc { .. }

Can anybody help me :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

末蓝 2024-10-14 21:22:43

免责声明:我自己对 Pig 有点陌生,还没有实现存储类。

在我看来,StoreFunc 有一个方法: StoreFunc.checkSchema(ResourceSchema s)。我认为您可以从中捕获模式以供在写入期间使用。

disclaimer: I'm a little new to pig myself, and haven't implemented a storage class yet.

It looks to me like StoreFunc has a method for this: StoreFunc.checkSchema(ResourceSchema s). I would think you could just capture the schema from that for use during the write.

眼眸里的快感 2024-10-14 21:22:43

有一个类 JsonMetadata 返回 ResourceSchema ,它有一个方法返回一个字段数组。

There's a class JsonMetadata that returns ResourceSchema which has a method returning an array of fields.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文