-
Notifications
You must be signed in to change notification settings - Fork 3
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: elide attribute type with new StaticallyTypedAttrInterface
#59
feat: elide attribute type with new StaticallyTypedAttrInterface
#59
Conversation
d3c98d6
to
02f7193
Compare
StaticallyTypedAttrInterface
StaticallyTypedAttrInterface
[WIP]
02f7193
to
1877e60
Compare
StaticallyTypedAttrInterface
[WIP]StaticallyTypedAttrInterface
efadd27
to
007fae0
Compare
007fae0
to
60dcdaa
Compare
@dshaaban01: Have a look at this PR. I managed to elide the attribute type from the assembly. I hope we'll be able to merge it soon, so consider starting any new work based on this PR if it's related. |
60dcdaa
to
418f69f
Compare
This allows to omit the type of an attribute from the assembly if it can be inferred from the attribute value. For example, the type is redundant in `#substrait.timestamp<100us> : !substrait.timestamp`. The built-in `TypedAttrInterface`, however, forces the appearance of the type in the assembly. The new interface is almost identical but does not enforce it. The PR also makes the two timestamp, the date, and the time attributes implement that interface. Signed-off-by: Ingo Müller <[email protected]>
418f69f
to
365e496
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.
Nice, we could even have a variant of this upstream :)
def Substrait_TimeAttr : Substrait_Attr<"Time", "time", | ||
[TypedAttrInterface]> { | ||
def Substrait_TimeAttr : | ||
Substrait_StaticallyTypedAttr<"Time", "time", "TimeType"> { |
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.
Micro nit: add additional spaces here to differentiate from body below (I normally just add 2 extra, else this and body looks at same scope ... I should really try out the new formatter)
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.
Fixed. I tried clang-format
, which seems to work on .td
files as well, and it works. I have formatted the lines of this commit using it. However, I am unsure as to whether and how to apply or enforce it on the existing files. The diff is quite big and a big commit just for reformatting has disadvantages...
} | ||
|
||
def Substrait_TimestampAttr : Substrait_Attr<"Timestamp", "timestamp", | ||
[TypedAttrInterface]> { | ||
def Substrait_TimestampAttr |
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: colon on this line to match the others.
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.
Fixed.
This allows to omit the type of an attribute from the assembly if it can be inferred from the attribute value. For example, the type is redundant in
#substrait.timestamp<100us> : !substrait.timestamp
. The built-inTypedAttrInterface
, however, forces the appearance of the type in the assembly. The new interface is almost identical but does not enforce it. The PR also makes the two timestamp, the date, and the time attributes implement that interface.