中文
注册
我要评分
文档获取效率
文档正确性
内容完整性
文档易理解
在线提单
论坛求助

执行openLooKeng引擎业务

openLooKeng使用命令行接口CLI来执行SQL任务,需要注意的是OmniOperator算子加速是否生效要从webUI的Stage Performance中看,如果算子是以OmniOperator算子加速结尾的则说明OmniOperator算子加速生效。

本次任务示例使用tpcds-sf10的数据表作为测试表,测试SQL为TPC-DS测试集的Q82。

相关的表信息如表1所示。

表1 相关表信息

表名

表格式

总行数

item

orc

102000

inventory

orc

133110000

date_dim

orc

73049

store_sales

orc

28800991

具体步骤如下。

  1. 启动hetu-server。
    export OMNI_HOME=/opt/omni-operator
    export OMNI_CONNECTED_ENGINE=OLK
    /opt/hetu-server-1.6.1/bin/launcher start
  2. 在openLooKeng的webUI中运行以下SQL语句。

    在webUI界面选择Catlog为tpcds,Schema为sf10,如图1

    图1 webUI界面选择
    • OmniOperator
      set session extension_execution_planner_enabled=true;
      select  i_item_id
          ,i_item_desc
          ,i_current_price
      from item, inventory, date_dim, store_sales
      where i_current_price between 76 and 76+30
      and inv_item_sk = i_item_sk
      and d_date_sk=inv_date_sk
      and d_date between cast('1998-06-29' as date) and cast('1998-08-29' as date)
      and i_manufact_id in (512,409,677,16)
      and inv_quantity_on_hand between 100 and 500
      and ss_item_sk = i_item_sk
      group by i_item_id,i_item_desc,i_current_price
      order by i_item_id
      limit 100;
    • 原生
      select  i_item_id
          ,i_item_desc
          ,i_current_price
      from item, inventory, date_dim, store_sales
      where i_current_price between 76 and 76+30
      and inv_item_sk = i_item_sk
      and d_date_sk=inv_date_sk
      and d_date between cast('1998-06-29' as date) and cast('1998-08-29' as date)
      and i_manufact_id in (512,409,677,16)
      and inv_quantity_on_hand between 100 and 500
      and ss_item_sk = i_item_sk
      group by i_item_id,i_item_desc,i_current_price
      order by i_item_id
      limit 100;
  3. 结果对比。

    具体方法为当SQL语句执行成功之后会出现FINISHED,点击进入后,选择Stage Performance,就可以查看各个Stage。

    从Live Plan中可以查看语句的执行计划,从Stage Performance查看算子的具体执行流程,这里以Stage0为例,如图2图3所示,当算子是以OmniOperator结尾则说明OmniOperator算子加速生效。

    • OmniOperator算子加速
    图2 OmniOperator算子加速运行结果及Stage0

    • 原生
    图3 原生运行结果及Stage0

目前OmniOperator算子加速支持的Decimal数据类型规格包含64位和128位,如若超过128位的表示范围,则会抛出溢出异常。可能会产生和openLooKeng原生引擎行为不相同的场景,如:AVG聚合时,若中间累加结果超出Decimal 128位,原生openLooKeng能正常执行,而OmniOperator算子加速会抛溢出异常。这里建议如果字段需要进行AVG运算且存在累加结果过大的可能,请使用Double等其他类型存储。