Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 42986200D07 for ; Tue, 28 Jun 2016 09:08:59 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3F01F160A72; Tue, 28 Jun 2016 07:08:59 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8DB13160A56 for ; Tue, 28 Jun 2016 09:08:58 +0200 (CEST) Received: (qmail 61352 invoked by uid 500); 28 Jun 2016 07:08:57 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 61097 invoked by uid 99); 28 Jun 2016 07:08:57 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Jun 2016 07:08:57 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 49FCB2C1F61 for ; Tue, 28 Jun 2016 07:08:57 +0000 (UTC) Date: Tue, 28 Jun 2016 07:08:57 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-3943) Add support for EXCEPT (set minus) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 28 Jun 2016 07:19:01 -0000 [ https://issues.apache.org/jira/browse/FLINK-3943?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15352499#comment-15352499 ] ASF GitHub Bot commented on FLINK-3943: --------------------------------------- Github user wuchong commented on a diff in the pull request: https://github.com/apache/flink/pull/2169#discussion_r68706865 --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/plan/logical/operators.scala --- @@ -236,6 +236,32 @@ case class Aggregate( } } +case class SetMinus(left: LogicalNode, right: LogicalNode, all: Boolean) extends BinaryNode { + override def output: Seq[Attribute] = left.output + + override protected[logical] def construct(relBuilder: RelBuilder): RelBuilder = { + left.construct(relBuilder) + right.construct(relBuilder) + relBuilder.minus(all) + } + + override def validate(tableEnv: TableEnvironment): LogicalNode = { + val resolvedMinus = super.validate(tableEnv).asInstanceOf[SetMinus] + if (left.output.length != right.output.length) { + failValidation(s"Set minus two table of different column sizes:" + + s" ${left.output.size} and ${right.output.size}") + } + val sameSchema = left.output.zip(right.output).forall { case (l, r) => + l.resultType == r.resultType && l.name == r.name } --- End diff -- I think both tables must have the same number of fields with similar data types, but they can accept different field names. e.g. `testMinusDifferentFieldNames` should pass without no exception. Correct me if I'm wrong. > Add support for EXCEPT (set minus) > ---------------------------------- > > Key: FLINK-3943 > URL: https://issues.apache.org/jira/browse/FLINK-3943 > Project: Flink > Issue Type: New Feature > Components: Table API & SQL > Affects Versions: 1.1.0 > Reporter: Fabian Hueske > Assignee: Ivan Mushketyk > Priority: Minor > > Currently, the Table API and SQL do not support EXCEPT. > EXCEPT can be executed as a coGroup on all fields that forwards records of the first input if the second input is empty. > In order to add support for EXCEPT to the Table API and SQL we need to: > - Implement a {{DataSetMinus}} class that translates an EXCEPT into a DataSet API program using a coGroup on all fields. > - Implement a {{DataSetMinusRule}} that translates a Calcite {{LogicalMinus}} into a {{DataSetMinus}}. > - Extend the Table API (and validation phase) to provide an except() method. -- This message was sent by Atlassian JIRA (v6.3.4#6332)