From issues-return-197244-archive-asf-public=cust-asf.ponee.io@flink.apache.org Wed Oct 24 20:45:40 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 61FD6180675 for ; Wed, 24 Oct 2018 20:45:40 +0200 (CEST) Received: (qmail 67746 invoked by uid 500); 24 Oct 2018 18:45:39 -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 67737 invoked by uid 99); 24 Oct 2018 18:45:39 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Oct 2018 18:45:39 +0000 From: GitBox To: issues@flink.apache.org Subject: [GitHub] xuefuz commented on a change in pull request #6906: [Flink-6036][table]Let catalog support partition. Message-ID: <154040673898.23794.2005594510270794082.gitbox@gitbox.apache.org> Date: Wed, 24 Oct 2018 18:45:38 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit xuefuz commented on a change in pull request #6906: [Flink-6036][table]Let catalog support partition. URL: https://github.com/apache/flink/pull/6906#discussion_r227915200 ########## File path: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/catalog/ExternalCatalogTable.scala ########## @@ -282,34 +296,63 @@ class ExternalCatalogTableBuilder(private val connectorDescriptor: ConnectorDesc this } + /** + * Specifies the partition columns for this external table. + */ + def withPartitionColumnNames( + partitionColumnNames: java.util.LinkedHashSet[String]): ExternalCatalogTableBuilder = { + require(partitionColumnNames != null && !partitionColumnNames.isEmpty) + this.partitionColumnNames = Some(partitionColumnNames) + this + } + /** * Declares this external table as a table source and returns the * configured [[ExternalCatalogTable]]. * * @return External catalog table */ - def asTableSource(): ExternalCatalogTable = { - new ExternalCatalogTable( - isBatch, - isStreaming, - isSource = true, - isSink = false, - DescriptorProperties.toJavaMap(this)) - } + def asTableSource(): ExternalCatalogTable = this.partitionColumnNames match { + case Some(pc) => + new ExternalCatalogPartitionedTable( + isBatch, + isStreaming, + isSource = true, + isSink = false, + pc, + DescriptorProperties.toJavaMap(this) + ) + case None => + new ExternalCatalogTable( + isBatch, + isStreaming, + isSource = true, + isSink = false, + DescriptorProperties.toJavaMap(this)) + } /** * Declares this external table as a table sink and returns the * configured [[ExternalCatalogTable]]. * * @return External catalog table */ - def asTableSink(): ExternalCatalogTable = { - new ExternalCatalogTable( - isBatch, - isStreaming, - isSource = false, - isSink = true, - DescriptorProperties.toJavaMap(this)) + def asTableSink(): ExternalCatalogTable = this.partitionColumnNames match { Review comment: I see a repeated pattern in the three asXXX methods. While it's not introduced in this PR, it might be good if we can introduce a help method that those asXXX methods call to minimize the repetition. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services