Skip to content

Commit

Permalink
Optimize some details
Browse files Browse the repository at this point in the history
Signed-off-by: WuMenglong <[email protected]>
  • Loading branch information
WuMenglong committed Jun 1, 2024
1 parent f2ccf3d commit 7dabe4b
Show file tree
Hide file tree
Showing 19 changed files with 56 additions and 172 deletions.
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

2 changes: 1 addition & 1 deletion bin/load-ssb-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ fi
run_sql() {
sql="$*"
echo "${sql}"
mysql -h"${HOST}" -u"${USER}" -P"${PORT}" -D"${DB}" -e "$@"
mysql -h"${HOST}" -u"${USER}" -P"${PORT}" -D"${DB}" -e "$@" --local-infile
}

load_lineitem_flat() {
Expand Down
2 changes: 1 addition & 1 deletion bin/run-ssb-flat-queries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ROOT=$(
)

CURDIR="${ROOT}"
QUERIES_DIR="${CURDIR}/../ssb-flat-queries"
QUERIES_DIR=${CURDIR}/../ssb-flat-queries

usage() {
echo "
Expand Down
1 change: 1 addition & 0 deletions bin/ssb-dbgen/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.o
*.tbl
qgen
dbgen
27 changes: 27 additions & 0 deletions conf/matrixone_free.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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.

# MatrixOne host
export HOST='freetier-01.cn-hangzhou.cluster.matrixonecloud.cn'
# MatrixOne port
export PORT=6001
# MatrixOne username
export USER='018f9933_1e03_735d_a243_80fefe146ed7:admin:accountadmin'
# MatrixOne password
export PASSWORD='1Qaz2wsx'
# The database where SSB tables located
export DB='ssb'
4 changes: 2 additions & 2 deletions ssb-flat-queries/q1.1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--Q1.1
-- Q1.1
SELECT SUM(LO_EXTENDEDPRICE * LO_DISCOUNT) AS revenue
FROM lineorder_flat
WHERE
LO_ORDERDATE >= 19930101
AND LO_ORDERDATE <= 19931231
AND LO_DISCOUNT BETWEEN 1 AND 3
AND LO_QUANTITY < 25;
AND LO_QUANTITY < 25;
4 changes: 2 additions & 2 deletions ssb-flat-queries/q1.2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--Q1.2
-- Q1.2
SELECT SUM(LO_EXTENDEDPRICE * LO_DISCOUNT) AS revenue
FROM lineorder_flat
WHERE
LO_ORDERDATE >= 19940101
AND LO_ORDERDATE <= 19940131
AND LO_DISCOUNT BETWEEN 4 AND 6
AND LO_QUANTITY BETWEEN 26 AND 35;
AND LO_QUANTITY BETWEEN 26 AND 35;
4 changes: 2 additions & 2 deletions ssb-flat-queries/q1.3.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--Q1.3
-- Q1.3
SELECT SUM(LO_EXTENDEDPRICE * LO_DISCOUNT) AS revenue
FROM lineorder_flat
WHERE
week(LO_ORDERDATE) = 6
AND LO_ORDERDATE >= 19940101
AND LO_ORDERDATE <= 19941231
AND LO_DISCOUNT BETWEEN 5 AND 7
AND LO_QUANTITY BETWEEN 26 AND 35;
AND LO_QUANTITY BETWEEN 26 AND 35;
4 changes: 2 additions & 2 deletions ssb-flat-queries/q2.1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--Q2.1
-- Q2.1
SELECT
SUM(LO_REVENUE), year(LO_ORDERDATE) AS YEAR,
P_BRAND
FROM lineorder_flat
WHERE P_CATEGORY = 'MFGR#12' AND S_REGION = 'AMERICA'
GROUP BY YEAR, P_BRAND
ORDER BY YEAR, P_BRAND;
ORDER BY YEAR, P_BRAND;
4 changes: 2 additions & 2 deletions ssb-flat-queries/q2.2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--Q2.2
-- Q2.2
SELECT
SUM(LO_REVENUE), year(LO_ORDERDATE) AS YEAR,
P_BRAND
Expand All @@ -24,4 +24,4 @@ WHERE
AND P_BRAND <= 'MFGR#2228'
AND S_REGION = 'ASIA'
GROUP BY YEAR, P_BRAND
ORDER BY YEAR, P_BRAND;
ORDER BY YEAR, P_BRAND;
4 changes: 2 additions & 2 deletions ssb-flat-queries/q2.3.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--Q2.3
-- Q2.3
SELECT
SUM(LO_REVENUE), year(LO_ORDERDATE) AS YEAR,
P_BRAND
Expand All @@ -23,4 +23,4 @@ WHERE
P_BRAND = 'MFGR#2239'
AND S_REGION = 'EUROPE'
GROUP BY YEAR, P_BRAND
ORDER BY YEAR, P_BRAND;
ORDER BY YEAR, P_BRAND;
4 changes: 2 additions & 2 deletions ssb-flat-queries/q3.1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--Q3.1
-- Q3.1
SELECT
C_NATION,
S_NATION, year(LO_ORDERDATE) AS YEAR,
Expand All @@ -26,4 +26,4 @@ WHERE
AND LO_ORDERDATE >= 19920101
AND LO_ORDERDATE <= 19971231
GROUP BY C_NATION, S_NATION, YEAR
ORDER BY YEAR ASC, revenue DESC;
ORDER BY YEAR ASC, revenue DESC;
4 changes: 2 additions & 2 deletions ssb-flat-queries/q3.2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--Q3.2
-- Q3.2
SELECT
C_CITY,
S_CITY, year(LO_ORDERDATE) AS YEAR,
Expand All @@ -26,4 +26,4 @@ WHERE
AND LO_ORDERDATE >= 19920101
AND LO_ORDERDATE <= 19971231
GROUP BY C_CITY, S_CITY, YEAR
ORDER BY YEAR ASC, revenue DESC;
ORDER BY YEAR ASC, revenue DESC;
4 changes: 2 additions & 2 deletions ssb-flat-queries/q3.3.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--Q3.3
-- Q3.3
SELECT
C_CITY,
S_CITY, year(LO_ORDERDATE) AS YEAR,
Expand All @@ -26,4 +26,4 @@ WHERE
AND LO_ORDERDATE >= 19920101
AND LO_ORDERDATE <= 19971231
GROUP BY C_CITY, S_CITY, YEAR
ORDER BY YEAR ASC, revenue DESC;
ORDER BY YEAR ASC, revenue DESC;
4 changes: 2 additions & 2 deletions ssb-flat-queries/q3.4.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--Q3.4
-- Q3.4
SELECT
C_CITY,
S_CITY, year(LO_ORDERDATE) AS YEAR,
Expand All @@ -26,4 +26,4 @@ WHERE
AND LO_ORDERDATE >= 19971201
AND LO_ORDERDATE <= 19971231
GROUP BY C_CITY, S_CITY, YEAR
ORDER BY YEAR ASC, revenue DESC;
ORDER BY YEAR ASC, revenue DESC;
4 changes: 2 additions & 2 deletions ssb-flat-queries/q4.1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--Q4.1
-- Q4.1
SELECT year(LO_ORDERDATE) AS YEAR,
C_NATION,
SUM(LO_REVENUE - LO_SUPPLYCOST) AS profit
Expand All @@ -24,4 +24,4 @@ WHERE
AND S_REGION = 'AMERICA'
AND P_MFGR IN ('MFGR#1', 'MFGR#2')
GROUP BY YEAR, C_NATION
ORDER BY YEAR ASC, C_NATION ASC;
ORDER BY YEAR ASC, C_NATION ASC;
4 changes: 2 additions & 2 deletions ssb-flat-queries/q4.2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--Q4.2
-- Q4.2
SELECT year(LO_ORDERDATE) AS YEAR,
S_NATION,
P_CATEGORY,
Expand All @@ -30,4 +30,4 @@ GROUP BY YEAR, S_NATION, P_CATEGORY
ORDER BY
YEAR ASC,
S_NATION ASC,
P_CATEGORY ASC;
P_CATEGORY ASC;
4 changes: 2 additions & 2 deletions ssb-flat-queries/q4.3.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--Q4.3
-- Q4.3
SELECT year(LO_ORDERDATE) AS YEAR,
S_CITY,
P_BRAND,
Expand All @@ -26,4 +26,4 @@ WHERE
AND LO_ORDERDATE <= 19981231
AND P_CATEGORY = 'MFGR#14'
GROUP BY YEAR, S_CITY, P_BRAND
ORDER BY YEAR ASC, S_CITY ASC, P_BRAND ASC;
ORDER BY YEAR ASC, S_CITY ASC, P_BRAND ASC;
Loading

0 comments on commit 7dabe4b

Please sign in to comment.