Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-5342: [Format] Formalize "extension types" in Arrow protocol metadata #4332

Closed
wants to merge 2 commits into from

Conversation

wesm
Copy link
Member

@wesm wesm commented May 17, 2019

This patch proposes a language-independent scheme for annotating built-in Arrow types with a custom type name and serialized representation, per previous discussions on the mailing list.

I am starting a mailing list discussion to hold a vote about this and see if there are other ideas about how to proceed.

``custom_metadata`` field of the ``Field`` metadata structure. These
special extension keys are:

* ``'ARROW:extension_name'`` for the string name identifying the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we formalize that "ARROW:" is a reserved key prefix for metadata.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll do that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@codecov-io
Copy link

codecov-io commented May 17, 2019

Codecov Report

Merging #4332 into master will increase coverage by 1.69%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4332      +/-   ##
==========================================
+ Coverage   87.78%   89.47%   +1.69%     
==========================================
  Files         747      648      -99     
  Lines       85081    91701    +6620     
  Branches     1253        0    -1253     
==========================================
+ Hits        74690    82052    +7362     
+ Misses      10127     9649     -478     
+ Partials      264        0     -264
Impacted Files Coverage Δ
cpp/src/arrow/ipc/metadata-internal.cc 87.46% <100%> (+4.27%) ⬆️
cpp/src/arrow/extension_type-test.cc 97.54% <100%> (ø) ⬆️
r/src/recordbatch.cpp
r/R/Table.R
go/arrow/math/uint64_amd64.go
r/src/symbols.cpp
r/R/Column.R
go/arrow/ipc/file_reader.go
r/src/arrow_types.h
js/src/enum.ts
... and 384 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ae57178...ff7ca2c. Read the comment docs.


* ``'ARROW:extension_name'`` for the string name identifying the
custom data type
* ``'ARROW:extension_data'`` for a serialized representation of the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be called metadata, to be clear it should be small? I asked this on the ML but could you provide an example for how this would be used for Tensors? (and clarify UUIDs wouldn't use it?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding some examples

``KeyValue`` pairs in ``custom_metadata` in the ``Field`` metadata
structure. These extension keys are:

* ``'ARROW:extension_name'`` for the string name identifying the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also commented on the ML, but I think we should recommend this is namespaced in some way so different projects can plugin to the extension system without conflcting. Thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@emkornfield
Copy link
Contributor

LGTM, but I guess we wait for a vote?

key_value_metadata({{"arrow_extension_name", "uuid"},
{"arrow_extension_data", "uuid-type-unique-code"}});
key_value_metadata({{"ARROW:extension_name", "uuid"},
{"ARROW:extension_data", "uuid-type-unique-code"}});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be extension_metadata ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, will fix

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just a nit.

docs/source/format/Metadata.rst Outdated Show resolved Hide resolved
@wesm wesm force-pushed the ARROW-5342 branch 2 times, most recently from e33240c to 10b66bd Compare June 12, 2019 16:05
@@ -192,13 +189,74 @@ categories:

Refer to `Schema.fbs`_ for up-to-date descriptions of each built-in
logical type.
Custom Application Metadata
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An empty new line is missing before this line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

---------------

User-defined "extension" types can be defined setting certain
``KeyValue`` pairs in ``custom_metadata` in the ``Field`` metadata
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"`" is missing after "custom_metadata`".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

wesm added 2 commits June 13, 2019 15:56
…ta key names to use ARROW: prefix

Add section about application metadata and state that ARROW: is a reserved prefix for internal Arrow use

Code review comments, add more extension type examples

Use ARROW:extension namespace for extension type metadata

remove '(colon included)' that is not needed anymore since the colon namespace separator is implicit
@wesm
Copy link
Member Author

wesm commented Jun 14, 2019

+1. Merging on account of mailing list vote passing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants