-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: add string
type
#41
feat: add string
type
#41
Conversation
9d60ce0
to
37d6f0a
Compare
Note: 2 missing test files, have weird failures I will analyze later today. |
b09bd62
to
46dace8
Compare
The conclusion of my analysis is that the round tripping of the string attribute tests fail because it does not recognize My new String Attribute is called |
2ce1477
to
15d2e21
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, modulo the question about the built-in string attribute.
}]; | ||
} | ||
|
||
def Substrait_StrAttr : Substrait_Attr<"Str", "string", [DeclareAttrInterfaceMethods<TypedAttrInterface>]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that there is a StringAttr
in the built-in dialect. I don't understand all subtleties about using it but if we don't use it, it should be a conscious decision. Did you look at it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I originally was using the StringAttr (built-in type) but was getting failing tests on the literals.
"The conclusion of my analysis is that the round tripping of the string attribute tests fail because it does not recognize !substrait.string as a type and recognizes is as none instead. I have therefore rebased this PR on top of the Substrait_Attr Base class PR so I can write my own custom string attr base class (currently I use MLIR built in string attr).
My new String Attribute is called StrAttr to disambiguate from MLIR's StringAttr."
That's why I created this custom type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to understand this in more detail. Do you happen to have an old version of the code where the problem occurred? Does this do what you wanted to achieve? It yes, it's probably a good starting point for doing the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally I was using the builtin StrAttr
and wrote this test case.
// RUN: substrait-translate -substrait-to-protobuf %s \
// RUN: | FileCheck %s
// RUN: substrait-translate -substrait-to-protobuf %s \
// RUN: | substrait-translate -protobuf-to-substrait \
// RUN: | substrait-translate -substrait-to-protobuf \
// RUN: | FileCheck %s
// CHECK-LABEL: relations {
// CHECK-NEXT: rel {
// CHECK-NEXT: project {
// CHECK-NEXT: common {
// CHECK-NEXT: direct {
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: input {
// CHECK-NEXT: read {
// CHECK: expressions {
// CHECK-NEXT: literal {
// CHECK-NEXT: string: "hi"
substrait.plan version 0 : 42 : 1 {
relation {
%0 = named_table @t1 as ["a"] : tuple<si1>
%1 = project %0 : tuple<si1> -> tuple<si1, !substrait.string> {
^bb0(%arg : tuple<si1>):
%hi = literal "hi" : !substrait.string
yield %hi : !substrait.string
}
yield %1 : tuple<si1, !substrait.string>
}
}
This test was failing and the problem I was getting was that it was inferring the return type of the literal Op as none
, and subsequently the project op as tuple(s1, none)
was the note/error I was getting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I figured it out, see #55.
@@ -77,6 +77,14 @@ void printCountAsAll(OpAsmPrinter &printer, Operation *op, IntegerAttr count) { | |||
// Normal integer. | |||
printer << count.getValue(); | |||
} | |||
|
|||
//===----------------------------------------------------------------------===// | |||
// Substrait types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Substrait types | |
// Substrait attributes |
version { | ||
minor_number: 42 | ||
patch_number: 1 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: final new line.
6af53a3
to
4bacf51
Compare
a060767
to
434cbeb
Compare
@ingomueller-net |
81ba181
to
fc75c49
Compare
Nice!! 🎉 |
Added
string
types +string
attribute types.This is a stacked PR, please only review latest commit (15d2e21)
@ingomueller-net