drill-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andries Engelbrecht <aengelbre...@mapr.com>
Subject Re: Exception While Querying Decimal Fields in Apache Drill
Date Fri, 27 Apr 2018 14:07:27 GMT
Perhaps try to convert the predicate and select operations involving the decimal types to float
or similar.

i.e tran_completed = 1.0   and ((cast(SETTLE_AMOUNT_IMPACT as double) *(-1.0))/100.0)

Alternatively you may have to cast the decimals as float, but that will be more cumbersome.

--Andries

´╗┐On 4/27/18, 5:18 AM, "Peter Edike" <peter.edike@interswitchgroup.com> wrote:

    I am trying to run the following query in apache drill, I am querying data stored in parquet
files using the following query
    
    
    select pan, count(*) as number_of_transactions ,
    terminal_id,SUM((cast(SETTLE_AMOUNT_IMPACT as double) *-1)/100) AS settle_amount_impact
    
    
    from dfs.`/iswdata/storage/products/superswitch/parquet/transactions`
    
    where pan like '506126%' and terminal_id like '1%' and
    sink_node_name like ('SWTDB%')
    and source_node_name not like ('SWTDBLsrc')
    and tran_completed=1
    and tran_reversed = 0
    and tran_postilion_originated = 1
    AND tran_type = '01'
    --and pan like '506126%0011'
    group by pan,terminal_id
    
    The Schema for the data I am querying is as follows
    
    
    post_tran_id LONG
    
     post_tran_cust_id :LONG
    
     settle_entity_id :INTEGER
    
     batch_nr : INTEGER
    
     prev_post_tran_id : LONG
    
     next_post_tran_id : LONG
    
     sink_node_name : STRING
    
     tran_postilion_originated : DECIMAL
    
     tran_completed : DECIMAL
    
     tran_amount_req : DECIMAL
    
     tran_amount_rsp : DECIMAL
    
     settle_amount_impact : DECIMAL
    
     tran_cash_req : DECIMAL
    
     tran_cash_rsp : DECIMAL
    
    tran_currency_code : STRING
    
    tran_tran_fee_req : DECIMAL
    
    tran_tran_fee_rsp : DECIMAL
    
    tran_tran_fee_currency_code : STRING
    
    tran_proc_fee_req : DECIMAL
    
    tran_proc_fee_rsp : DECIMAL
    
    tran_proc_fee_currency_code : STRING
    
    settle_amount_req : DECIMAL
    
    settle_amount_rsp : DECIMAL
    
    settle_cash_req : DECIMAL
    
    settle_cash_rsp : DECIMAL
    
    settle_tran_fee_req : DECIMAL
    
    settle_tran_fee_rsp : DECIMAL
    
    settle_proc_fee_req : DECIMAL
    
    settle_proc_fee_rsp : DECIMAL
    
    settle_currency_code : STRING
    
    However When I run the query against the dataset, I get the following exception
    
    
    SYSTEM ERROR: ClassCastException: org.apache.drill.exec.vector.NullableDecimal28SparseVector
cannot be cast to org.apache.drill.exec.vector.VariableWidthVector
    
    
    More so, the same error occurs when I include a decimal field in the select clause. Please,
is there something I am missing or doing wrong, Any pointer will be deeply appreciated
    
    Kind Regards
    
    Peter
    ________________________________
    
    

Mime
View raw message