使用Apache Drill查询FIX协议消息文件

时间:2018-07-30 08:47:17

标签: apache csv apache-drill

我能够使用定界符'\ u0001'将CSV消息作为csv进行查询,但是结果在每一列中都有tag = value,就像这样:

预期:

---------
 8      |
---------
 FIX.4.4|
 FIX.4.4|
 FIX.4.4|
 FIX.4.4|
 FIX.4.4|
---------

实际:

-----------
 EXPR$1   |
-----------
 8=FIX.4.4|
 8=FIX.4.4|
 8=FIX.4.4|
 8=FIX.4.4|
 8=FIX.4.4|
-----------

如何使用Apache Drill查询FIX协议消息文件以实现上述预期结果? 这需要自定义存储格式实现吗?

1 个答案:

答案 0 :(得分:1)

您可以contribute to Apache Drill并开发“ FIX协议”存储格式插件。

此外,您可以尝试解析字符串值并通过SQL从中提取结果:

<?php

$args = array(
        'numberposts' => -1,
        'cat' => 13,
        'post_type' => 'post',
        'post_status' => 'publish',
        'category_name' => 'ico',
);

$the_query = new WP_Query( $args );
$posts = $the_query->posts;

foreach($posts as $post) {

$the_id = get_the_ID();
$curtime = date('d-m-Y');

    $content = get_field('overview', $the_id);
        if($content):
           foreach ($content as $key => $content): 
           $start_date = $content['ico_time_start'];
           $end_date = $content['ico_time_end'];
           $prestart_date = $content['pre_ico_time_start'];
           $preend_date = $content['pre_ico_time_end'];
           endforeach;
        endif;

    $newicoDate = date("d-m-Y", strtotime($end_date));
    $newpreicoDate = date("d-m-Y", strtotime($preend_date));
    $currenttime = new DateTime($curtime); 
    $icoEnd   = new DateTime($newicoDate);
    $preicoEnd = new DateTime($newpreicoDate);

    if ($preicoEnd < $currenttime) : wp_set_post_categories( $the_id, array( 13, 15 ) ); endif;
    if ($icoEnd < $currenttime) : wp_set_post_categories( $the_id, array( 13, 16 ) ); endif;
}
?>