From issues-return-33499-archive-asf-public=cust-asf.ponee.io@carbondata.apache.org Wed Jan 31 14:30:53 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id BDFF9180662 for ; Wed, 31 Jan 2018 14:30:53 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id ADAF5160C35; Wed, 31 Jan 2018 13:30:53 +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 020E3160C25 for ; Wed, 31 Jan 2018 14:30:52 +0100 (CET) Received: (qmail 3026 invoked by uid 500); 31 Jan 2018 13:30:52 -0000 Mailing-List: contact issues-help@carbondata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@carbondata.apache.org Delivered-To: mailing list issues@carbondata.apache.org Received: (qmail 3016 invoked by uid 99); 31 Jan 2018 13:30:52 -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; Wed, 31 Jan 2018 13:30:52 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 20540E038F; Wed, 31 Jan 2018 13:30:52 +0000 (UTC) From: xubo245 To: issues@carbondata.apache.org Reply-To: issues@carbondata.apache.org References: In-Reply-To: Subject: [GitHub] carbondata pull request #1856: [CARBONDATA-2073][CARBONDATA-1516][Tests] Add... Content-Type: text/plain Message-Id: <20180131133052.20540E038F@git1-us-west.apache.org> Date: Wed, 31 Jan 2018 13:30:52 +0000 (UTC) Github user xubo245 commented on a diff in the pull request: https://github.com/apache/carbondata/pull/1856#discussion_r165051330 --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/timeseries/TestTimeSeriesMatchStrategySuite.scala --- @@ -0,0 +1,294 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.carbondata.integration.spark.testsuite.timeseries + +import java.sql.Timestamp + +import org.apache.spark.sql.{CarbonDatasourceHadoopRelation, Row} +import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan +import org.apache.spark.sql.execution.datasources.LogicalRelation +import org.apache.spark.sql.hive.CarbonRelation +import org.apache.spark.sql.test.util.QueryTest +import org.apache.spark.util.SparkUtil4Test +import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach} + +import org.apache.carbondata.core.constants.CarbonCommonConstants +import org.apache.carbondata.core.util.CarbonProperties + +class TestTimeSeriesMatchStrategySuite extends QueryTest with BeforeAndAfterAll with BeforeAndAfterEach { + + override def beforeAll: Unit = { + SparkUtil4Test.createTaskMockUp(sqlContext) + CarbonProperties.getInstance() + .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, + CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT) + + } + + override protected def beforeEach(): Unit = { + sql("drop table if exists mainTable") + sql( + """ + | CREATE TABLE mainTable( + | mytime timestamp, + | name string, + | age int) + | STORED BY 'org.apache.carbondata.format' + """.stripMargin) + sql(s"LOAD DATA LOCAL INPATH '$resourcesPath/timeseriestest.csv' into table mainTable") + } + + val timeSeries = "preaggregate" + + test("test timeseries match 1: select small size when there are >1 timeseries match") { + + dropDataMaps("maintable", "agg1_minute", "agg2_minute") + sql( + s""" + | create datamap agg1 on table mainTable --- End diff -- ok,done ---