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 2FE75200BE8 for ; Fri, 23 Dec 2016 18:22:35 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 2CD15160B1F; Fri, 23 Dec 2016 17:22:35 +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 6F502160B0C for ; Fri, 23 Dec 2016 18:22:34 +0100 (CET) Received: (qmail 26063 invoked by uid 500); 23 Dec 2016 17:22:33 -0000 Mailing-List: contact reviews-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list reviews@spark.apache.org Received: (qmail 26048 invoked by uid 99); 23 Dec 2016 17:22:33 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Dec 2016 17:22:33 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4B284DFBA3; Fri, 23 Dec 2016 17:22:33 +0000 (UTC) From: cloud-fan To: reviews@spark.apache.org Reply-To: reviews@spark.apache.org References: In-Reply-To: Subject: [GitHub] spark pull request #16323: [SPARK-18911] [SQL] Define CatalogStatistics to i... Content-Type: text/plain Message-Id: <20161223172233.4B284DFBA3@git1-us-west.apache.org> Date: Fri, 23 Dec 2016 17:22:33 +0000 (UTC) archived-at: Fri, 23 Dec 2016 17:22:35 -0000 Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/16323#discussion_r93786594 --- Diff: sql/core/src/test/scala/org/apache/spark/sql/StatisticsCollectionSuite.scala --- @@ -260,4 +261,46 @@ abstract class StatisticsCollectionTestBase extends QueryTest with SQLTestUtils } } } + + // This test will be run twice: with and without Hive support + test("conversion from CatalogStatistics to Statistics") { + withTable("ds_tbl", "hive_tbl") { + // Test data source table + checkStatsConversion(tableName = "ds_tbl", isDatasourceTable = true) + // Test hive serde table + if (spark.conf.get(StaticSQLConf.CATALOG_IMPLEMENTATION) == "hive") { + checkStatsConversion(tableName = "hive_tbl", isDatasourceTable = false) + } + } + } + + private def checkStatsConversion(tableName: String, isDatasourceTable: Boolean): Unit = { + // Create an empty table and run analyze command on it. + val col = "c1" + val createTableSql = if (isDatasourceTable) { + s"CREATE TABLE $tableName ($col INT) USING PARQUET" --- End diff -- let's create a table with 2 columns, and only analyze one column, to see if the `attributeStats` only contains one entry. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org For additional commands, e-mail: reviews-help@spark.apache.org