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

chore: move enums to separate file #51

Merged
merged 2 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions include/substrait-mlir/Dialect/Substrait/IR/SubstraitEnums.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//===-- SubstraitEnums.td - Substrait enums definitions ----*- tablegen -*-===//
//
// Licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef SUBSTRAIT_DIALECT_SUBSTRAIT_IR_SUBSTRAITENUMS
#define SUBSTRAIT_DIALECT_SUBSTRAIT_IR_SUBSTRAITENUMS

include "mlir/IR/EnumAttr.td"

def AggregationInvocationUnspecified: I32EnumAttrCase<"unspecified", 0>;
def AggregationInvocationAll: I32EnumAttrCase<"all", 1>;
def AggregationInvocationDistinct: I32EnumAttrCase<"distinct", 2>;

/// Represents the `SetOp` protobuf enum.
def SetOpKind : I32EnumAttr<"SetOpKind",
"The enum values correspond to those in the SetRel.SetOp message.", [
I32EnumAttrCase<"unspecified", 0>,
I32EnumAttrCase<"minus_primary", 1>,
I32EnumAttrCase<"minus_multiset", 2>,
I32EnumAttrCase<"intersection_primary", 3>,
I32EnumAttrCase<"intersection_multiset", 4>,
I32EnumAttrCase<"union_distinct", 5>,
I32EnumAttrCase<"union_all", 6>] > {
let cppNamespace = "::mlir::substrait";
}

#endif // SUBSTRAIT_DIALECT_SUBSTRAIT_IR_SUBSTRAITENUMS
11 changes: 1 addition & 10 deletions include/substrait-mlir/Dialect/Substrait/IR/SubstraitOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define SUBSTRAIT_DIALECT_SUBSTRAIT_IR_SUBSTRAITOPS

include "substrait-mlir/Dialect/Substrait/IR/SubstraitDialect.td"
include "substrait-mlir/Dialect/Substrait/IR/SubstraitEnums.td"
include "substrait-mlir/Dialect/Substrait/IR/SubstraitInterfaces.td"
include "substrait-mlir/Dialect/Substrait/IR/SubstraitTypes.td"
include "mlir/Interfaces/InferTypeOpInterface.td"
Expand Down Expand Up @@ -546,16 +547,6 @@ def Substrait_ProjectOp : Substrait_RelOp<"project", [
}];
}

def SetOpKind : I32EnumAttr<"SetOpKind",
"The enum values correspond to those in the SetRel.SetOp message.", [
I32EnumAttrCase<"unspecified", 0>,
I32EnumAttrCase<"minus_primary", 1>,
I32EnumAttrCase<"minus_multiset", 2>,
I32EnumAttrCase<"intersection_primary", 3>,
I32EnumAttrCase<"intersection_multiset", 4>,
I32EnumAttrCase<"union_distinct", 5>,
I32EnumAttrCase<"union_all", 6>] >;

//TODO(daliashaaban): Change type inference logic once nullability is supported.
def Substrait_SetOp : Substrait_RelOp<"set", [
SameOperandsAndResultType
Expand Down
4 changes: 4 additions & 0 deletions lib/Dialect/Substrait/IR/Substrait.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ void SubstraitDialect::initialize() {
>();
}

//===----------------------------------------------------------------------===//
// Substrait enums
//===----------------------------------------------------------------------===//

#include "substrait-mlir/Dialect/Substrait/IR/SubstraitEnums.cpp.inc"

//===----------------------------------------------------------------------===//
Expand Down
Loading