diff --git a/kyuubi-main/src/test/resources/tpcds-1_4/q3/q3.sql b/kyuubi-main/src/test/resources/tpcds-1_4/q3/q3.sql new file mode 100755 index 000000000..924576260 --- /dev/null +++ b/kyuubi-main/src/test/resources/tpcds-1_4/q3/q3.sql @@ -0,0 +1,30 @@ +-- +-- 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. +-- + +SELECT + dt.d_year, + item.i_brand_id brand_id, + item.i_brand brand, + SUM(ss_ext_sales_price) sum_agg +FROM date_dim dt, store_sales, item +WHERE dt.d_date_sk = store_sales.ss_sold_date_sk + AND store_sales.ss_item_sk = item.i_item_sk + AND item.i_manufact_id = 128 + AND dt.d_moy = 11 +GROUP BY dt.d_year, item.i_brand, item.i_brand_id +ORDER BY dt.d_year, sum_agg DESC, brand_id +LIMIT 100 diff --git a/kyuubi-main/src/test/scala/org/apache/kyuubi/operation/tpcds/TPCDSOutputSchemaSuite.scala b/kyuubi-main/src/test/scala/org/apache/kyuubi/operation/tpcds/TPCDSOutputSchemaSuite.scala index 8fa2fb7b8..9b928ed1a 100644 --- a/kyuubi-main/src/test/scala/org/apache/kyuubi/operation/tpcds/TPCDSOutputSchemaSuite.scala +++ b/kyuubi-main/src/test/scala/org/apache/kyuubi/operation/tpcds/TPCDSOutputSchemaSuite.scala @@ -41,6 +41,7 @@ class TPCDSOutputSchemaSuite extends WithKyuubiServer with JDBCTestUtils with TP override protected def jdbcUrl: String = getJdbcUrl override def database: String = this.getClass.getSimpleName override def format: String = "hive OPTIONS(fileFormat='parquet')" + private val queryNameReg = """([a-z]+)(\d+)""".r("head", "index") override def beforeAll(): Unit = { super.beforeAll() @@ -88,6 +89,10 @@ class TPCDSOutputSchemaSuite extends WithKyuubiServer with JDBCTestUtils with TP } } + private def getQueryIndex(queryName: String): Int = queryName match { + case queryNameReg(_, index) => index.toInt + } + private def runQueries(name: String): Unit = { val queriesRoot = Thread.currentThread().getContextClassLoader.getResource(name) val queries = Files.list(Paths.get(queriesRoot.toURI)) @@ -95,10 +100,10 @@ class TPCDSOutputSchemaSuite extends WithKyuubiServer with JDBCTestUtils with TP val validQueries = queries.iterator().asScala.filter { query => query.toFile.listFiles().exists(_.getName.endsWith(".sql")) - } + }.toSeq.sortBy(q => getQueryIndex(q.getFileName.toString)) validQueries.foreach { q => - test(q.getFileName.toString) { + test(name + "-" + q.getFileName.toString) { q.toFile.listFiles().filter(_.getName.endsWith(".sql")).foreach { qf => val schemaFile = Paths.get( baseResourcePath.toFile.getAbsolutePath,