Skip to content

Apache DataFusion SQL Query Engine

ARROW-81: [Format] Augment dictionary encoding metadata to accommodate additional use cases

Wes McKinney7927147fac3c
diff --git a/format/Message.fbs b/format/Message.fbs
index b2c64649f2..028c56ad51 100644
--- a/format/Message.fbs
+++ b/format/Message.fbs
@@ -150,6 +150,26 @@ table KeyValue {
value: [ubyte];
}
+/// ----------------------------------------------------------------------
+/// Dictionary encoding metadata
+
+table DictionaryEncoding {
+ /// The known dictionary id in the application where this data is used. In
+ /// the file or streaming formats, the dictionary ids are found in the
+ /// DictionaryBatch messages
+ id: long;
+
+ /// The dictionary indices are constrained to be positive integers. If this
+ /// field is null, the indices must be signed int32
+ indexType: Int;
+
+ /// By default, dictionaries are not ordered, or the order does not have
+ /// semantic meaning. In some statistical, applications, dictionary-encoding
+ /// is used to represent ordered categorical data, and we provide a way to
+ /// preserve that metadata here
+ isOrdered: bool;
+}
+
/// ----------------------------------------------------------------------
/// A field represents a named column in a record / row batch or child of a
/// nested type.
@@ -163,9 +183,10 @@ table Field {
name: string;
nullable: bool;
type: Type;
- // present only if the field is dictionary encoded
- // will point to a dictionary provided by a DictionaryBatch message
- dictionary: long;
+
+ // Present only if the field is dictionary encoded
+ dictionary: DictionaryEncoding;
+
// children apply only to Nested data types like Struct, List and Union
children: [Field];
/// layout of buffers produced for this type (as derived from the Type)