Repository: alibaba/GraphScope (language: python)

Issue:
[Flex] Can we reduce the size of HQPS engine's image size
- Reduce the dependencies introduced by HQPS Engine.
- Reduce the image size.


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/flex.yml b/.github/workflows/flex.yml
index d454d2713416..11e6ce80b789 100644
--- a/.github/workflows/flex.yml
+++ b/.github/workflows/flex.yml
@@ -59,12 +59,13 @@ jobs:
 
     - name: Test Graph Loading on modern graph
       env:
-        FLEX_DATA_DIR: ${{ github.workspace }}/flex/storages/rt_mutable_graph/modern_graph/
+        FLEX_DATA_DIR: ${{ github.workspace }}/flex/interactive/examples/modern_graph/
       run: |
+        rm -rf /tmp/csr-data-dir/
         cd ${GITHUB_WORKSPACE}/flex/build/
-        SCHEMA_FILE=../storages/rt_mutable_graph/modern_graph/modern_graph.yaml
-        BULK_LOAD_FILE=../storages/rt_mutable_graph/modern_graph/bulk_load.yaml
-        GLOG_v=10 ./tests/rt_mutable_graph/test_graph_loading  ${SCHEMA_FILE} ${BULK_LOAD_FILE} /tmp/csr-data-dir/
+        SCHEMA_FILE=../interactive/examples/modern_graph/modern_graph.yaml
+        BULK_LOAD_FILE=../interactive/examples/modern_graph/bulk_load.yaml
+        GLOG_v=10 ./bin/graph_loader  ${SCHEMA_FILE} ${BULK_LOAD_FILE} /tmp/csr-data-dir/
 
     - name: Test Graph Loading on LDBC SNB sf0.1
       env:
@@ -79,4 +80,4 @@ jobs:
         cd ${GITHUB_WORKSPACE}/flex/build/
         SCHEMA_FILE=${FLEX_DATA_DIR}/audit_graph_schema.yaml
         BULK_LOAD_FILE=${FLEX_DATA_DIR}/audit_bulk_load.yaml
-        GLOG_v=10 ./tests/rt_mutable_graph/test_graph_loading  ${SCHEMA_FILE} ${BULK_LOAD_FILE} /tmp/csr-data-dir/ 2
+        GLOG_v=10 ./bin/graph_loader  ${SCHEMA_FILE} ${BULK_LOAD_FILE} /tmp/csr-data-dir/ 2
diff --git a/.github/workflows/hqps-db-ci.yml b/.github/workflows/hqps-db-ci.yml
index 08b52da99ffd..ef480ea7fab8 100644
--- a/.github/workflows/hqps-db-ci.yml
+++ b/.github/workflows/hqps-db-ci.yml
@@ -116,7 +116,6 @@ jobs:
           cmd="./load_plan_and_gen.sh -e=hqps -i=../resources/queries/ic/adhoc/ic${i}_adhoc.cypher -w=/tmp/codgen/"
           cmd=${cmd}" -o=/tmp/plugin --ir_conf=${GS_TEST_DIR}/flex/ldbc-sf01-long-date/engine_config.yaml "
           cmd=${cmd}" --graph_schema_path=${INTERACTIVE_WORKSPACE}/data/ldbc/graph.yaml"
-          cmd=${cmd}" --gie_home=${GIE_HOME}"
           echo $cmd
           eval ${cmd}
         done
@@ -126,7 +125,6 @@ jobs:
           cmd="./load_plan_and_gen.sh -e=hqps -i=../resources/queries/ic/adhoc/simple_match_${i}.cypher -w=/tmp/codgen/"
           cmd=${cmd}" -o=/tmp/plugin --ir_conf=${GS_TEST_DIR}/flex/ldbc-sf01-long-date/engine_config.yaml "
           cmd=${cmd}" --graph_schema_path=${INTERACTIVE_WORKSPACE}/data/ldbc/graph.yaml"
-          cmd=${cmd}" --gie_home=${GIE_HOME}"
           echo $cmd
           eval ${cmd}
         done
diff --git a/flex/bin/CMakeLists.txt b/flex/bin/CMakeLists.txt
index 1a0b4e1381c7..edfd1be090b9 100644
--- a/flex/bin/CMakeLists.txt
+++ b/flex/bin/CMakeLists.txt
@@ -26,10 +26,17 @@ install(TARGETS flex_analytical_engine
         ARCHIVE DESTINATION lib
         LIBRARY DESTINATION lib)
 
+add_executable(graph_loader graph_loader.cc)
+target_link_libraries(graph_loader flex_rt_mutable_graph flex_graph_db ${GLOG_LIBRARIES})
+install(TARGETS graph_loader
+        RUNTIME DESTINATION bin
+        ARCHIVE DESTINATION lib
+        LIBRARY DESTINATION lib)
+
 if(BUILD_HQPS)
         if(Hiactor_FOUND)
                 add_executable(sync_server sync_server.cc)
-                target_link_libraries(sync_server flex_utils flex_graph_db flex_server hqps_plan_proto ${GLOG_LIBRARIES} ${GFLAGS_LIBRARIES})
+                target_link_libraries(sync_server flex_utils flex_graph_db flex_server hqps_plan_proto ${GLOG_LIBRARIES})
 
                 install(TARGETS sync_server
                         RUNTIME DESTINATION bin
diff --git a/flex/tests/rt_mutable_graph/test_graph_loading.cc b/flex/bin/graph_loader.cc
similarity index 100%
rename from flex/tests/rt_mutable_graph/test_graph_loading.cc
rename to flex/bin/graph_loader.cc
diff --git a/flex/bin/load_plan_and_gen.sh b/flex/bin/load_plan_and_gen.sh
index 21626f302538..994ce3ddf1e4 100755
--- a/flex/bin/load_plan_and_gen.sh
+++ b/flex/bin/load_plan_and_gen.sh
@@ -15,63 +15,73 @@
 
 set -e
 
-SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
-FLEX_HOME=${SCRIPT_DIR}/../
-echo "FLEX_HOME root =         ${FLEX_HOME}"
-FLEX_INCLUDE=${FLEX_HOME}/include/flex/
-echo "FLEX_INCLUDE directory = ${CODE_GEN_ROOT}"
-
-# first try to resolve as if we are installed. the try to resolve locally.
-
-if [ ! -d ${FLEX_INCLUDE} ]; then
-  echo "try FLEX_HOME ${FLEX_INCLUDE} not exists."
-  echo "try to resolve locally"
-else
-  echo "try FLEX_HOME ${FLEX_INCLUDE} exists."
-  CODEGEN_RUNNER=${FLEX_HOME}/bin/gen_code_from_plan
-  CMAKE_TEMPLATE_PATH=${FLEX_HOME}/lib/flex/CMakeLists.txt.template
-  FLEX_LIB_DIR=${FLEX_HOME}/lib/
-  PEGASUS_COMPILE_PATH=${FLEX_HOME}resources/pegasus/benchmark
-fi
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[0;33m'
+NC='\033[0m' # No Color
+err() {
+  echo -e "${RED}[$(date +'%Y-%m-%d %H:%M:%S')] -ERROR- $* ${NC}" >&2
+}
 
-FLEX_INCLUDE=${FLEX_HOME}/../
-echo "try to find flex with FLEX_INCLUDE directory = ${FLEX_INCLUDE}"
-if [ ! -d ${FLEX_INCLUDE} ]; then
-  echo "FLEX_INCLUDE directory = ${FLEX_INCLUDE} not exists."
-  echo "Fail to find flex."
-  exit 1
-else
-  CODEGEN_RUNNER=${FLEX_HOME}/build/codegen/gen_code_from_plan
-  CMAKE_TEMPLATE_PATH=${FLEX_HOME}/resources/hqps/CMakeLists.txt.template
-  FLEX_LIB_DIR=${FLEX_HOME}/build/lib/
-  PEGASUS_COMPILE_PATH=${FLEX_HOME}resources/pegasus/benchmark
-fi
+info() {
+  echo -e "${GREEN}[$(date +'%Y-%m-%d %H:%M:%S')] -INFO- $* ${NC}"
+}
 
-echo "Codegen runner = ${CODEGEN_RUNNER}"
-echo "Cmake template path = ${CMAKE_TEMPLATE_PATH}"
-#check these files exist
-if [ ! -f ${CODEGEN_RUNNER} ]; then
- echo "Codegen runner = ${CODEGEN_RUNNER} not exists."
- echo "Fail to find codegen_runner."
- exit 1
-fi
+emph(){
+  echo -e "${YELLOW}[$(date +'%Y-%m-%d %H:%M:%S')] -INFO- $* ${NC}"
+}
 
-if [ ! -f ${CMAKE_TEMPLATE_PATH} ]; then
-  echo "Cmake template path = ${CMAKE_TEMPLATE_PATH} not exists."
-  echo "Fail to find CMakeLists.txt.template."
-  exit 1
-fi
+SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
+
+function check_file_exists(){
+  if [ ! -f $1 ]; then
+    err "File $1 not exists."
+    exit 1
+  fi
+}
+
+function find_resources(){
+  # get parent directory as flex_home
+  flex_home=$(dirname ${SCRIPT_DIR})
+  # check whether flex_home is install directory or source directory
+  if [ -d ${flex_home}/lib ]; then
+    info "FLEX_HOME ${flex_home} is install directory."
+    CODEGEN_RUNNER=${flex_home}/bin/gen_code_from_plan
+    CMAKE_TEMPLATE_PATH=${flex_home}/lib/flex/CMakeLists.txt.template
+    PEGASUS_COMPILE_PATH=${flex_home}lib/flex/pegasus/benchmark
+    COMPILER_JAR=${flex_home}/lib/compiler-0.0.1-SNAPSHOT.jar
+    COMPILER_LIB_DIR=${flex_home}/lib
+    IR_CORE_LIB_DIR=${flex_home}/lib
+    FLEX_INCLUDE_PREFIX=${flex_home}/include
+  else 
+    info "FLEX_HOME ${flex_home} is source directory."
+    CODEGEN_RUNNER=${flex_home}/build/codegen/gen_code_from_plan
+    CMAKE_TEMPLATE_PATH=${flex_home}/resources/hqps/CMakeLists.txt.template
+    PEGASUS_COMPILE_PATH=${flex_home}resources/pegasus/benchmark
+    COMPILER_JAR=${flex_home}/../interactive_engine/compiler/target/compiler-0.0.1-SNAPSHOT.jar
+    COMPILER_LIB_DIR=${flex_home}/../interactive_engine/compiler/target/libs
+    IR_CORE_LIB_DIR=${flex_home}/../interactive_engine/executor/ir/target/release/
+    FLEX_INCLUDE_PREFIX=${flex_home}/../
+  fi
+
+  check_file_exists ${CODEGEN_RUNNER} || (err "Fail to find codegen_runner." && exit 1)
+  check_file_exists ${CMAKE_TEMPLATE_PATH} || (err "Fail to find CMakeLists.txt.template." && exit 1)
+#  check_file_exists ${PEGASUS_COMPILE_PATH} || (err "Fail to find pegasus compile path." && exit 1)
+
+  info "Codegen runner = ${CODEGEN_RUNNER}"
+  info "Cmake template path = ${CMAKE_TEMPLATE_PATH}"
+  #if [ ! -f ${PEGASUS_COMPILE_PATH} ]; then
+  #  echo "Pegasus compile path = ${PEGASUS_COMPILE_PATH} not exists."
+  #  exit 1
+  #fi
+}
 
-#if [ ! -f ${PEGASUS_COMPILE_PATH} ]; then
-#  echo "Pegasus compile path = ${PEGASUS_COMPILE_PATH} not exists."
-#  exit 1
-#fi
 
 cypher_to_plan() {
-  if [ $# -ne 9 ]; then
-    echo "Usage: cypher_to_plan <query_name> <input_file> <output_plan file> <output_yaml_file>"
-    echo "          <ir_compiler_properties> <graph_schema_path> <gie_home>"
-    echo "           <procedure_name> <procedure_description>"    
+  if [ $# -ne 8 ]; then
+    echo "Usage: cypher_to_plan <query_name> <input_file> <output_plan file>"
+    echo "                      <output_yaml_file> <ir_compiler_properties> <graph_schema_path>"
+    echo "                      <procedure_name> <procedure_description>" 
     echo " but receive: "$#
     exit 1
   fi
@@ -81,84 +91,77 @@ cypher_to_plan() {
   output_yaml_file=$4
   ir_compiler_properties=$5
   graph_schema_path=$6
-  GIE_HOME=$7
 
   # get procedure_name and procedure_description
-  procedure_name=$8
-  procedure_description=$9
+  procedure_name=$7
+  procedure_description=$8
 
   # find java executable
-  echo "IR compiler properties = ${ir_compiler_properties}"
+  info "IR compiler properties = ${ir_compiler_properties}"
   #check file exists
   if [ ! -f ${ir_compiler_properties} ]; then
-    echo "IR compiler properties = ${ir_compiler_properties} not exists."
-    echo "Fail to find IR compiler properties."
+    err "IR compiler properties = ${ir_compiler_properties} not exists."
+    err "Fail to find IR compiler properties."
     exit 1
   fi
   JAVA_EXECUTABLE=$(which java)
   if [ -z ${JAVA_EXECUTABLE} ]; then
     # try find from JAVA_HOME
     if [ -z ${JAVA_HOME} ]; then
-      echo "JAVA_HOME not set."
+      err "JAVA_HOME not set."
       exit 1
     else
       JAVA_EXECUTABLE=${JAVA_HOME}/bin/java
     fi
     exit 1
   fi
-  echo "Java executable = ${JAVA_EXECUTABLE}"
-  echo "---------------------------"
-  echo "Find compiler exists"
+  info "Java executable = ${JAVA_EXECUTABLE}"
+  info "---------------------------"
   # read from file ${input_path}
   cypher_query=$(cat ${input_path})
-  echo "Find cypher query:"
-  echo "---------------------------"
-  echo ${cypher_query}
-  echo "---------------------------"
+  info "Find cypher query:"
+  info "---------------------------"
+  emph ${cypher_query}
+  info "---------------------------"
 
   #get abs path of input_path
   real_input_path=$(realpath ${input_path})
   real_output_path=$(realpath ${output_path})
   real_output_yaml=$(realpath ${output_yaml_file})
 
-  compiler_jar=${GIE_HOME}/compiler/target/compiler-0.0.1-SNAPSHOT.jar
-  if [ ! -f ${compiler_jar} ]; then
-    echo "Compiler jar = ${compiler_jar} not exists."
-    echo "Fail to find compiler jar."
+  if [ ! -f ${COMPILER_JAR} ]; then
+    err "Compiler jar = ${COMPILER_JAR} not exists."
     exit 1
   fi
   # add extrac_key_value_config
   extra_config="name:${procedure_name}"
   extra_config="${extra_config},description:${procedure_description}"
 
-  cmd="java -cp ${GIE_HOME}/compiler/target/libs/*:${compiler_jar}"
+  cmd="java -cp ${COMPILER_LIB_DIR}/*:${COMPILER_JAR}"
   cmd="${cmd} -Dgraph.schema=${graph_schema_path}"
-  cmd="${cmd} -Djna.library.path=${GIE_HOME}/executor/ir/target/release/"
+  cmd="${cmd} -Djna.library.path=${IR_CORE_LIB_DIR}"
   cmd="${cmd} com.alibaba.graphscope.common.ir.tools.GraphPlanner ${ir_compiler_properties} ${real_input_path} ${real_output_path} ${real_output_yaml} '${extra_config}'"
-  echo "running physical plan genration with ${cmd}"
+  info "running physical plan genration with ${cmd}"
   eval ${cmd}
 
-  echo "---------------------------"
+  info "---------------------------"
   #check output
   if [ ! -f ${real_output_path} ]; then
-    echo "Output file = ${output_path} not exists."
-    echo "Fail to generate physical plan."
+    err "Output file = ${output_path} not exists, fail to generate physical plan."
     exit 1
   fi
 
   #check output yaml file
   if [ ! -f ${real_output_yaml} ]; then
-    echo "Output yaml file = ${output_yaml_file} not exists."
-    echo "Fail to generate physical plan."
+    err "Output yaml file = ${output_yaml_file} not exists, fail to generate stored procedure config yaml."
     exit 1
   fi
 }
 
 compile_hqps_so() {
   #check input params size eq 2 or 3
-  if [ $# -gt 8 ] || [ $# -lt 5 ]; then
-    echo "Usage: $0 <input_file> <work_dir> <ir_compiler_properties_file>"
-    echo "           <graph_schema_file> <GIE_HOME> "
+  if [ $# -gt 7 ] || [ $# -lt 4 ]; then
+    echo "Usage: $0 <input_file> <work_dir> <ir_compiler_properties_file>  <graph_schema_file> "
     echo "          [output_dir] [stored_procedure_name] [stored_procedure_description]"
     exit 1
   fi
@@ -166,49 +169,43 @@ compile_hqps_so() {
   work_dir=$2
   ir_compiler_properties=$3
   graph_schema_path=$4
-  gie_home=$5
-  if [ $# -ge 6 ]; then
-    output_dir=$6
+  if [ $# -ge 5 ]; then
+    output_dir=$5
   else
     output_dir=${work_dir}
   fi
 
-  if [ $# -ge 7 ]; then
-    procedure_name=$7
+  if [ $# -ge 6 ]; then
+    procedure_name=$6
   else
     procedure_name=""
   fi
 
-  if [ $# -ge 8 ]; then
-    procedure_description=$8
+  if [ $# -ge 7 ]; then
+    procedure_description=$7
   else
     procedure_description=""
   fi
 
-  echo "Input path = ${input_path}"
-  echo "Work dir = ${work_dir}"
-  echo "ir compiler properties = ${ir_compiler_properties}"
-  echo "graph schema path = ${graph_schema_path}"
-  echo "GIE_HOME = ${gie_home}"
-  echo "Output dir = ${output_dir}"
-  echo "Procedure name = ${procedure_name}"
-  echo "Procedure description = ${procedure_description}"
+  info "Input path = ${input_path}"
+  info "Work dir = ${work_dir}"
+  info "ir compiler properties = ${ir_compiler_properties}"
+  info "graph schema path = ${graph_schema_path}"
+  info "Output dir = ${output_dir}"
+  info "Procedure name = ${procedure_name}"
+  info "Procedure description = ${procedure_description}"
 
   last_file_name=$(basename ${input_path})
 
-  echo "last file name: ${last_file_name}"
   # requiest last_file_name suffix is .pb
   if [[ $last_file_name == *.pb ]]; then
     query_name="${last_file_name%.pb}"
-    echo "File has .pb suffix."
   elif [[ $last_file_name == *.cc ]]; then
-    echo "File havs .cc suffix."
     query_name="${last_file_name%.cc}"
   elif [[ $last_file_name == *.cypher ]]; then
-    echo "File has .cypher suffix."
     query_name="${last_file_name%.cypher}"
   else
-    echo "Expect a .pb or .cc file"
+    err "Expect a .pb or .cc file"
     exit 1
   fi
   # if procedure_name is not set, use query_name
@@ -230,39 +227,39 @@ compile_hqps_so() {
     output_so_path="${cur_dir}/lib${procedure_name}.dylib"
     dst_so_path="${output_dir}/lib${procedure_name}.dylib"
   else
-    echo "Not support OS."
+    err "Not support OS."
     exit 1
   fi
 
   #only do codegen when receives a .pb file.
   if [[ $last_file_name == *.pb ]]; then
     cmd="${CODEGEN_RUNNER} -e hqps -i ${input_path} -o ${output_cc_path}"
-    echo "Codegen command = ${cmd}"
+    info "Codegen command = ${cmd}"
     eval ${cmd}
-    echo "----------------------------"
+    info "----------------------------"
   elif [[ $last_file_name == *.cypher ]]; then
-    echo "Generating code from cypher query, procedure name: ${procedure_name}, description: ${procedure_description}"
+    info "Generating code from cypher query, procedure name: ${procedure_name}, description: ${procedure_description}"
     # first do .cypher to .pb
     output_pb_path="${cur_dir}/${procedure_name}.pb"
     output_yaml_path="${cur_dir}/${procedure_name}.yaml"
     cypher_to_plan ${procedure_name} ${input_path} ${output_pb_path} \
-      ${output_yaml_path} ${ir_compiler_properties} ${graph_schema_path} ${gie_home} \
+      ${output_yaml_path} ${ir_compiler_properties} ${graph_schema_path} \
       ${procedure_name} "${procedure_description}"
 
-    echo "----------------------------"
-    echo "Codegen from cypher query done."
-    echo "----------------------------"
+    info "----------------------------"
+    info "Codegen from cypher query done."
+    info "----------------------------"
     cmd="${CODEGEN_RUNNER} -e hqps -i ${output_pb_path} -o ${output_cc_path}"
-    echo "Codegen command = ${cmd}"
+    info "Codegen command = ${cmd}"
     eval ${cmd}
     # then. do .pb to .cc
   elif [[ $last_file_name == *.cc ]]; then
     cp $input_path ${output_cc_path}
   fi
-  echo "Start running cmake and make"
+  info "Start running cmake and make"
   #check output_cc_path exists
   if [ ! -f ${output_cc_path} ]; then
-    echo "Codegen failed, ${output_cc_path} not exists."
+    err "Codegen failed, ${output_cc_path} not exists."
     exit 1
   fi
 
@@ -270,7 +267,7 @@ compile_hqps_so() {
   cp ${CMAKE_TEMPLATE_PATH} ${cur_dir}/CMakeLists.txt
   # run cmake and make in output path.
   pushd ${cur_dir}
-  cmd="cmake . -DQUERY_NAME=${procedure_name} -DFLEX_INCLUDE_PREFIX=${FLEX_INCLUDE} -DFLEX_LIB_DIR=${FLEX_LIB_DIR}"
+  cmd="cmake . -DQUERY_NAME=${query_name} -DFLEX_INCLUDE_PREFIX=${FLEX_INCLUDE_PREFIX}"
   # if CMAKE_CXX_COMPILER is set, use it.
   if [ ! -z ${CMAKE_CXX_COMPILER} ]; then
     cmd="${cmd} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
@@ -279,8 +276,8 @@ compile_hqps_so() {
   if [ ! -z ${CMAKE_C_COMPILER} ]; then
     cmd="${cmd} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
   fi
-  echo "Cmake command = ${cmd}"
-  echo "---------------------------"
+  info "Cmake command = ${cmd}"
+  info "---------------------------"
   eval ${cmd}
 
   ################### now build ##########################
@@ -288,61 +285,60 @@ compile_hqps_so() {
   #n_cores=`nproc`
   n_cores=1
   cmd="make -j"${n_cores}
-  echo "Make command = ${cmd}"
+  info "Make command = ${cmd}"
   eval ${cmd}
-  echo "---------------------------"
+  info "---------------------------"
   #check if build success
   if [ $? -ne 0 ]; then
-    echo "Build failed."
+    err "Build failed."
     exit 1
   fi
   # check output_so_name exists
   if [ ! -f ${output_so_path} ]; then
-    echo "Build failed, ${output_so_path} not exists."
+    err "Build failed, ${output_so_path} not exists."
     exit 1
   fi
-  echo "Finish building, output to ${output_so_path}"
+  info "Finish building, output to ${output_so_path}"
   popd
 
   ################### now copy ##########################
   # if dst_so_path eq output_so_path, skip copying.
   if [ ${dst_so_path} == ${output_so_path} ]; then
-    echo "Output dir is same as work dir, skip copying."
+    info "Output dir is same as work dir, skip copying."
     exit 0
   fi
   # copy output to output_dir
   if [ ! -z ${output_dir} ]; then
     mkdir -p ${output_dir}
   else
-    echo "Output dir not set, skip copying."
+    info "Output dir not set, skip copying."
     exit 0
   fi
   # check output_dir doesn't contains output_so_name
   if [ -f ${dst_so_path} ]; then
-    echo "Output dir ${output_dir} already contains ${procedure_name}.so"
-    echo "Please remove it first."
+    err "Output dir ${output_dir} already contains ${procedure_name}.so, please remove it first."
     exit 1
   fi
   cp ${output_so_path} ${output_dir}
   #check dst_so_path exists
   if [ ! -f ${dst_so_path} ]; then
-    echo "Copy failed, ${dst_so_path} not exists."
+    err "Copy failed, ${dst_so_path} not exists."
     exit 1
   fi
   # copy the generated yaml
   cp ${output_yaml_path} ${output_dir}
   if [ ! -f ${dst_yaml_path} ]; then
-    echo "Copy failed, ${dst_yaml_path} not exists."
+    err "Copy failed, ${dst_yaml_path} not exists."
     exit 1
   fi
-  echo "Finish copying, output to ${dst_so_path}"
+  info "Finish copying, output to ${dst_so_path}"
 }
 
 compile_pegasus_so() {
-  echo "Start compiling pegasus so"
+  info "Start compiling pegasus so"
   #check input params size eq 2 or 3
   if [ $# -ne 4 ] && [ $# -ne 5 ]; then
-    echo "Usage: $0 <input_file> <work_dir> <ir_compiler_properties_file> <graph_schema_file> [output_dir]"
+    err "Usage: $0 <input_file> <work_dir> <ir_compiler_properties_file> <graph_schema_file> [output_dir]"
     exit 1
   fi
   input_path=$1
@@ -354,30 +350,30 @@ compile_pegasus_so() {
   else
     output_dir=${work_dir}
   fi
-  echo "Input path = ${input_path}"
-  echo "Work dir = ${work_dir}"
-  echo "ir compiler properties = ${ir_compiler_properties}"
-  echo "graph schema path = ${graph_schema_path}"
-  echo "Output dir = ${output_dir}"
+  info "Input path = ${input_path}"
+  info "Work dir = ${work_dir}"
+  info "ir compiler properties = ${ir_compiler_properties}"
+  info "graph schema path = ${graph_schema_path}"
+  info "Output dir = ${output_dir}"
 
   last_file_name=$(basename ${input_path})
 
-  echo "last file name: ${last_file_name}"
+  info "last file name: ${last_file_name}"
   # requiest last_file_name suffix is .pb
   if [[ $last_file_name == *.pb ]]; then
     query_name="${last_file_name%.pb}"
-    echo "File has .pb suffix."
+    info "File has .pb suffix."
   elif [[ $last_file_name == *.rs ]]; then
-    echo "File has .rs suffix."
+    info "File has .rs suffix."
     query_name="${last_file_name%.rs}"
   elif [[ $last_file_name == *.cypher ]]; then
-    echo "File has .cypher suffix."
+    info "File has .cypher suffix."
     query_name="${last_file_name%.cypher}"
   elif [[ $last_file_name == *.json ]]; then
-    echo "File has .json suffix."
+    info "File has .json suffix."
     query_name="${last_file_name%.json}"
   else
-    echo "Expect a .pb or .cc file"
+    err "Expect a .pb or .cc file"
     exit 1
   fi
   cur_dir=${work_dir}
@@ -390,23 +386,23 @@ compile_pegasus_so() {
     output_so_path=${PEGASUS_COMPILE_PATH}/target/release/lib.dylib
     dst_so_path=${output_dir}/lib${query_name}.dylib
   else
-    echo "Not support OS."
+    err "Not support OS."
     exit 1
   fi
 
   #only do codegen when receives a .pb file.
   if [[ $last_file_name == *.json ]]; then
     cmd="${CODEGEN_RUNNER} ${input_path} ${output_rs_path}"
-    echo "Codegen command = ${cmd}"
+    info "Codegen command = ${cmd}"
     eval ${cmd}
-    echo "----------------------------"
+    info "----------------------------"
   elif [[ $last_file_name == *.rs ]]; then
     cp $input_path ${output_rs_path}
   fi
-  echo "Start running cmake and make"
+  info "Start running cmake and make"
   #check output_cc_path exists
   if [ ! -f ${output_rs_path} ]; then
-    echo "Codegen failed, ${output_rs_path} not exists."
+    err "Codegen failed, ${output_rs_path} not exists."
     exit 1
   fi
 
@@ -421,15 +417,15 @@ compile_pegasus_so() {
   eval ${cmd}
   #check if build success
   if [ $? -ne 0 ]; then
-    echo "Build failed."
+    err "Build failed."
     exit 1
   fi
   # check output_so_name exists
   if [ ! -f ${output_so_path} ]; then
-    echo "Build failed, ${output_so_path} not exists."
+    err "Build failed, ${output_so_path} not exists."
     exit 1
   fi
-  echo "Finish building, output to "${output_so_path}
+  info "Finish building, output to "${output_so_path}
   popd
 
   ################### now copy ##########################
@@ -437,22 +433,21 @@ compile_pegasus_so() {
   if [ ! -z ${output_dir} ]; then
     mkdir -p ${output_dir}
   else
-    echo "Output dir not set, skip copying."
+    info "Output dir not set, skip copying."
     exit 0
   fi
   # check output_dir doesn't contains output_so_name
   if [ -f ${dst_so_path} ]; then
-    echo "Output dir ${output_dir} already contains ${query_name}.so"
-    echo "Please remove it first."
+    err "Output dir ${output_dir} already contains ${query_name}.so, please remove it first."
     exit 1
   fi
   cp ${output_so_path} ${output_dir}
   #check dst_so_path exists
   if [ ! -f ${dst_so_path} ]; then
-    echo "Copy failed, ${dst_so_path} not exists."
+    err "Copy failed, ${dst_so_path} not exists."
     exit 1
   fi
-  echo "Finish copying, output to ${dst_so_path}"
+  info "Finish copying, output to ${dst_so_path}"
 }
 
 function usage(){
@@ -464,7 +459,6 @@ function usage(){
     -w, --work_dir=WORK_DIR
     --ir_conf=IR_CONF
     --graph_schema_path=GRAPH_SCHEMA_PATH
-    --gie_home=GIE_HOME
     [-o, --output_dir=OUTPUT_DIR]
 EOF
 }
@@ -486,10 +480,6 @@ run() {
       WORK_DIR="${i#*=}"
       shift # past argument=value
       ;;
-    --gie_home=*)
-      GIE_HOME="${i#*=}"
-      shift # past argument=value
-      ;;
     --ir_conf=*)
       IR_CONF="${i#*=}"
       shift # past argument=value
@@ -511,7 +501,7 @@ run() {
       shift # past argument=value
       ;;
     -* | --*)
-      echo "Unknown option $i"
+      err "Unknown option $i"
       exit 1
       ;;
     *) ;;
@@ -524,14 +514,15 @@ run() {
   echo "Work dir               ="${WORK_DIR}
   echo "ir conf                ="${IR_CONF}
   echo "graph_schema_path      ="${GRAPH_SCHEMA_PATH}
-  echo "GIE_HOME               ="${GIE_HOME}
   echo "Output path            ="${OUTPUT_DIR}
   echo "Procedure name         ="${PROCEDURE_NAME}
   echo "Procedure description  ="${PROCEDURE_DESCRIPTION}
 
+  find_resources
+
   # check input exist
   if [ ! -f ${INPUT} ]; then
-    echo "Input file ${INPUT} not exists."
+    err "Input file ${INPUT} not exists."
     exit 1
   fi
 
@@ -553,21 +544,21 @@ run() {
       PROCEDURE_NAME="${PROCEDURE_NAME%.cc}"
       PROCEDURE_NAME="${PROCEDURE_NAME%.pb}"
     fi
-    compile_hqps_so ${INPUT} ${WORK_DIR} ${IR_CONF} ${GRAPH_SCHEMA_PATH} ${GIE_HOME} ${OUTPUT_DIR} ${PROCEDURE_NAME} "${PROCEDURE_DESCRIPTION}"
+    compile_hqps_so ${INPUT} ${WORK_DIR} ${IR_CONF} ${GRAPH_SCHEMA_PATH} ${OUTPUT_DIR} ${PROCEDURE_NAME} "${PROCEDURE_DESCRIPTION}"
 
   # else if engine_type equals pegasus
   elif [ ${ENGINE_TYPE} == "pegasus" ]; then
-    echo "Engine type is pegasus, generating dynamic library for pegasus engine."
+    info "Engine type is pegasus, generating dynamic library for pegasus engine."
     compile_pegasus_so ${INPUT} ${WORK_DIR} ${IR_CONF} ${GRAPH_SCHEMA_PATH} ${OUTPUT_DIR}
   else
-    echo "Unknown engine type "${ENGINE_TYPE}
+    err "Unknown engine type "${ENGINE_TYPE}
     exit 1
   fi
   exit 0
 }
 
 if [ $# -lt 5 ]; then
-  echo "only receives: $# args"
+  err "only receives: $# args"
   usage
   exit 1
 fi
diff --git a/flex/bin/sync_server.cc b/flex/bin/sync_server.cc
index 616a6ca5e0e5..739d740bb26a 100644
--- a/flex/bin/sync_server.cc
+++ b/flex/bin/sync_server.cc
@@ -156,7 +156,6 @@ void init_codegen_proxy(const bpo::variables_map& vm,
                         const std::string& engine_config_file) {
   std::string codegen_dir = parse_codegen_dir(vm);
   std::string codegen_bin;
-  std::string gie_home;
   if (vm.count("codegen-bin") == 0) {
     LOG(INFO) << "codegen-bin is not specified";
     codegen_bin = find_codegen_bin();
@@ -167,16 +166,8 @@ void init_codegen_proxy(const bpo::variables_map& vm,
       LOG(FATAL) << "codegen bin not exists: " << codegen_bin;
     }
   }
-  if (vm.count("gie-home") == 0) {
-    LOG(FATAL) << "gie-home is not specified";
-  } else {
-    gie_home = vm["gie-home"].as<std::string>();
-    if (!std::filesystem::exists(gie_home)) {
-      LOG(FATAL) << "gie-home not exists: " << gie_home;
-    }
-  }
   server::CodegenProxy::get().Init(codegen_dir, codegen_bin, engine_config_file,
-                                   graph_schema_file, gie_home);
+                                   graph_schema_file);
 }
 }  // namespace gs
 
@@ -191,8 +182,7 @@ int main(int argc, char** argv) {
                                    "codegen binary path")(
       "graph-config,g", bpo::value<std::string>(), "graph schema config file")(
       "data-path,a", bpo::value<std::string>(), "data directory path")(
-      "bulk-load,l", bpo::value<std::string>(), "bulk-load config file")(
-      "gie-home,h", bpo::value<std::string>(), "path to gie home");
+      "bulk-load,l", bpo::value<std::string>(), "bulk-load config file");
 
   setenv("TZ", "Asia/Shanghai", 1);
   tzset();
diff --git a/flex/codegen/CMakeLists.txt b/flex/codegen/CMakeLists.txt
index c414e8da22fe..0d9d6eb17030 100644
--- a/flex/codegen/CMakeLists.txt
+++ b/flex/codegen/CMakeLists.txt
@@ -4,7 +4,7 @@ find_package(Boost REQUIRED COMPONENTS system filesystem
 include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
 
 add_executable(gen_code_from_plan gen_code_from_plan.cc)
-target_link_libraries(gen_code_from_plan hqps_plan_proto ${GLOG_LIBRARIES} ${GFLAGS_LIBRARIES}  ${Boost_LIBRARIES})
+target_link_libraries(gen_code_from_plan hqps_plan_proto ${GLOG_LIBRARIES}  ${Boost_LIBRARIES})
 
 install(TARGETS gen_code_from_plan
     RUNTIME DESTINATION bin
diff --git a/flex/codegen/src/codegen_utils.h b/flex/codegen/src/codegen_utils.h
index d5ea17d3a454..33e560becd6f 100644
--- a/flex/codegen/src/codegen_utils.h
+++ b/flex/codegen/src/codegen_utils.h
@@ -25,7 +25,7 @@ limitations under the License.
 #include "flex/engines/hqps_db/core/utils/hqps_utils.h"
 #include "glog/logging.h"
 
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 namespace gs {
 
diff --git a/flex/codegen/src/graph_types.h b/flex/codegen/src/graph_types.h
index d261d69e20e9..8b8b074bb791 100644
--- a/flex/codegen/src/graph_types.h
+++ b/flex/codegen/src/graph_types.h
@@ -19,9 +19,9 @@ limitations under the License.
 #include <type_traits>
 
 #include "flex/codegen/src/string_utils.h"
+#include "flex/proto_generated_gie/common.pb.h"
 #include "glog/logging.h"
 #include "google/protobuf/any.h"
-#include "proto_generated_gie/common.pb.h"
 
 namespace gs {
 
diff --git a/flex/codegen/src/hqps/hqps_case_when_builder.h b/flex/codegen/src/hqps/hqps_case_when_builder.h
index fd4b9ec9884b..b4ebbc185b75 100644
--- a/flex/codegen/src/hqps/hqps_case_when_builder.h
+++ b/flex/codegen/src/hqps/hqps_case_when_builder.h
@@ -23,9 +23,9 @@ limitations under the License.
 #include "flex/codegen/src/codegen_utils.h"
 #include "flex/codegen/src/graph_types.h"
 #include "flex/codegen/src/hqps/hqps_expr_builder.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/expr.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/expr.pb.h"
 
 #include <boost/format.hpp>
 
diff --git a/flex/codegen/src/hqps/hqps_dedup_builder.h b/flex/codegen/src/hqps/hqps_dedup_builder.h
index b1fcf8353a69..3401830f7a7d 100644
--- a/flex/codegen/src/hqps/hqps_dedup_builder.h
+++ b/flex/codegen/src/hqps/hqps_dedup_builder.h
@@ -24,9 +24,9 @@ limitations under the License.
 #include "flex/codegen/src/graph_types.h"
 #include "flex/codegen/src/hqps/hqps_expr_builder.h"
 #include "flex/codegen/src/pb_parser/query_params_parser.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 namespace gs {
 
 enum DedupProp {
diff --git a/flex/codegen/src/hqps/hqps_expr_builder.h b/flex/codegen/src/hqps/hqps_expr_builder.h
index a21b51e5182a..ea1570cd2b5b 100644
--- a/flex/codegen/src/hqps/hqps_expr_builder.h
+++ b/flex/codegen/src/hqps/hqps_expr_builder.h
@@ -22,9 +22,9 @@ limitations under the License.
 #include "flex/codegen/src/building_context.h"
 #include "flex/codegen/src/codegen_utils.h"
 #include "flex/codegen/src/graph_types.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/expr.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/expr.pb.h"
 
 #include <boost/format.hpp>
 
diff --git a/flex/codegen/src/hqps/hqps_fold_builder.h b/flex/codegen/src/hqps/hqps_fold_builder.h
index f270c6a5bbd4..bb40f33af447 100644
--- a/flex/codegen/src/hqps/hqps_fold_builder.h
+++ b/flex/codegen/src/hqps/hqps_fold_builder.h
@@ -25,9 +25,9 @@ limitations under the License.
 #include "flex/codegen/src/hqps/hqps_expr_builder.h"
 #include "flex/codegen/src/hqps/hqps_group_by_builder.h"
 #include "flex/codegen/src/pb_parser/query_params_parser.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 namespace gs {
 
diff --git a/flex/codegen/src/hqps/hqps_get_v_builder.h b/flex/codegen/src/hqps/hqps_get_v_builder.h
index f67b8057d38f..90140400895c 100644
--- a/flex/codegen/src/hqps/hqps_get_v_builder.h
+++ b/flex/codegen/src/hqps/hqps_get_v_builder.h
@@ -23,10 +23,10 @@ limitations under the License.
 #include "flex/codegen/src/codegen_utils.h"
 #include "flex/codegen/src/graph_types.h"
 #include "flex/codegen/src/pb_parser/name_id_parser.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/expr.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/expr.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 #include <boost/format.hpp>
 
diff --git a/flex/codegen/src/hqps/hqps_group_by_builder.h b/flex/codegen/src/hqps/hqps_group_by_builder.h
index 0f8f59e4d2f3..797108bf1d36 100644
--- a/flex/codegen/src/hqps/hqps_group_by_builder.h
+++ b/flex/codegen/src/hqps/hqps_group_by_builder.h
@@ -24,9 +24,9 @@ limitations under the License.
 #include "flex/codegen/src/graph_types.h"
 #include "flex/codegen/src/hqps/hqps_expr_builder.h"
 #include "flex/codegen/src/pb_parser/query_params_parser.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 namespace gs {
 
diff --git a/flex/codegen/src/hqps/hqps_join_utils.h b/flex/codegen/src/hqps/hqps_join_utils.h
index 0edef28221f7..d9009e5ca115 100644
--- a/flex/codegen/src/hqps/hqps_join_utils.h
+++ b/flex/codegen/src/hqps/hqps_join_utils.h
@@ -22,10 +22,10 @@ limitations under the License.
 #include "flex/codegen/src/codegen_utils.h"
 #include "flex/codegen/src/graph_types.h"
 #include "flex/codegen/src/pb_parser/name_id_parser.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/expr.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/expr.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 namespace gs {
 
 namespace internal {
diff --git a/flex/codegen/src/hqps/hqps_path_expand_builder.h b/flex/codegen/src/hqps/hqps_path_expand_builder.h
index 0031e67b550e..d05ea4d862af 100644
--- a/flex/codegen/src/hqps/hqps_path_expand_builder.h
+++ b/flex/codegen/src/hqps/hqps_path_expand_builder.h
@@ -23,9 +23,9 @@ limitations under the License.
 #include "flex/codegen/src/graph_types.h"
 #include "flex/codegen/src/hqps/hqps_get_v_builder.h"
 #include "flex/codegen/src/pb_parser/expand_parser.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/expr.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/expr.pb.h"
 
 // #ifndef HOP_RANGE_PARAM
 // #define HOP_RANGE_PARAM
diff --git a/flex/codegen/src/hqps/hqps_project_builder.h b/flex/codegen/src/hqps/hqps_project_builder.h
index 91f6d6f5a22d..6e3653cad443 100644
--- a/flex/codegen/src/hqps/hqps_project_builder.h
+++ b/flex/codegen/src/hqps/hqps_project_builder.h
@@ -26,9 +26,9 @@ limitations under the License.
 #include "flex/codegen/src/hqps/hqps_expr_builder.h"
 #include "flex/codegen/src/pb_parser/query_params_parser.h"
 #include "flex/codegen/src/string_utils.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 namespace gs {
 static constexpr const char* PROJECT_MAPPER_VAR_TEMPLATE_STR =
diff --git a/flex/codegen/src/hqps/hqps_scan_builder.h b/flex/codegen/src/hqps/hqps_scan_builder.h
index c8144e4554ee..9f24d9740b51 100644
--- a/flex/codegen/src/hqps/hqps_scan_builder.h
+++ b/flex/codegen/src/hqps/hqps_scan_builder.h
@@ -24,9 +24,9 @@ limitations under the License.
 #include "flex/codegen/src/codegen_utils.h"
 #include "flex/codegen/src/graph_types.h"
 #include "flex/codegen/src/pb_parser/query_params_parser.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 // #define FAST_SCAN
 
diff --git a/flex/codegen/src/hqps/hqps_select_builder.h b/flex/codegen/src/hqps/hqps_select_builder.h
index 8764f59cac73..1ef523e28887 100644
--- a/flex/codegen/src/hqps/hqps_select_builder.h
+++ b/flex/codegen/src/hqps/hqps_select_builder.h
@@ -24,9 +24,9 @@ limitations under the License.
 #include "flex/codegen/src/graph_types.h"
 #include "flex/codegen/src/hqps/hqps_expr_builder.h"
 #include "flex/codegen/src/pb_parser/query_params_parser.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 namespace gs {
 
diff --git a/flex/codegen/src/hqps/hqps_sink_builder.h b/flex/codegen/src/hqps/hqps_sink_builder.h
index 99cacda42de6..7ad2c4e29eeb 100644
--- a/flex/codegen/src/hqps/hqps_sink_builder.h
+++ b/flex/codegen/src/hqps/hqps_sink_builder.h
@@ -24,9 +24,9 @@ limitations under the License.
 #include "flex/codegen/src/graph_types.h"
 #include "flex/codegen/src/hqps/hqps_expr_builder.h"
 #include "flex/codegen/src/pb_parser/query_params_parser.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 namespace gs {
 
diff --git a/flex/codegen/src/hqps/hqps_sort_builder.h b/flex/codegen/src/hqps/hqps_sort_builder.h
index b81bc108690b..58824266fdfb 100644
--- a/flex/codegen/src/hqps/hqps_sort_builder.h
+++ b/flex/codegen/src/hqps/hqps_sort_builder.h
@@ -25,9 +25,9 @@ limitations under the License.
 #include "flex/codegen/src/graph_types.h"
 #include "flex/codegen/src/hqps/hqps_expr_builder.h"
 #include "flex/codegen/src/pb_parser/query_params_parser.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 namespace gs {
 
diff --git a/flex/codegen/src/hqps_generator.h b/flex/codegen/src/hqps_generator.h
index 257f24602371..03e18272cc7b 100644
--- a/flex/codegen/src/hqps_generator.h
+++ b/flex/codegen/src/hqps_generator.h
@@ -33,7 +33,7 @@ limitations under the License.
 #include "flex/codegen/src/hqps/hqps_select_builder.h"
 #include "flex/codegen/src/hqps/hqps_sink_builder.h"
 #include "flex/codegen/src/hqps/hqps_sort_builder.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 namespace gs {
 
diff --git a/flex/codegen/src/pb_parser/expand_parser.h b/flex/codegen/src/pb_parser/expand_parser.h
index ad476bafee8d..8c7ff2bb0001 100644
--- a/flex/codegen/src/pb_parser/expand_parser.h
+++ b/flex/codegen/src/pb_parser/expand_parser.h
@@ -16,7 +16,7 @@ limitations under the License.
 #define CODEGEN_SRC_PB_PARSER_EXPAND_PARSER_H_
 
 #include "flex/codegen/src/pb_parser/internal_struct.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 namespace gs {
 
diff --git a/flex/codegen/src/pb_parser/ir_data_type_parser.h b/flex/codegen/src/pb_parser/ir_data_type_parser.h
index 566f4e3d280e..1a93637f03a1 100644
--- a/flex/codegen/src/pb_parser/ir_data_type_parser.h
+++ b/flex/codegen/src/pb_parser/ir_data_type_parser.h
@@ -20,8 +20,8 @@ limitations under the License.
 #include "flex/codegen/src/codegen_utils.h"
 #include "flex/codegen/src/graph_types.h"
 #include "flex/codegen/src/pb_parser/name_id_parser.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 namespace gs {
 
diff --git a/flex/codegen/src/pb_parser/name_id_parser.h b/flex/codegen/src/pb_parser/name_id_parser.h
index 516646a5d348..f65f217425f1 100644
--- a/flex/codegen/src/pb_parser/name_id_parser.h
+++ b/flex/codegen/src/pb_parser/name_id_parser.h
@@ -16,7 +16,7 @@ limitations under the License.
 #define CODEGEN_SRC_PB_PARSER_NAME_ID_PARSER_H_
 
 #include <string>
-#include "proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
 
 namespace gs {
 
diff --git a/flex/codegen/src/pb_parser/query_params_parser.h b/flex/codegen/src/pb_parser/query_params_parser.h
index ccbcf6a2f589..ae7e7bce2001 100644
--- a/flex/codegen/src/pb_parser/query_params_parser.h
+++ b/flex/codegen/src/pb_parser/query_params_parser.h
@@ -18,8 +18,8 @@ limitations under the License.
 #include <vector>
 
 #include "flex/codegen/src/graph_types.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
 
 namespace gs {
 
diff --git a/flex/codegen/src/pegasus/pegasus_dedup_builder.h b/flex/codegen/src/pegasus/pegasus_dedup_builder.h
index 7f555dd76a68..baf851b310a3 100644
--- a/flex/codegen/src/pegasus/pegasus_dedup_builder.h
+++ b/flex/codegen/src/pegasus/pegasus_dedup_builder.h
@@ -23,10 +23,10 @@ limitations under the License.
 #include "flex/codegen/src/codegen_utils.h"
 #include "flex/codegen/src/graph_types.h"
 #include "flex/codegen/src/pegasus/pegasus_repartition_builder.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/expr.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/expr.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 namespace gs {
 namespace pegasus {
diff --git a/flex/codegen/src/pegasus/pegasus_edge_expand_builder.h b/flex/codegen/src/pegasus/pegasus_edge_expand_builder.h
index fe55f804f03a..014855925912 100644
--- a/flex/codegen/src/pegasus/pegasus_edge_expand_builder.h
+++ b/flex/codegen/src/pegasus/pegasus_edge_expand_builder.h
@@ -19,7 +19,7 @@ limitations under the License.
 
 #include <sstream>
 
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 #include "flex/codegen/src/building_context.h"
 #include "flex/codegen/src/codegen_utils.h"
diff --git a/flex/codegen/src/pegasus/pegasus_expr_builder.h b/flex/codegen/src/pegasus/pegasus_expr_builder.h
index f6294760fd9f..0e8df6a7c371 100644
--- a/flex/codegen/src/pegasus/pegasus_expr_builder.h
+++ b/flex/codegen/src/pegasus/pegasus_expr_builder.h
@@ -23,9 +23,9 @@ limitations under the License.
 #include "flex/codegen/src/building_context.h"
 #include "flex/codegen/src/codegen_utils.h"
 #include "flex/codegen/src/graph_types.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/expr.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/expr.pb.h"
 
 namespace gs {
 namespace pegasus {
diff --git a/flex/codegen/src/pegasus/pegasus_get_v_builder.h b/flex/codegen/src/pegasus/pegasus_get_v_builder.h
index 4ca8e923f5c6..9a2844b20cf6 100644
--- a/flex/codegen/src/pegasus/pegasus_get_v_builder.h
+++ b/flex/codegen/src/pegasus/pegasus_get_v_builder.h
@@ -19,9 +19,9 @@ limitations under the License.
 #include <string>
 #include <vector>
 
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 #include "flex/codegen/src/building_context.h"
 #include "flex/codegen/src/codegen_utils.h"
diff --git a/flex/codegen/src/pegasus/pegasus_intersect_builder.h b/flex/codegen/src/pegasus/pegasus_intersect_builder.h
index 83c71a91931f..d9847ebab169 100644
--- a/flex/codegen/src/pegasus/pegasus_intersect_builder.h
+++ b/flex/codegen/src/pegasus/pegasus_intersect_builder.h
@@ -21,10 +21,10 @@ limitations under the License.
 #include "flex/codegen/src/building_context.h"
 #include "flex/codegen/src/codegen_utils.h"
 #include "flex/codegen/src/graph_types.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/expr.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/expr.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 namespace gs {
 namespace pegasus {
diff --git a/flex/codegen/src/pegasus/pegasus_join_builder.h b/flex/codegen/src/pegasus/pegasus_join_builder.h
index 2c9c3a4eb995..a690d1555ea7 100644
--- a/flex/codegen/src/pegasus/pegasus_join_builder.h
+++ b/flex/codegen/src/pegasus/pegasus_join_builder.h
@@ -23,10 +23,10 @@ limitations under the License.
 #include "flex/codegen/src/graph_types.h"
 #include "flex/codegen/src/pegasus/pegasus_order_by_builder.h"
 #include "flex/codegen/src/pegasus/pegasus_project_builder.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/expr.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/expr.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 namespace gs {
 namespace pegasus {
diff --git a/flex/codegen/src/pegasus/pegasus_limit_builder.h b/flex/codegen/src/pegasus/pegasus_limit_builder.h
index 917d76b8ca78..e769ba68cc95 100644
--- a/flex/codegen/src/pegasus/pegasus_limit_builder.h
+++ b/flex/codegen/src/pegasus/pegasus_limit_builder.h
@@ -21,10 +21,10 @@ limitations under the License.
 #include "flex/codegen/src/building_context.h"
 #include "flex/codegen/src/codegen_utils.h"
 #include "flex/codegen/src/graph_types.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/expr.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/expr.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 namespace gs {
 namespace pegasus {
diff --git a/flex/codegen/src/pegasus/pegasus_order_by_builder.h b/flex/codegen/src/pegasus/pegasus_order_by_builder.h
index ae00f17e340e..04e8d2e619ad 100644
--- a/flex/codegen/src/pegasus/pegasus_order_by_builder.h
+++ b/flex/codegen/src/pegasus/pegasus_order_by_builder.h
@@ -19,9 +19,9 @@ limitations under the License.
 #include <string>
 #include <vector>
 
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 #include "flex/codegen/src/building_context.h"
 #include "flex/codegen/src/codegen_utils.h"
diff --git a/flex/codegen/src/pegasus/pegasus_path_expand_builder.h b/flex/codegen/src/pegasus/pegasus_path_expand_builder.h
index 024aef93d7fa..6453dd0e3f79 100644
--- a/flex/codegen/src/pegasus/pegasus_path_expand_builder.h
+++ b/flex/codegen/src/pegasus/pegasus_path_expand_builder.h
@@ -22,9 +22,9 @@ limitations under the License.
 #include "flex/codegen/src/codegen_utils.h"
 #include "flex/codegen/src/graph_types.h"
 #include "flex/codegen/src/pegasus/pegasus_repartition_builder.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/expr.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/expr.pb.h"
 
 namespace gs {
 namespace pegasus {
diff --git a/flex/codegen/src/pegasus/pegasus_project_builder.h b/flex/codegen/src/pegasus/pegasus_project_builder.h
index 09b3a840e6c6..9792b26bc672 100644
--- a/flex/codegen/src/pegasus/pegasus_project_builder.h
+++ b/flex/codegen/src/pegasus/pegasus_project_builder.h
@@ -19,9 +19,9 @@ limitations under the License.
 #include <string>
 #include <vector>
 
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 #include "flex/codegen/src/building_context.h"
 #include "flex/codegen/src/codegen_utils.h"
diff --git a/flex/codegen/src/pegasus/pegasus_repartition_builder.h b/flex/codegen/src/pegasus/pegasus_repartition_builder.h
index e2d6ef2954a7..4ce86ffc7da1 100644
--- a/flex/codegen/src/pegasus/pegasus_repartition_builder.h
+++ b/flex/codegen/src/pegasus/pegasus_repartition_builder.h
@@ -19,9 +19,9 @@ limitations under the License.
 #include <string>
 #include <vector>
 
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 #include "flex/codegen/src/building_context.h"
 #include "flex/codegen/src/codegen_utils.h"
diff --git a/flex/codegen/src/pegasus/pegasus_scan_builder.h b/flex/codegen/src/pegasus/pegasus_scan_builder.h
index 0eca8a352f14..9c6a1534f353 100644
--- a/flex/codegen/src/pegasus/pegasus_scan_builder.h
+++ b/flex/codegen/src/pegasus/pegasus_scan_builder.h
@@ -21,12 +21,12 @@ limitations under the License.
 
 #include <boost/format.hpp>
 
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 #include "flex/codegen/src/building_context.h"
 #include "flex/codegen/src/codegen_utils.h"
diff --git a/flex/codegen/src/pegasus/pegasus_select_builder.h b/flex/codegen/src/pegasus/pegasus_select_builder.h
index 29935648c7b8..e953cbaed8e9 100644
--- a/flex/codegen/src/pegasus/pegasus_select_builder.h
+++ b/flex/codegen/src/pegasus/pegasus_select_builder.h
@@ -21,10 +21,10 @@ limitations under the License.
 #include "flex/codegen/src/building_context.h"
 #include "flex/codegen/src/codegen_utils.h"
 #include "flex/codegen/src/graph_types.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/expr.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/expr.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 namespace gs {
 namespace pegasus {
diff --git a/flex/codegen/src/pegasus/pegasus_sink_builder.h b/flex/codegen/src/pegasus/pegasus_sink_builder.h
index b2f4e20f5b43..e42f4ef7d368 100644
--- a/flex/codegen/src/pegasus/pegasus_sink_builder.h
+++ b/flex/codegen/src/pegasus/pegasus_sink_builder.h
@@ -19,9 +19,9 @@ limitations under the License.
 #include <string>
 #include <vector>
 
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 #include "flex/codegen/src/building_context.h"
 #include "flex/codegen/src/codegen_utils.h"
diff --git a/flex/codegen/src/pegasus/pegasus_unfold_builder.h b/flex/codegen/src/pegasus/pegasus_unfold_builder.h
index 5774a51e82f1..1b1a142d843c 100644
--- a/flex/codegen/src/pegasus/pegasus_unfold_builder.h
+++ b/flex/codegen/src/pegasus/pegasus_unfold_builder.h
@@ -22,9 +22,9 @@ limitations under the License.
 #include "flex/codegen/src/codegen_utils.h"
 #include "flex/codegen/src/graph_types.h"
 #include "flex/codegen/src/pegasus/pegasus_repartition_builder.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/expr.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/expr.pb.h"
 
 namespace gs {
 namespace pegasus {
diff --git a/flex/codegen/src/pegasus/pegasus_union_builder.h b/flex/codegen/src/pegasus/pegasus_union_builder.h
index 2d65087bf74f..62baa7094210 100644
--- a/flex/codegen/src/pegasus/pegasus_union_builder.h
+++ b/flex/codegen/src/pegasus/pegasus_union_builder.h
@@ -22,10 +22,10 @@ limitations under the License.
 #include "flex/codegen/src/building_context.h"
 #include "flex/codegen/src/codegen_utils.h"
 #include "flex/codegen/src/graph_types.h"
-#include "proto_generated_gie/algebra.pb.h"
-#include "proto_generated_gie/common.pb.h"
-#include "proto_generated_gie/expr.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/algebra.pb.h"
+#include "flex/proto_generated_gie/common.pb.h"
+#include "flex/proto_generated_gie/expr.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 namespace gs {
 namespace pegasus {
diff --git a/flex/codegen/src/pegasus_generator.h b/flex/codegen/src/pegasus_generator.h
index c35b5720e937..0c20031d0e95 100644
--- a/flex/codegen/src/pegasus_generator.h
+++ b/flex/codegen/src/pegasus_generator.h
@@ -18,10 +18,10 @@ limitations under the License.
 #include <string>
 #include <vector>
 
+#include "flex/proto_generated_gie/physical.pb.h"
 #include "google/protobuf/message.h"
 #include "google/protobuf/text_format.h"
 #include "google/protobuf/util/json_util.h"
-#include "proto_generated_gie/physical.pb.h"
 
 #include "flex/codegen/src/building_context.h"
 #include "flex/codegen/src/pegasus/pegasus_dedup_builder.h"
diff --git a/flex/codegen/src/string_utils.h b/flex/codegen/src/string_utils.h
index 4c355e0d7555..4d3b06bfc2d2 100644
--- a/flex/codegen/src/string_utils.h
+++ b/flex/codegen/src/string_utils.h
@@ -19,7 +19,7 @@ limitations under the License.
 #include <string>
 
 #include "flex/codegen/src/pb_parser/internal_struct.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 #include "glog/logging.h"
 namespace gs {
diff --git a/flex/engines/hqps_db/CMakeLists.txt b/flex/engines/hqps_db/CMakeLists.txt
index c5c4c4131681..63f60bb6b9e7 100644
--- a/flex/engines/hqps_db/CMakeLists.txt
+++ b/flex/engines/hqps_db/CMakeLists.txt
@@ -19,7 +19,7 @@ set(CODE_GEN_PROTOBUF_FILES
 )
 
 #create directory first
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/proto_generated_gie)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/flex/proto_generated_gie)
 
 # proto gen for gie proto
 protobuf_generate(APPEND_PATH
@@ -28,7 +28,7 @@ protobuf_generate(APPEND_PATH
         OUT_VAR PROTO_SRCS_GIE
         PROTOS ${CODE_GEN_PROTOBUF_FILES}
         IMPORT_DIRS ${GIE_COMPILER_PROTO_DIR}
-        PROTOC_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/proto_generated_gie
+        PROTOC_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/flex/proto_generated_gie
 )
 
 add_library(hqps_plan_proto SHARED ${PROTO_SRCS_GIE})
@@ -43,13 +43,13 @@ install(TARGETS hqps_plan_proto
         LIBRARY DESTINATION lib)
 
 install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-        DESTINATION include/flex/
+        DESTINATION include/flex/engines/
         FILES_MATCHING
         PATTERN "*.h"
 )
 #install proto_generated_files
-install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/proto_generated_gie/
-        DESTINATION include/flex/
+install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/flex/proto_generated_gie/
+        DESTINATION include/flex/proto_generated_gie/
         FILES_MATCHING
         PATTERN "*.h"
 )
diff --git a/flex/engines/hqps_db/app/hqps_app_base.h b/flex/engines/hqps_db/app/hqps_app_base.h
index 0cea66f408d2..504140e26c16 100644
--- a/flex/engines/hqps_db/app/hqps_app_base.h
+++ b/flex/engines/hqps_db/app/hqps_app_base.h
@@ -16,8 +16,8 @@
 #define ENGINES_HQPS_APP_CYPHER_APP_BASE_H_
 
 #include "flex/engines/hqps_db/database/mutable_csr_interface.h"
+#include "flex/proto_generated_gie/results.pb.h"
 #include "flex/utils/app_utils.h"
-#include "proto_generated_gie/results.pb.h"
 
 namespace gs {
 
diff --git a/flex/engines/hqps_db/core/operator/sink.h b/flex/engines/hqps_db/core/operator/sink.h
index f8697d615db2..0513ab38398a 100644
--- a/flex/engines/hqps_db/core/operator/sink.h
+++ b/flex/engines/hqps_db/core/operator/sink.h
@@ -28,7 +28,7 @@
 #include "flex/engines/hqps_db/structures/multi_edge_set/untyped_edge_set.h"
 #include "flex/engines/hqps_db/structures/path.h"
 
-#include "proto_generated_gie/results.pb.h"
+#include "flex/proto_generated_gie/results.pb.h"
 
 namespace gs {
 
diff --git a/flex/engines/hqps_db/structures/collection.h b/flex/engines/hqps_db/structures/collection.h
index bc462d345c36..1997266111f9 100644
--- a/flex/engines/hqps_db/structures/collection.h
+++ b/flex/engines/hqps_db/structures/collection.h
@@ -352,6 +352,22 @@ class Collection {
     LOG(WARNING) << " Not implemented";
   }
 
+  std::vector<offset_t> Dedup() {
+    std::vector<offset_t> offsets;
+    std::vector<T> new_vec;
+    std::unordered_map<T, size_t, boost::hash<T>> map;
+    for (size_t ind = 0; ind < vec_.size(); ++ind) {
+      offsets.emplace_back(new_vec.size());
+      auto ret = map.insert({vec_[ind], ind});
+      if (ret.second == true) {
+        new_vec.emplace_back(vec_[ind]);
+      }
+    }
+    offsets.emplace_back(new_vec.size());
+    vec_.swap(new_vec);
+    return offsets;
+  }
+
   iterator begin() const { return iterator(vec_, 0); }
 
   iterator end() const { return iterator(vec_, vec_.size()); }
diff --git a/flex/engines/http_server/codegen_proxy.h b/flex/engines/http_server/codegen_proxy.h
index 2cb8ee000872..578770060dc5 100644
--- a/flex/engines/http_server/codegen_proxy.h
+++ b/flex/engines/http_server/codegen_proxy.h
@@ -22,8 +22,8 @@
 
 #include "glog/logging.h"
 
-#include "proto_generated_gie/job_service.pb.h"
-#include "proto_generated_gie/physical.pb.h"
+#include "flex/proto_generated_gie/job_service.pb.h"
+#include "flex/proto_generated_gie/physical.pb.h"
 
 namespace server {
 
@@ -42,13 +42,11 @@ class CodegenProxy {
   // the last two params are needed temporally, should be remove after all
   // configuration are merged
   void Init(std::string working_dir, std::string codegen_bin,
-            std::string ir_compiler_prop, std::string compiler_graph_schema,
-            std::string gie_home) {
+            std::string ir_compiler_prop, std::string compiler_graph_schema) {
     working_directory_ = working_dir;
     codegen_bin_ = codegen_bin;
     ir_compiler_prop_ = ir_compiler_prop;
     compiler_graph_schema_ = compiler_graph_schema;
-    gie_home_ = gie_home;
     initialized_ = true;
     LOG(INFO) << "CodegenProxy working dir: " << working_directory_
               << ",codegen bin " << codegen_bin_ << ", ir compiler prop "
@@ -86,8 +84,7 @@ class CodegenProxy {
     std::string res_lib_path = work_dir + "/lib" + query_name + ".so";
     std::string cmd = codegen_bin_ + " -e=hqps " + " -i=" + plan_path +
                       " -w=" + work_dir + " --ir_conf=" + ir_compiler_prop_ +
-                      " --graph_schema_path=" + compiler_graph_schema_ +
-                      " --gie_home=" + gie_home_;
+                      " --graph_schema_path=" + compiler_graph_schema_;
     LOG(INFO) << "Start call codegen cmd: [" << cmd << "]";
     auto res = std::system(cmd.c_str());
     if (res != 0) {
@@ -159,7 +156,6 @@ class CodegenProxy {
   std::string codegen_bin_;
   std::string ir_compiler_prop_;
   std::string compiler_graph_schema_;
-  std::string gie_home_;
   std::atomic<int32_t> next_job_id_{0};
   bool initialized_;
 };
diff --git a/flex/engines/http_server/stored_procedure.h b/flex/engines/http_server/stored_procedure.h
index 7aad2cce6eed..609d9f75dc2e 100644
--- a/flex/engines/http_server/stored_procedure.h
+++ b/flex/engines/http_server/stored_procedure.h
@@ -25,8 +25,8 @@
 #include <utility>
 #include "glog/logging.h"
 
-#include "proto_generated_gie/results.pb.h"
-#include "proto_generated_gie/stored_procedure.pb.h"
+#include "flex/proto_generated_gie/results.pb.h"
+#include "flex/proto_generated_gie/stored_procedure.pb.h"
 
 #include <hiactor/util/data_type.hh>
 #include <seastar/core/print.hh>
diff --git a/flex/interactive/bin/gs_interactive b/flex/interactive/bin/gs_interactive
index 9928e8f3f245..2fc9993005ca 100755
--- a/flex/interactive/bin/gs_interactive
+++ b/flex/interactive/bin/gs_interactive
@@ -185,12 +185,12 @@ gid=$(id -g)
 HOST_DB_RUNNING_FILE="${HOST_DB_HOME}/.running"
 HOST_DB_ENV_FILE="${HOST_DB_HOME}/.env"
 
-DOCKER_DB_GRAPHSCOPE_HOME="/home/graphscope/GraphScope"
-DOCKER_DB_GIE_HOME="${DOCKER_DB_GRAPHSCOPE_HOME}/interactive_engine/"
-DOCKER_DB_SERVER_BIN="${DOCKER_DB_GRAPHSCOPE_HOME}/flex/build/bin/sync_server"
-DOCKER_DB_GRAPH_IMPORT_BIN="${DOCKER_DB_GRAPHSCOPE_HOME}/flex/build/tests/rt_mutable_graph/test_graph_loading"
+DOCKER_DB_GRAPHSCOPE_HOME="/opt/flex"
+DOCKER_DB_GIE_HOME="${DOCKER_DB_GRAPHSCOPE_HOME}"
+DOCKER_DB_SERVER_BIN="${DOCKER_DB_GRAPHSCOPE_HOME}/bin/sync_server"
+DOCKER_DB_GRAPH_IMPORT_BIN="${DOCKER_DB_GRAPHSCOPE_HOME}/bin/graph_loader"
 DOCKER_DB_COMPILER_BIN="com.alibaba.graphscope.GraphServer"
-DOCKER_DB_GEN_BIN="${DOCKER_DB_GRAPHSCOPE_HOME}/flex/bin/load_plan_and_gen.sh"
+DOCKER_DB_GEN_BIN="${DOCKER_DB_GRAPHSCOPE_HOME}/bin/load_plan_and_gen.sh"
 HOST_DB_TMP_DIR="/tmp"
 
 #################### DEFINE DEFAULT CONSTATNS ####################
@@ -206,7 +206,7 @@ DATABASE_PORTS=""
 ## compiler related default configuration
 DATABASE_COMPILER_PLANNER_IS_ON="true"
 DATABASE_COMPILER_PLANNER_OPT="RBO"
-DATABASE_COMPILER_PLANNER_RULES="FilterMatchRule,FilterIntoJoinRule,NotExistToAntiJoinRule"
+DATABASE_COMPILER_PLANNER_RULES="FilterIntoJoinRule,FilterMatchRule,NotMatchToAntiJoinRule"
 DATABASE_COMPILER_ENDPOINT_ADDRESS="localhost"
 DATABASE_COMPILER_BOLT_PORT="7687"
 DATABASE_COMPILER_QUERY_TIMEOUT="20000"
@@ -223,7 +223,6 @@ DATABASE_CONF_DIR_NAME="conf"
 
 
 ################### IMAGE VERSION ###################
-GIE_DB_IMAGE_VERSION="v0.0.2"
 GIE_DB_IMAGE_NAME="registry.cn-hongkong.aliyuncs.com/graphscope/${DB_PROD_NAME}"
 #GIE_DB_IMAGE_NAME="interactive"
 GIE_DB_CONTAINER_NAME="${DB_PROD_NAME}-server"
@@ -814,12 +813,21 @@ function do_init(){
 
   check_file_exists "${config_file}"
 
-  # parse yaml config
-  # eval $(parse_yaml "${config_file}")
-
   # Parse the configuration presented in yaml, and override the default values.
   update_init_config_from_yaml "${config_file}"
 
+  #if $HOST_DB_ENV_FILE exists, remove it
+  if [ -f "${HOST_DB_ENV_FILE}" ]; then
+    if ! rm "${HOST_DB_ENV_FILE}"; then
+      err "remove ${HOST_DB_ENV_FILE} failed"
+      exit 1
+    fi
+  fi
+  if ! touch "${HOST_DB_ENV_FILE}"; then
+    err "create ${HOST_DB_ENV_FILE} failed"
+    exit 1
+  fi
+
   #0. Found workspace
   info "Found docker db home: ${DATABASE_WORKSPACE}"
   # put docker_workspace into env
@@ -892,7 +900,11 @@ function do_init(){
   cmd="${cmd} ${port_cmd} ${mount_cmd} ${GIE_DB_IMAGE_NAME_TAG} bash"
   
   info "Running cmd: ${cmd}"
-  eval ${cmd} || docker rm "${GIE_DB_CONTAINER_NAME}"
+  # eval $cmd, exit if failed
+  if ! eval $cmd; then
+    err "Fail to init database."
+    exit 1
+  fi
 
   info "Finish init database"
 
@@ -901,6 +913,7 @@ function do_init(){
   docker exec -u graphscope "${GIE_DB_CONTAINER_NAME}" bash -c "sudo chown -R graphscope:graphscope ${DATABASE_WORKSPACE}" || exit 1
   docker exec -u graphscope "${GIE_DB_CONTAINER_NAME}" bash -c "mkdir -p ${DATABASE_WORKSPACE}/logs" || exit 1
   docker exec -u graphscope "${GIE_DB_CONTAINER_NAME}" bash -c "mkdir -p ${DATABASE_WORKSPACE}/conf" || exit 1
+  docker exec -u graphscope "${GIE_DB_CONTAINER_NAME}" bash -c "mkdir -p ${DATABASE_WORKSPACE}/data" || exit 1
 
   # create default_graph
   do_create -g ${DATABASE_DEFAULT_GRAPH_NAME} -c ${HOST_DB_HOME}/examples/modern_graph/modern_graph.yaml
@@ -1311,7 +1324,6 @@ function do_start(){
   cmd="docker exec ${GIE_DB_CONTAINER_NAME} bash -c \""
   cmd="${cmd} ${DOCKER_DB_SERVER_BIN} -c ${dst_engine_config_file}"
   cmd="${cmd} -g ${graph_schema_file}  --data-path ${csr_data_dir}"
-  cmd="${cmd} --gie-home ${DOCKER_DB_GIE_HOME}"
   cmd="${cmd} > ${docker_server_log_path} 2>&1  & \""
   echo "Running cmd: ${cmd}"
   # eval command, if fails exist
@@ -1324,8 +1336,8 @@ function do_start(){
   # start compiler
   docker_compiler_log_path="${DATABASE_WORKSPACE}/logs/compiler.log"
   cmd="docker exec ${GIE_DB_CONTAINER_NAME} bash -c \""
-  cmd=${cmd}"java -cp \"${DOCKER_DB_GIE_HOME}/compiler/target/libs/*:${DOCKER_DB_GIE_HOME}/compiler/target/compiler-0.0.1-SNAPSHOT.jar\" "
-  cmd=${cmd}" -Djna.library.path=${DOCKER_DB_GIE_HOME}/executor/ir/target/release"
+  cmd=${cmd}"java -cp \"${DOCKER_DB_GIE_HOME}/lib/*:${DOCKER_DB_GIE_HOME}/lib/compiler-0.0.1-SNAPSHOT.jar\" "
+  cmd=${cmd}" -Djna.library.path=${DOCKER_DB_GIE_HOME}/lib/"
   cmd=${cmd}" -Dgraph.schema=${graph_schema_file}"
   # should error be reported?
   # cmd=${cmd}" -Dgraph.stored.procedures.uri=file:${docker_graph_plugin_dir}"
@@ -1600,7 +1612,6 @@ function do_compile() {
   cmd=${cmd}" --work_dir=/tmp/codegen/"
   cmd=${cmd}" --ir_conf=${docker_engine_config}"
   cmd=${cmd}" --graph_schema_path=${docker_graph_schema}"
-  cmd=${cmd}" --gie_home=${DOCKER_DB_GIE_HOME}"
   cmd=${cmd}" --output_dir=${container_output_dir}"
   cmd=${cmd}" --procedure_name=${stored_procedure_name}"
   if [ ! -z "${stored_procedure_desc}" ]; then
diff --git a/flex/interactive/conf/engine_config.yaml b/flex/interactive/conf/engine_config.yaml
index 0bb4487bda46..7a8b9eb358b6 100644
--- a/flex/interactive/conf/engine_config.yaml
+++ b/flex/interactive/conf/engine_config.yaml
@@ -7,7 +7,7 @@ compiler:
     is_on: true
     opt: RBO
     rules:
-      - FilterMatchRule
       - FilterIntoJoinRule
-      - NotExistToAntiJoinRule
+      - FilterMatchRule
+      - NotMatchToAntiJoinRule
   query_timeout: 20000 # query timeout in milliseconds, default 2000
\ No newline at end of file
diff --git a/flex/interactive/docker/README.md b/flex/interactive/docker/README.md
new file mode 100644
index 000000000000..ba94c11ec681
--- /dev/null
+++ b/flex/interactive/docker/README.md
@@ -0,0 +1,19 @@
+# Build Interactive Docker Image
+
+## Build Base Image
+
+```bash
+docker build -f interactive-base.Dockerfile -t interactive-base .
+```
+
+## Build Runtime Image with latest GraphScope
+
+```bash
+docker build -f interactive-base.Dockerfile --target final_image -t interactive .
+```
+
+## Tag the image
+
+```bash
+docker tag interactive:latest registry.cn-hongkong.aliyuncs.com/graphscope/interactive:{version}
+```
\ No newline at end of file
diff --git a/flex/interactive/docker/interactive-base.Dockerfile b/flex/interactive/docker/interactive-base.Dockerfile
new file mode 100644
index 000000000000..4d9a9e5ae38b
--- /dev/null
+++ b/flex/interactive/docker/interactive-base.Dockerfile
@@ -0,0 +1,45 @@
+FROM ubuntu:20.04
+
+ARG CI=false
+# change bash as default
+SHELL ["/bin/bash", "-c"]
+
+# install sudo
+RUN apt-get update && apt-get install -y sudo
+
+# Add graphscope user with user id 1001
+RUN useradd -m graphscope -u 1001 && \
+    echo 'graphscope ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
+
+# g++ + jre 500MB
+RUN apt-get update && apt-get -y install locales g++ cmake openjdk-11-jre-headless && \
+    locale-gen en_US.UTF-8 && apt-get clean -y && sudo rm -rf /var/lib/apt/lists/* 
+ENV LANG en_US.UTF-8
+ENV LANGUAGE en_US:en
+ENV LC_ALL en_US.UTF-8
+
+# shanghai zoneinfo
+ENV TZ=Asia/Shanghai
+RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
+
+RUN apt-get update && apt-get install -y protobuf-compiler libprotobuf-dev maven git vim curl \
+    wget python3 make libc-ares-dev doxygen python3-pip net-tools curl default-jdk \
+    libgoogle-glog-dev libopenmpi-dev libboost-all-dev libyaml-cpp-dev libprotobuf-dev libcrypto++-dev openssl
+
+# install libgrape-lite
+RUN cd /tmp && \
+    git clone https://github.com/alibaba/libgrape-lite.git -b v0.3.2 --single-branch && cd libgrape-lite && \
+    mkdir build && cd build && cmake .. -DBUILD_LIBGRAPELITE_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/opt/flex && make -j && make install && rm -rf /tmp/libgrape-lite
+
+# install hiactor
+RUN cd /tmp && git clone https://github.com/alibaba/hiactor.git -b v0.1.1 --single-branch && cd hiactor && \
+    git submodule update --init --recursive && ./seastar/seastar/install-dependencies.sh && mkdir build && cd build && \
+    cmake -DCMAKE_INSTALL_PREFIX=/opt/flex -DHiactor_DEMOS=OFF -DHiactor_TESTING=OFF -DHiactor_DPDK=OFF -DHiactor_CXX_DIALECT=gnu++17 -DSeastar_CXX_FLAGS="-DSEASTAR_DEFAULT_ALLOCATOR -mno-avx512" .. && \
+    make -j && make install && rm -rf /tmp/hiactor
+
+RUN chown -R graphscope:graphscope /opt/flex
+
+# set home to graphscope user
+ENV HOME=/home/graphscope
+USER graphscope
+WORKDIR /home/graphscope
diff --git a/flex/interactive/docker/interactive-runtime.Dockerfile b/flex/interactive/docker/interactive-runtime.Dockerfile
old mode 100755
new mode 100644
index 399b67f91d4a..018d48061238
--- a/flex/interactive/docker/interactive-runtime.Dockerfile
+++ b/flex/interactive/docker/interactive-runtime.Dockerfile
@@ -1,13 +1,95 @@
-FROM registry.cn-hongkong.aliyuncs.com/graphscope/hqps-server-base:v0.0.6
+FROM interactive-base:latest AS builder
+
 ARG CI=false
 
 # change bash as default
 SHELL ["/bin/bash", "-c"]
 
-# install graphscope
-RUN cd /home/graphscope/ && git clone -b main --single-branch https://github.com/alibaba/GraphScope.git && \
-    cd GraphScope/flex && mkdir build && cd build && cmake .. -DBUILD_DOC=OFF && sudo make -j install
+# install arrow
+RUN cd /tmp && sudo apt-get install -y -V ca-certificates lsb-release wget && \
+    curl -o apache-arrow-apt-source-latest.deb https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \
+    sudo apt-get install -y ./apache-arrow-apt-source-latest.deb && \
+    sudo apt-get update && sudo apt-get install -y libarrow-dev=6.0.1-1
+
+RUN curl -sf -L https://static.rust-lang.org/rustup.sh | \
+  sh -s -- -y --profile minimal --default-toolchain=1.70.0 && \
+  chmod +x "$HOME/.cargo/env" && \
+  echo "$source $HOME/.cargo/env" >> ~/.bashrc && \
+  . ${HOME}/.cargo/env && \
+  cargo --version
+
+# install flex
+RUN . ${HOME}/.cargo/env  &&  git clone https://github.com/alibaba/GraphScope.git -b main --single-branch && cd GraphScope/flex && \
+    mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/opt/flex -DBUILD_DOC=OFF && make -j && make install && \
+    cd ~/GraphScope/interactive_engine/ && mvn clean package -Pexperimental -DskipTests && \
+    cd ~/GraphScope/interactive_engine/compiler && cp target/compiler-0.0.1-SNAPSHOT.jar /opt/flex/lib/ && \
+    cp target/libs/*.jar /opt/flex/lib/ && \
+    ls ~/GraphScope/interactive_engine/executor/ir && \
+    cp ~/GraphScope/interactive_engine/executor/ir/target/release/libir_core.so /opt/flex/lib/ && \
+    rm -rf ~/GraphScope 
+
+from ubuntu:20.04 as final_image
+
+RUN apt-get update && apt-get install -y sudo
+
+# Add graphscope user with user id 1001
+RUN useradd -m graphscope -u 1001 && \
+    echo 'graphscope ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
+
+# g++ + jre 500MB
+RUN apt-get update && apt-get -y install locales g++-9 cmake openjdk-11-jre-headless && \
+    ln -sf /usr/bin/g++-9 /usr/bin/g++ && locale-gen en_US.UTF-8 && apt-get clean -y && sudo rm -rf /var/lib/apt/lists/* 
+ENV LANG en_US.UTF-8
+ENV LANGUAGE en_US:en
+ENV LC_ALL en_US.UTF-8
+
+# shanghai zoneinfo
+ENV TZ=Asia/Shanghai
+RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
+
+# copy builder's /opt/flex to final image
+COPY --from=builder /opt/flex /opt/flex
+# remov bin/run_app
+RUN rm -rf /opt/flex/bin/run_app
+
+COPY --from=builder /usr/lib/x86_64-linux-gnu/libprotobuf*.so* /usr/lib/x86_64-linux-gnu/
+COPY --from=builder /usr/lib/x86_64-linux-gnu/libsnappy*.so* /usr/lib/x86_64-linux-gnu/
+COPY --from=builder /usr/include/arrow /usr/include/arrow
+COPY --from=builder /usr/lib/x86_64-linux-gnu/libgflags*.so* /usr/lib/x86_64-linux-gnu/
+COPY --from=builder /usr/lib/x86_64-linux-gnu/libglog*.so* /usr/lib/x86_64-linux-gnu/
+COPY --from=builder /usr/lib/x86_64-linux-gnu/libyaml-cpp*.so* /usr/lib/x86_64-linux-gnu/
+COPY --from=builder /usr/lib/x86_64-linux-gnu/libmpi*.so* /usr/lib/x86_64-linux-gnu/
+COPY --from=builder /usr/lib/x86_64-linux-gnu/libboost_program_options*.so* /usr/lib/x86_64-linux-gnu/
+COPY --from=builder /usr/lib/x86_64-linux-gnu/libboost_thread*.so* /usr/lib/x86_64-linux-gnu/
+COPY --from=builder /usr/lib/x86_64-linux-gnu/libcrypto*.so* /usr/lib/x86_64-linux-gnu/
+COPY --from=builder /usr/lib/x86_64-linux-gnu/libopen-rte*.so* /usr/lib/x86_64-linux-gnu/
+COPY --from=builder /usr/lib/x86_64-linux-gnu/libhwloc*.so* /usr/lib/x86_64-linux-gnu/
+COPY --from=builder /usr/lib/x86_64-linux-gnu/libunwind*.so* /usr/lib/x86_64-linux-gnu/
+COPY --from=builder /usr/lib/x86_64-linux-gnu/libarrow.so.600 /usr/lib/x86_64-linux-gnu/
+COPY --from=builder /usr/lib/x86_64-linux-gnu/libopen-pal*.so* /usr/lib/x86_64-linux-gnu/
+COPY --from=builder /usr/lib/x86_64-linux-gnu/libltdl*.so* /usr/lib/x86_64-linux-gnu/
+COPY --from=builder /usr/lib/x86_64-linux-gnu/libevent*.so* /usr/lib/x86_64-linux-gnu/
+COPY --from=builder /usr/lib/x86_64-linux-gnu/libutf8proc*.so* /usr/lib/x86_64-linux-gnu/
+COPY --from=builder /usr/lib/x86_64-linux-gnu/libre2*.so* /usr/lib/x86_64-linux-gnu/
+COPY --from=builder /usr/include/glog /usr/include/glog
+COPY --from=builder /usr/include/gflags /usr/include/gflags
+
+COPY --from=builder /usr/lib/x86_64-linux-gnu/openmpi/include/ /opt/flex/include
+COPY --from=builder /usr/include/boost /usr/include/boost
+COPY --from=builder /usr/include/google /usr/include/google
+COPY --from=builder /usr/include/yaml-cpp /usr/include/yaml-cpp
+
+RUN sudo rm -rf /usr/lib/x86_64-linux-gnu/libLLVM*.so* && sudo rm -rf /opt/flex/lib/libseastar.a && \
+    sudo rm -rf /usr/lib/x86_64-linux-gnu/lib/libcuda.so && \
+    sudo rm -rf /usr/lib/x86_64-linux-gnu/lib/libcudart.so && \
+    sudo rm -rf /usr/lib/x86_64-linux-gnu/lib/libicudata.so*
+
+RUN sudo ln -sf /opt/flex/bin/* /usr/local/bin/ \
+  && sudo ln -sfn /opt/flex/include/* /usr/local/include/ \
+  && sudo ln -sf -r /opt/flex/lib/* /usr/local/lib \
+  && sudo ln -sf /opt/flex/lib64/*so* /usr/local/lib64
+
+RUN chmod +x /opt/flex/bin/*
+
+ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/flex/lib/:/usr/lib/
 
-# install graphscope GIE
-RUN . /home/graphscope/.cargo/env && cd /home/graphscope/GraphScope/interactive_engine && \
-    mvn clean install -DskipTests -Drevision=0.0.1-SNAPSHOT -Pexperimental
diff --git a/flex/resources/hqps/CMakeLists.txt.template b/flex/resources/hqps/CMakeLists.txt.template
index ba723a1b15ee..83799ed603b3 100644
--- a/flex/resources/hqps/CMakeLists.txt.template
+++ b/flex/resources/hqps/CMakeLists.txt.template
@@ -23,22 +23,18 @@ else()
         message(FATAL_ERROR "FLEX_INCLUDE_PREFIX not set")
 endif()
 
-# the path where we can find graphscope libs.
-if (FLEX_LIB_DIR)
-        message("flex lib install dir ${FLEX_LIB_DIR}")
-else()
-        message(FATAL_ERROR "FLEX_LIB_DIR not set")
+# try to find mpi, if not found warnning
+find_package(MPI)
+if (MPI_FOUND)
+    include_directories(SYSTEM ${MPI_CXX_INCLUDE_PATH})
+else ()
+    message(WARNING "mpi not found, build without mpi")
 endif()
-link_directories(${FLEX_LIB_DIR})
 
 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -Wl,-rpath,$ORIGIN -O3 -flto -Werror=unused-result -fPIC -no-pie")
 
-
-find_package(MPI REQUIRED)
-include_directories(SYSTEM ${MPI_CXX_INCLUDE_PATH})
-
 add_library(${QUERY_NAME} SHARED ${PROJECT_SOURCE_DIR}/${QUERY_NAME}.cc)
 target_include_directories(${QUERY_NAME} PUBLIC ${FLEX_INCLUDE_PREFIX} ${FLEX_INCLUDE_PREFIX}/flex/build/engines/hqps_db/)
 target_link_libraries(${QUERY_NAME} PUBLIC)
\ No newline at end of file
diff --git a/flex/scripts/install_dependencies.sh b/flex/scripts/install_dependencies.sh
index 1d72c6f9e860..112a404409f3 100644
--- a/flex/scripts/install_dependencies.sh
+++ b/flex/scripts/install_dependencies.sh
@@ -1,7 +1,7 @@
 apt update -y
 
 apt install -y \
-      ninja-build ragel libhwloc-dev libnuma-dev libpciaccess-dev vim wget \
+      ninja-build ragel libhwloc-dev libnuma-dev libpciaccess-dev vim wget curl \
       git g++ libgoogle-glog-dev cmake libopenmpi-dev default-jdk libcrypto++-dev \
       libboost-all-dev libxml2-dev
 apt install -y xfslibs-dev libgnutls28-dev liblz4-dev maven openssl pkg-config \
@@ -15,6 +15,12 @@ mkdir build && cd build && cmake ..
 make -j && make install
 cp /usr/local/lib/libgrape-lite.so /usr/lib/libgrape-lite.so
 
+pushd /tmp && apt-get install -y -V ca-certificates lsb-release wget
+curl -o apache-arrow-apt-source-latest.deb https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
+apt-get install -y ./apache-arrow-apt-source-latest.deb
+apt-get update && apt-get install -y libarrow-dev=6.0.1-1
+popd
+
 cd ../..
 git clone https://github.com/alibaba/hiactor.git
 cd hiactor && git checkout e16949ca53
diff --git a/flex/storages/rt_mutable_graph/CMakeLists.txt b/flex/storages/rt_mutable_graph/CMakeLists.txt
index 35ed3b1379fe..5d3f12f1cd83 100644
--- a/flex/storages/rt_mutable_graph/CMakeLists.txt
+++ b/flex/storages/rt_mutable_graph/CMakeLists.txt
@@ -18,8 +18,8 @@ install(TARGETS flex_rt_mutable_graph
         ARCHIVE DESTINATION lib
         LIBRARY DESTINATION lib)
 
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mutable_property_fragment.h
-              ${CMAKE_CURRENT_SOURCE_DIR}/schema.h
-              ${CMAKE_CURRENT_SOURCE_DIR}/mutable_csr.h
-              ${CMAKE_CURRENT_SOURCE_DIR}/types.h
-        DESTINATION include/flex/storages/rt_mutable_graph)
+install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+        DESTINATION include/flex/storages
+        FILES_MATCHING
+        PATTERN "*.h"
+)


Test patch:
diff --git a/flex/tests/hqps/hqps_cypher_test.sh b/flex/tests/hqps/hqps_cypher_test.sh
index 1cb4837dfccf..fb8fd13a6ce9 100644
--- a/flex/tests/hqps/hqps_cypher_test.sh
+++ b/flex/tests/hqps/hqps_cypher_test.sh
@@ -97,7 +97,6 @@ start_engine_service(){
 
     cmd="${SERVER_BIN} -c ${ENGINE_CONFIG_PATH} -g ${GRAPH_SCHEMA_YAML} "
     cmd="${cmd} --data-path ${GRAPH_CSR_DATA_DIR} -l ${GRAPH_BULK_LOAD_YAML} "
-    cmd="${cmd} --gie-home ${GIE_HOME}"
 
     echo "Start engine service with command: ${cmd}"
     ${cmd} &