This is an automated email from the ASF dual-hosted git repository.

cpcloud pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new fb2ceaa  ARROW-14148: [IR] Add relation identifier to RelBase in 
compute IR
fb2ceaa is described below

commit fb2ceaa78264d8e7134a5eedf9cf01b27fdfd530
Author: Phillip Cloud <[email protected]>
AuthorDate: Wed Oct 13 10:41:36 2021 -0400

    ARROW-14148: [IR] Add relation identifier to RelBase in compute IR
    
    Closes #11254 from cpcloud/ARROW-14148
    
    Authored-by: Phillip Cloud <[email protected]>
    Signed-off-by: Phillip Cloud <[email protected]>
---
 cpp/src/generated/Relation_generated.h | 65 ++++++++++++++++++++++++++++++++--
 experimental/computeir/Relation.fbs    | 11 ++++++
 2 files changed, 74 insertions(+), 2 deletions(-)

diff --git a/cpp/src/generated/Relation_generated.h 
b/cpp/src/generated/Relation_generated.h
index e1e03a3..6c9d9bc 100644
--- a/cpp/src/generated/Relation_generated.h
+++ b/cpp/src/generated/Relation_generated.h
@@ -22,6 +22,9 @@ struct RemapBuilder;
 struct PassThrough;
 struct PassThroughBuilder;
 
+struct RelId;
+struct RelIdBuilder;
+
 struct RelBase;
 struct RelBaseBuilder;
 
@@ -378,12 +381,58 @@ inline flatbuffers::Offset<PassThrough> CreatePassThrough(
   return builder_.Finish();
 }
 
+/// An identifier for relations in a query.
+///
+/// A table is used here to allow plan implementations optionality.
+struct RelId FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+  typedef RelIdBuilder Builder;
+  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+    VT_ID = 4
+  };
+  uint64_t id() const {
+    return GetField<uint64_t>(VT_ID, 0);
+  }
+  bool Verify(flatbuffers::Verifier &verifier) const {
+    return VerifyTableStart(verifier) &&
+           VerifyField<uint64_t>(verifier, VT_ID) &&
+           verifier.EndTable();
+  }
+};
+
+struct RelIdBuilder {
+  typedef RelId Table;
+  flatbuffers::FlatBufferBuilder &fbb_;
+  flatbuffers::uoffset_t start_;
+  void add_id(uint64_t id) {
+    fbb_.AddElement<uint64_t>(RelId::VT_ID, id, 0);
+  }
+  explicit RelIdBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+        : fbb_(_fbb) {
+    start_ = fbb_.StartTable();
+  }
+  RelIdBuilder &operator=(const RelIdBuilder &);
+  flatbuffers::Offset<RelId> Finish() {
+    const auto end = fbb_.EndTable(start_);
+    auto o = flatbuffers::Offset<RelId>(end);
+    return o;
+  }
+};
+
+inline flatbuffers::Offset<RelId> CreateRelId(
+    flatbuffers::FlatBufferBuilder &_fbb,
+    uint64_t id = 0) {
+  RelIdBuilder builder_(_fbb);
+  builder_.add_id(id);
+  return builder_.Finish();
+}
+
 /// Fields common to every relational operator
 struct RelBase FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
   typedef RelBaseBuilder Builder;
   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
     VT_OUTPUT_MAPPING_TYPE = 4,
-    VT_OUTPUT_MAPPING = 6
+    VT_OUTPUT_MAPPING = 6,
+    VT_ID = 8
   };
   org::apache::arrow::computeir::flatbuf::Emit output_mapping_type() const {
     return 
static_cast<org::apache::arrow::computeir::flatbuf::Emit>(GetField<uint8_t>(VT_OUTPUT_MAPPING_TYPE,
 0));
@@ -399,11 +448,18 @@ struct RelBase FLATBUFFERS_FINAL_CLASS : private 
flatbuffers::Table {
   const org::apache::arrow::computeir::flatbuf::PassThrough 
*output_mapping_as_PassThrough() const {
     return output_mapping_type() == 
org::apache::arrow::computeir::flatbuf::Emit::PassThrough ? static_cast<const 
org::apache::arrow::computeir::flatbuf::PassThrough *>(output_mapping()) : 
nullptr;
   }
+  /// An identifiier for a relation. The identifier should be unique over the
+  /// entire plan. Optional.
+  const org::apache::arrow::computeir::flatbuf::RelId *id() const {
+    return GetPointer<const org::apache::arrow::computeir::flatbuf::RelId 
*>(VT_ID);
+  }
   bool Verify(flatbuffers::Verifier &verifier) const {
     return VerifyTableStart(verifier) &&
            VerifyField<uint8_t>(verifier, VT_OUTPUT_MAPPING_TYPE) &&
            VerifyOffsetRequired(verifier, VT_OUTPUT_MAPPING) &&
            VerifyEmit(verifier, output_mapping(), output_mapping_type()) &&
+           VerifyOffset(verifier, VT_ID) &&
+           verifier.VerifyTable(id()) &&
            verifier.EndTable();
   }
 };
@@ -426,6 +482,9 @@ struct RelBaseBuilder {
   void add_output_mapping(flatbuffers::Offset<void> output_mapping) {
     fbb_.AddOffset(RelBase::VT_OUTPUT_MAPPING, output_mapping);
   }
+  void 
add_id(flatbuffers::Offset<org::apache::arrow::computeir::flatbuf::RelId> id) {
+    fbb_.AddOffset(RelBase::VT_ID, id);
+  }
   explicit RelBaseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
         : fbb_(_fbb) {
     start_ = fbb_.StartTable();
@@ -442,8 +501,10 @@ struct RelBaseBuilder {
 inline flatbuffers::Offset<RelBase> CreateRelBase(
     flatbuffers::FlatBufferBuilder &_fbb,
     org::apache::arrow::computeir::flatbuf::Emit output_mapping_type = 
org::apache::arrow::computeir::flatbuf::Emit::NONE,
-    flatbuffers::Offset<void> output_mapping = 0) {
+    flatbuffers::Offset<void> output_mapping = 0,
+    flatbuffers::Offset<org::apache::arrow::computeir::flatbuf::RelId> id = 0) 
{
   RelBaseBuilder builder_(_fbb);
+  builder_.add_id(id);
   builder_.add_output_mapping(output_mapping);
   builder_.add_output_mapping_type(output_mapping_type);
   return builder_.Finish();
diff --git a/experimental/computeir/Relation.fbs 
b/experimental/computeir/Relation.fbs
index bf3a18a..ab0156e 100644
--- a/experimental/computeir/Relation.fbs
+++ b/experimental/computeir/Relation.fbs
@@ -41,10 +41,21 @@ union Emit {
   PassThrough,
 }
 
+/// An identifier for relations in a query.
+///
+/// A table is used here to allow plan implementations optionality.
+table RelId {
+  id: uint64;
+}
+
 /// Fields common to every relational operator
 table RelBase {
   /// Output remapping of ordinal columns for a given operation
   output_mapping: Emit (required);
+
+  /// An identifiier for a relation. The identifier should be unique over the
+  /// entire plan. Optional.
+  id: RelId;
 }
 
 /// Filter operation

Reply via email to