Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(test): change action to open all optimizer and close optimizer #493

Open
wants to merge 42 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
05dbe63
将action替换为optimizer全打开和全关闭,并更新SQLSessionIT
Yihao-Xu Nov 7, 2024
5fa8a18
Update action.yml
Yihao-Xu Nov 7, 2024
d323fda
Merge branch 'main' into feat-optimizer_action
Yihao-Xu Nov 7, 2024
3437953
独立出Optimizer IT,建立TPC-H-NO-OPtimizer
Yihao-Xu Nov 8, 2024
fd122b9
Update FilterTransformer.java
Yihao-Xu Nov 8, 2024
c574b0b
修复action
Yihao-Xu Nov 8, 2024
aebf5d7
Update SQLSessionIT.java
Yihao-Xu Nov 8, 2024
24370cf
Update config.properties
Yihao-Xu Nov 10, 2024
131ea93
Merge branch 'main' into feat-optimizer_action
Yihao-Xu Nov 10, 2024
340edc8
Update DB-CE.yml
Yihao-Xu Nov 11, 2024
46aae0d
修改规则优先级
Yihao-Xu Nov 11, 2024
65389e9
Revert "Update DB-CE.yml"
Yihao-Xu Nov 11, 2024
9c97051
Update FragmentPruningByFilterRule.java
Yihao-Xu Nov 11, 2024
bf296e5
Merge branch 'main' into feat-optimizer_action
Yihao-Xu Nov 12, 2024
d187ac7
update action yml
Yihao-Xu Nov 12, 2024
e8bfd65
Merge branch 'feat-optimizer_action' of https://github.com/Yihao-Xu/I…
Yihao-Xu Nov 12, 2024
61cfacf
Update FragmentPruningByFilterRule.java
Yihao-Xu Nov 12, 2024
95e7c1f
Update config.properties
Yihao-Xu Nov 12, 2024
77a61e1
更新In Filter的thrift
Yihao-Xu Nov 13, 2024
29885cd
修复IoTDB和InFilterTransformRule的错误
Yihao-Xu Nov 13, 2024
20bcce0
Update config.properties
Yihao-Xu Nov 13, 2024
bf3e772
Update config.properties
Yihao-Xu Nov 14, 2024
dde29f6
Update action.yml
Yihao-Xu Nov 14, 2024
64a8eb8
Update config.properties
Yihao-Xu Nov 14, 2024
7ecad68
Update config.properties
Yihao-Xu Nov 14, 2024
646a3e1
update yml
Yihao-Xu Nov 14, 2024
38c550e
Update InfluxDBQueryRowStream.java
Yihao-Xu Nov 14, 2024
3765c2a
fix
Yihao-Xu Nov 14, 2024
4b46772
Update DB-CE.yml
Yihao-Xu Nov 14, 2024
e7f3dd1
Update IoTDBStorage.java
Yihao-Xu Nov 14, 2024
ef7d686
Update IoTDBQueryRowStream.java
Yihao-Xu Nov 15, 2024
6396a2e
临时修改i
Yihao-Xu Nov 18, 2024
a54c433
调试
Yihao-Xu Nov 18, 2024
d64f228
InfluxDB bug 修复
Yihao-Xu Nov 20, 2024
d2fe8c6
Update InfluxDBStorage.java
Yihao-Xu Nov 20, 2024
987e4e7
Update InfluxDBStorage.java
Yihao-Xu Nov 20, 2024
41dd6ad
更新tpch
Yihao-Xu Nov 21, 2024
82bc272
Revert "临时修改i"
Yihao-Xu Nov 21, 2024
74fa144
Revert "调试"
Yihao-Xu Nov 21, 2024
5bcd016
Merge branch 'main' into feat-optimizer_action
Yihao-Xu Nov 21, 2024
abd4867
更新yml
Yihao-Xu Nov 21, 2024
db6bdf1
Merge branch 'feat-optimizer_action' of https://github.com/Yihao-Xu/I…
Yihao-Xu Nov 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 24 additions & 18 deletions .github/actions/confWriter/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,47 +103,53 @@ runs:
echo "$RUNNER_OS is not supported"
exit 1
fi
- if: inputs.Push-Down=='true'
- if: inputs.Open-Optimizer=='true'
name: Change push_down
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo sed -i 's/enablePushDown=false/enablePushDown=true/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sed -i 's/FilterPushDownRule=off/FilterPushDownRule=on/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sudo sed -i 's/enablePushDown=false/enablePushDown=true/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sed -i 's/Rule=off/Rule=on/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
elif [ "$RUNNER_OS" == "Windows" ]; then
sed -i 's/enablePushDown=false/enablePushDown=true/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sed -i 's/FilterPushDownRule=off/FilterPushDownRule=on/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sed -i 's/enablePushDown=false/enablePushDown=true/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sed -i 's/Rule=off/Rule=on/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
elif [ "$RUNNER_OS" == "macOS" ]; then
sudo sed -i '' 's/enablePushDown=false/enablePushDown=true/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sed -i '' 's/FilterPushDownRule=off/FilterPushDownRule=on/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sed -i '' 's/Rule=off/Rule=on/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
else
echo "$RUNNER_OS is not supported"
exit 1
fi
- if: inputs.Set-Key-Range-Test-Policy=='true'
name: Change KeyRangeTestPolicy
- if: inputs.Close-Optimizer=='true'
name: Close-All-Optimizer
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo sed -i 's/policyClassName=cn.edu.tsinghua.iginx.policy.naive.NaivePolicy/policyClassName=cn.edu.tsinghua.iginx.policy.test.KeyRangeTestPolicy/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sudo sed -i 's/Rule=on/Rule=off/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sudo sed -i 's/enablePushDown=true/enablePushDown=false/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sudo sed -i 's/ColumnPruningRule=off/ColumnPruningRule=on/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
elif [ "$RUNNER_OS" == "Windows" ]; then
sed -i 's/policyClassName=cn.edu.tsinghua.iginx.policy.naive.NaivePolicy/policyClassName=cn.edu.tsinghua.iginx.policy.test.KeyRangeTestPolicy/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sed -i 's/Rule=on/Rule=off/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sed -i 's/enablePushDown=true/enablePushDown=false/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sed -i 's/ColumnPruningRule=off/ColumnPruningRule=on/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
elif [ "$RUNNER_OS" == "macOS" ]; then
sudo sed -i '' 's/policyClassName=cn.edu.tsinghua.iginx.policy.naive.NaivePolicy/policyClassName=cn.edu.tsinghua.iginx.policy.test.KeyRangeTestPolicy/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sudo sed -i '' 's/Rule=on/Rule=off/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sudo sed -i '' 's/enablePushDown=true/enablePushDown=false/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sudo sed -i '' 's/ColumnPruningRule=off/ColumnPruningRule=on/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
else
echo "$RUNNER_OS is not supported"
exit 1
echo "$RUNNER_OS is not supported"
exit 1
fi
- if: inputs.Set-Filter-Fragment-OFF=='true'
name: Set FragmentPruningByFilterRule OFF
- if: inputs.Set-Key-Range-Test-Policy=='true'
name: Change KeyRangeTestPolicy
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo sed -i 's/ruleBasedOptimizer=NotFilterRemoveRule=on,FragmentPruningByFilterRule=on/ruleBasedOptimizer=NotFilterRemoveRule=on/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sudo sed -i 's/policyClassName=cn.edu.tsinghua.iginx.policy.naive.NaivePolicy/policyClassName=cn.edu.tsinghua.iginx.policy.test.KeyRangeTestPolicy/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
elif [ "$RUNNER_OS" == "Windows" ]; then
sed -i 's/ruleBasedOptimizer=NotFilterRemoveRule=on,FragmentPruningByFilterRule=on/ruleBasedOptimizer=NotFilterRemoveRule=on/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sed -i 's/policyClassName=cn.edu.tsinghua.iginx.policy.naive.NaivePolicy/policyClassName=cn.edu.tsinghua.iginx.policy.test.KeyRangeTestPolicy/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
elif [ "$RUNNER_OS" == "macOS" ]; then
sudo sed -i '' 's/ruleBasedOptimizer=NotFilterRemoveRule=on,FragmentPruningByFilterRule=on/ruleBasedOptimizer=NotFilterRemoveRule=on/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
sudo sed -i '' 's/policyClassName=cn.edu.tsinghua.iginx.policy.naive.NaivePolicy/policyClassName=cn.edu.tsinghua.iginx.policy.test.KeyRangeTestPolicy/g' ${{ inputs.Root-Dir-Path }}/core/target/iginx-core-${VERSION}/conf/config.properties
else
echo "$RUNNER_OS is not supported"
exit 1
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/DB-CE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ jobs:
shell: bash
run: |
mvn test -q -Dtest=${FUNCTEST} -DfailIfNoTests=false -P-format

# 第 2 阶段测试开始==========================================
- name: Prepare CapExp environment oriNoDataExpNoData
uses: ./.github/actions/capacityExpansionUnionTest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/full-test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
standalone-test:
uses: ./.github/workflows/standalone-test.yml
standalone-test-pushdown:
uses: ./.github/workflows/standalone-test-pushdown.yml
uses: ./.github/workflows/standalone-test-no-optimizer.yml
db-ce:
uses: ./.github/workflows/DB-CE.yml
remote-test:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Union Database Test With Push Down"
name: "Union Database Test No Optimizer"

on:
workflow_call:
Expand Down Expand Up @@ -72,8 +72,7 @@ jobs:
uses: ./.github/actions/confWriter
with:
DB-name: ${{ matrix.DB-name }}
Push-Down: "true"
Set-Filter-Fragment-OFF: "true"
Close-Optimizer: "true"
Metadata: ${{ matrix.metadata }}

- name: Start IGinX
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/standard-test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
uses: ./.github/workflows/standalone-test.yml
with:
metadata-matrix: '["zookeeper"]'
standalone-test-pushdown:
uses: ./.github/workflows/standalone-test-pushdown.yml
standalone-test-no-optimizer:
uses: ./.github/workflows/standalone-test-no-optimizer.yml
with:
metadata-matrix: '["zookeeper"]'
db-ce:
Expand All @@ -42,8 +42,8 @@ jobs:
with:
os-matrix: '["ubuntu-latest"]'
metadata-matrix: '["zookeeper"]'
tpc-h-regression-test-pushdown:
uses: ./.github/workflows/tpc-h-pushdown.yml
tpc-h-regression-test-no-optimizer:
uses: ./.github/workflows/tpc-h-no-optimizer.yml
with:
os-matrix: '["ubuntu-latest"]'
metadata-matrix: '["zookeeper"]'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "TPC-H Regression Test With Push Down"
name: "TPC-H Regression Test Without Optimizer"

on:
workflow_call:
Expand Down Expand Up @@ -30,7 +30,7 @@ on:
default: '["IoTDB12", "InfluxDB", "FileSystem", "PostgreSQL", "Redis", "MongoDB", "MySQL"]'

jobs:
TPC-H-Test-Push_Down:
TPC-H-Test-Without-Optimizer:
timeout-minutes: 35
strategy:
fail-fast: false
Expand Down Expand Up @@ -118,8 +118,7 @@ jobs:
uses: ./.github/actions/confWriter
with:
DB-name: ${{ matrix.DB-name }}
Push-Down: "true"
Set-Filter-Fragment-OFF: "true"
Close-Optimizer: "true"
Metadata: ${{ matrix.metadata }}
Root-Dir-Path: "IGinX"

Expand All @@ -131,8 +130,7 @@ jobs:
uses: ./.github/actions/confWriter
with:
DB-name: ${{ matrix.DB-name }}
Push-Down: "true"
Set-Filter-Fragment-OFF: "true"
Close-Optimizer: "true"
Metadata: ${{ matrix.metadata }}

- name: Insert Data into DB
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/tpc-h.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ on:
description: "The database to run the test on"
type: string
required: false
default: '["IoTDB12", "InfluxDB", "FileSystem", "PostgreSQL", "Redis", "MongoDB", "MySQL"]'
default: '["InfluxDB", "FileSystem", "PostgreSQL", "Redis", "MongoDB", "MySQL"]'

jobs:
TPC-H-Test:
Expand Down Expand Up @@ -118,21 +118,14 @@ jobs:
uses: ./.github/actions/confWriter
with:
DB-name: ${{ matrix.DB-name }}
Set-Filter-Fragment-OFF: "true"
Open-Optimizer: "true"
Metadata: ${{ matrix.metadata }}
Root-Dir-Path: "IGinX"

- name: Install New IGinX with Maven
shell: bash
run: mvn clean package -DskipTests -P-format -q

- name: Change New IGinX Config
uses: ./.github/actions/confWriter
with:
DB-name: ${{ matrix.DB-name }}
Set-Filter-Fragment-OFF: "true"
Metadata: ${{ matrix.metadata }}

- name: Insert Data into DB
uses: ./.github/actions/tpchDataWriter
with:
Expand Down
7 changes: 4 additions & 3 deletions conf/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ maxCachedPhysicalTaskPerStorage=500
queryOptimizer=rbo

# 优化器规则
ruleBasedOptimizer=NotFilterRemoveRule=on,FragmentPruningByFilterRule=on,ColumnPruningRule=on,ConstantPropagationRule=on,DistinctEliminateRule=on,\
ConstantFoldingRule=on,FilterPushDownRule=off,JoinFactorizationRule=on,SetTransformPushDownPathUnionJoinRule=off
ruleBasedOptimizer=NotFilterRemoveRule=on,ColumnPruningRule=on,ConstantPropagationRule=on,DistinctEliminateRule=on,\
ConstantFoldingRule=on,FilterPushDownRule=on,JoinFactorizationRule=on,SetTransformPushDownPathUnionJoinRule=on,InFilterTransformRule=on,\
OuterJoinEliminateRule=on

# ParallelFilter触发行数
parallelFilterThreshold=10000
Expand Down Expand Up @@ -175,7 +176,7 @@ fragmentCacheThreshold=131072
### 执行层配置
##########################

enablePushDown=false
enablePushDown=true

useStreamExecutor=false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import cn.edu.tsinghua.iginx.utils.Pair;
import java.nio.ByteBuffer;
import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -84,11 +85,24 @@ public static RawFilter toRawFilter(Filter filter) {
return toRawFilter((BoolFilter) filter);
case Path:
return toRawFilter((PathFilter) filter);
case In:
return toRawFilter((InFilter) filter);
default:
throw new UnsupportedOperationException("unsupported filter type: " + filter.getType());
}
}

private static RawFilter toRawFilter(InFilter filter) {
RawFilter raw = new RawFilter(RawFilterType.In);
raw.setPath(filter.getPath());
raw.setArray(
filter.getValues().stream()
.map(ClientObjectMappingUtils::toRawValue)
.collect(Collectors.toSet()));
raw.setInOp(toRawFilterInOp(filter.getInOp()));
return raw;
}

private static RawFilter toRawFilter(AndFilter filter) {
RawFilter raw = new RawFilter(RawFilterType.And);
if (filter.getChildren().isEmpty()) {
Expand Down Expand Up @@ -146,6 +160,21 @@ private static RawFilter toRawFilter(BoolFilter filter) {
return raw;
}

private static RawFilterInOp toRawFilterInOp(InFilter.InOp inOp) {
switch (inOp) {
case IN_OR:
return RawFilterInOp.IN;
case NOT_IN_OR:
return RawFilterInOp.NOT_IN;
case IN_AND:
return RawFilterInOp.IN_AND;
case NOT_IN_AND:
return RawFilterInOp.NOT_IN_AND;
default:
throw new UnsupportedOperationException("unsupported in op: " + inOp);
}
}

private static RawFilterOp toRawFilterOp(Op op) {
switch (op) {
case L:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
package cn.edu.tsinghua.iginx.filesystem.service.rpc.server;

import static cn.edu.tsinghua.iginx.engine.shared.operator.filter.FilterType.In;
import static cn.edu.tsinghua.iginx.engine.shared.operator.filter.Op.*;

import cn.edu.tsinghua.iginx.engine.physical.exception.PhysicalException;
Expand Down Expand Up @@ -67,11 +68,22 @@ public static Filter resolveRawFilter(RawFilter filter) {
return resolveRawBoolFilter(filter);
case Path:
return resolveRawPathFilter(filter);
case In:
return resolveRawInFilter(filter);
default:
throw new UnsupportedOperationException("unsupported filter type: " + filter.getType());
}
}

private static Filter resolveRawInFilter(RawFilter filter) {
return new InFilter(
filter.getPath(),
resolveRawFilterInOp(filter.inOp),
filter.getArray().stream()
.map(ServerObjectMappingUtils::resolveRawValue)
.collect(Collectors.toList()));
}

private static Filter resolveRawAndFilter(RawFilter andFilter) {
List<Filter> filters = new ArrayList<>();
for (RawFilter f : andFilter.getChildren()) {
Expand Down Expand Up @@ -148,6 +160,21 @@ private static Op resolveRawFilterOp(RawFilterOp op) {
}
}

private static InFilter.InOp resolveRawFilterInOp(RawFilterInOp rawFilterInOp) {
switch (rawFilterInOp) {
case IN_AND:
return InFilter.InOp.IN_AND;
case IN:
return InFilter.InOp.IN_OR;
case NOT_IN_AND:
return InFilter.InOp.NOT_IN_AND;
case NOT_IN:
return InFilter.InOp.NOT_IN_OR;
default:
throw new UnsupportedOperationException("unsupported filter in op: " + rawFilterInOp);
}
}

private static Value resolveRawValue(RawValue RawValue) {
Value value = null;
switch (RawValue.getDataType()) {
Expand Down
10 changes: 10 additions & 0 deletions dataSource/filesystem/src/main/thrift/core.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ enum RawFilterType {
And,
Or,
Not,
In
}

enum RawFilterOp {
Expand All @@ -58,6 +59,13 @@ enum RawFilterOp {
UNKNOWN,
}

enum RawFilterInOp {
IN,
NOT_IN,
IN_AND,
NOT_IN_AND
}

struct RawValue {
1: required rpc.DataType dataType
2: optional bool boolV
Expand All @@ -78,6 +86,8 @@ struct RawFilter {
7: optional string pathB
8: optional string path
9: optional RawValue value
10: optional RawFilterInOp inOp
11: optional set<RawValue> array
}

struct RawHeader {
Expand Down
Loading
Loading