public void initSQLExecutor()

in src/main/java/com/aliyun/odps/jdbc/OdpsConnection.java [388:438]


  public void initSQLExecutor(String serviceName, FallbackPolicy fallbackPolicy)
      throws OdpsException {
    // only support major version when attaching a session
    Map<String, String> hints = new HashMap<>();
    if (!StringUtils.isNullOrEmpty(majorVersion)) {
      hints.put(MAJOR_VERSION, majorVersion);
    }
    for (String key : info.stringPropertyNames()) {
      if (key.startsWith(ODPS_SETTING_PREFIX)) {
        hints.put(key, info.getProperty(key));
      }
    }
    SQLExecutorBuilder builder = new SQLExecutorBuilder();
    Odps executeOdps = this.odps;
    if (!StringUtils.isNullOrEmpty(executeProject)) {
      executeOdps = this.odps.clone();
      executeOdps.setDefaultProject(executeProject);
    }
    builder.odps(executeOdps)
        .executeMode(interactiveMode ? ExecuteMode.INTERACTIVE : ExecuteMode.OFFLINE)
        .properties(hints)
        .serviceName(serviceName)
        .fallbackPolicy(fallbackPolicy)
        .enableReattach(true)
        .attachTimeout(attachTimeout)
        .quotaName(fallbackQuota)
        .tunnelEndpoint(tunnelEndpoint)
        .tunnelGetResultMaxRetryTime(tunnelRetryTime)
        .taskName(OdpsStatement.getDefaultTaskName())
        .enableCommandApi(enableCommandApi)
        .tunnelSocketTimeout(tunnelConnectTimeout)
        .tunnelReadTimeout(tunnelReadTimeout)
        .enableOdpsNamespaceSchema(odpsNamespaceSchema)
        .useInstanceTunnel(useInstanceTunnel)
        .logviewVersion(logviewVersion)
        .setSkipCheckIfSelect(skipCheckIfSelect);

    if (enableMaxQA) {
      builder.quotaName(quotaName);
      builder.enableMcqaV2(true);
    }
    long startTime = System.currentTimeMillis();
    this.executorBuilder = builder;
    this.executor = builder.build();
    if (interactiveMode && executor.getInstance() != null) {
      long cost = System.currentTimeMillis() - startTime;
      log.info(String.format(
          "Attach success, instanceId:%s, attach and get tunnel endpoint time cost=%d",
          executor.getInstance().getId(), cost));
    }
  }