{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/5542","labels_url":"https://api.github.com/repos/apache/spark/issues/5542/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/5542/comments","events_url":"https://api.github.com/repos/apache/spark/issues/5542/events","html_url":"https://github.com/apache/spark/pull/5542","id":68986125,"number":5542,"title":"[SPARK-4233] [SQL] UDAF Interface Refactoring","user":{"login":"chenghao-intel","id":2367031,"avatar_url":"https://avatars.githubusercontent.com/u/2367031?v=3","gravatar_id":"","url":"https://api.github.com/users/chenghao-intel","html_url":"https://github.com/chenghao-intel","followers_url":"https://api.github.com/users/chenghao-intel/followers","following_url":"https://api.github.com/users/chenghao-intel/following{/other_user}","gists_url":"https://api.github.com/users/chenghao-intel/gists{/gist_id}","starred_url":"https://api.github.com/users/chenghao-intel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chenghao-intel/subscriptions","organizations_url":"https://api.github.com/users/chenghao-intel/orgs","repos_url":"https://api.github.com/users/chenghao-intel/repos","events_url":"https://api.github.com/users/chenghao-intel/events{/privacy}","received_events_url":"https://api.github.com/users/chenghao-intel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":31,"created_at":"2015-04-16T18:46:27Z","updated_at":"2015-06-08T06:42:12Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/5542","html_url":"https://github.com/apache/spark/pull/5542","diff_url":"https://github.com/apache/spark/pull/5542.diff","patch_url":"https://github.com/apache/spark/pull/5542.patch"},"body":"This PR will keep both old / new versions of UDAF, and switch them by\r\n```\r\nSET spark.sql.aggregate2=true/false;\r\n```\r\nThe new interface is\r\n```scala\r\ntrait AggregateFunction2 {\r\n  self: Product =>\r\n\r\n  // Specify the BoundReference for Aggregate Buffer\r\n  def initialize(buffers: Seq[BoundReference]): Unit\r\n\r\n  // Initialize (reinitialize) the aggregation buffer\r\n  def reset(buf: MutableRow): Unit\r\n\r\n  // Get the children value from the input row, and then\r\n  // merge it with the given aggregate buffer,\r\n  // `seen` is the set that the value showed up, that's will\r\n  // be useful for distinct aggregate. And it probably be\r\n  // null for non-distinct aggregate\r\n  def update(input: Row, buf: MutableRow, seen: JSet[Any]): Unit\r\n\r\n  // Merge 2 aggregation buffers, and write back to the later one\r\n  def merge(value: Row, buf: MutableRow): Unit\r\n\r\n  // Semantically we probably don't need this, however, we need it when\r\n  // integrating with Hive UDAF(GenericUDAF)\r\n  @deprecated\r\n  def terminatePartial(buf: MutableRow): Unit = {}\r\n\r\n  // Output the final result by feeding the aggregation buffer\r\n  def terminate(buffer: Row): Any\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/109881214","html_url":"https://github.com/apache/spark/pull/5542#issuecomment-109881214","issue_url":"https://api.github.com/repos/apache/spark/issues/5542","id":109881214,"user":{"login":"AmplabJenkins","id":4031291,"avatar_url":"https://avatars.githubusercontent.com/u/4031291?v=3","gravatar_id":"","url":"https://api.github.com/users/AmplabJenkins","html_url":"https://github.com/AmplabJenkins","followers_url":"https://api.github.com/users/AmplabJenkins/followers","following_url":"https://api.github.com/users/AmplabJenkins/following{/other_user}","gists_url":"https://api.github.com/users/AmplabJenkins/gists{/gist_id}","starred_url":"https://api.github.com/users/AmplabJenkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmplabJenkins/subscriptions","organizations_url":"https://api.github.com/users/AmplabJenkins/orgs","repos_url":"https://api.github.com/users/AmplabJenkins/repos","events_url":"https://api.github.com/users/AmplabJenkins/events{/privacy}","received_events_url":"https://api.github.com/users/AmplabJenkins/received_events","type":"User","site_admin":false},"created_at":"2015-06-08T06:42:12Z","updated_at":"2015-06-08T06:42:12Z","body":" Merged build triggered."}}