[ 
https://issues.apache.org/jira/browse/AURORA-1991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16617039#comment-16617039
 ] 

Renan DelValle commented on AURORA-1991:
----------------------------------------

[~jingc] thanks for calling attention to this. [~ezetowers] submitted a patch 
to fix this and it landed in master in July :) 
[https://github.com/apache/aurora/commit/efe8656512373389771aff88c2141940f925ad58]

Closing this as fixed!

> TaskEvents in API Thrift should have optional parameters
> --------------------------------------------------------
>
>                 Key: AURORA-1991
>                 URL: https://issues.apache.org/jira/browse/AURORA-1991
>             Project: Aurora
>          Issue Type: Bug
>          Components: Client
>    Affects Versions: 0.19.1
>            Reporter: Ezequiel Torres
>            Priority: Minor
>
> h1. *+What?+*
> Struct 
> [TaskQuery|https://git-wip-us.apache.org/repos/asf?p=aurora.git;a=blob;f=api/src/main/thrift/org/apache/aurora/gen/api.thrift;h=7265b11103aa12743c42355163ae64e98e965d7f;hb=HEAD#l579]
>  should have optional parameters in order to be able to be used in languages 
> like Go where types does not have a null value by default.
> The following is the autogenerated code created by Thrift with optional 
> parameters and without optional parameters in Golang:
> +*_Without Optional Parameters_*+
> {code}
> type TaskQuery struct {
>   // unused field # 1
>   JobName string `thrift:"jobName,2" json:"jobName"`
>   // unused field # 3
>   TaskIds map[string]bool `thrift:"taskIds,4" json:"taskIds"`
>   Statuses map[ScheduleStatus]bool `thrift:"statuses,5" json:"statuses"`
>   // unused field # 6
>   InstanceIds map[int32]bool `thrift:"instanceIds,7" json:"instanceIds"`
>   // unused field # 8
>   Environment string `thrift:"environment,9" json:"environment"`
>   SlaveHosts map[string]bool `thrift:"slaveHosts,10" json:"slaveHosts"`
>   JobKeys map[*JobKey]bool `thrift:"jobKeys,11" json:"jobKeys"`
>   Offset int32 `thrift:"offset,12" json:"offset"`
>   Limit int32 `thrift:"limit,13" json:"limit"`
>   Role string `thrift:"role,14" json:"role"`
> }
> {code}
> _*+With Optional Parameters+*_
> {code}
> type TaskQuery struct {
>       // unused field # 1
>       JobName *string `thrift:"jobName,2" json:"jobName"`
>       // unused field # 3
>       TaskIds  map[string]bool         `thrift:"taskIds,4" json:"taskIds"`
>       Statuses map[ScheduleStatus]bool `thrift:"statuses,5" json:"statuses"`
>       // unused field # 6
>       InstanceIds map[int32]bool `thrift:"instanceIds,7" json:"instanceIds"`
>       // unused field # 8
>       Environment *string          `thrift:"environment,9" json:"environment"`
>       SlaveHosts  map[string]bool  `thrift:"slaveHosts,10" json:"slaveHosts"`
>       JobKeys     map[*JobKey]bool `thrift:"jobKeys,11" json:"jobKeys"`
>       Offset      *int32           `thrift:"offset,12" json:"offset"`
>       Limit       *int32           `thrift:"limit,13" json:"limit"`
>       Role        *string          `thrift:"role,14" json:"role"`
> }
> {code}
> It can be seen that with an optional parameters like JobName, Role and 
> Environment now can be set with a null value
> h1. *+Why?+*
> With the current structure of the TaskQuery object, it is not possible to 
> make queries without explicitly setting all the fields of the TaskQuery 
> object in Golang. Moreover, the lack of a null value in the structure of the 
> TaskQuery object limits the type of queries that can be obtained from the 
> Aurora Thrift API in Golang since a parameter cannot be skipped.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to