[KYUUBI #603] [TEST] Refactor test name and sort the tpcds queries
<!-- Thanks for sending a pull request! Here are some tips for you: 1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/contributions.html 2. If the PR is related to an issue in https://github.com/NetEase/kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'. 3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'. --> ### _Why are the changes needed?_ <!-- Please clarify why the changes are needed. For instance, 1. If you add a feature, you can talk about the use case of it. 2. If you fix a bug, you can clarify why it is a bug. --> Refactor the test name to show tpcds version information and sort the test queries by query number. ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [x] [Run test](https://kyuubi.readthedocs.io/en/latest/tools/testing.html#running-tests) locally before make a pull request Closes #603 from turboFei/tpcds_refactor. Closes #603 1c8daad5 [fwang12] add accident deleted q3 2f62b650 [fwang12] [TEST] Refactor test name and sort the tpcds queries Authored-by: fwang12 <fwang12@ebay.com> Signed-off-by: Cheng Pan <379377944@qq.com>
This commit is contained in:
parent
540de12764
commit
435e85f5d8
30
kyuubi-main/src/test/resources/tpcds-1_4/q3/q3.sql
Executable file
30
kyuubi-main/src/test/resources/tpcds-1_4/q3/q3.sql
Executable file
@ -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
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user