Vince Gonzalez created DRILL-4316:
-------------------------------------

             Summary: java.lang.ArrayIndexOutOfBoundsException querying JSON 
with exec.enable_union_type = true
                 Key: DRILL-4316
                 URL: https://issues.apache.org/jira/browse/DRILL-4316
             Project: Apache Drill
          Issue Type: Bug
    Affects Versions: 1.4.0
         Environment: Mac OS, Java 8, single drillbit in cluster mode.
            Reporter: Vince Gonzalez


Attempting to query the data here: 
https://gist.githubusercontent.com/vicenteg/326a44f7835f70c2d1f4/raw/768a17ecaee0ddd62b0e0afc115c17f1b1e93c76/stocks.json

I enabled the union_type in order to get around 

{quote}
Error: DATA_READ ERROR: Error parsing JSON - You tried to write a Float8 type 
when you are using a ValueWriter of type NullableBigIntWriterImpl.
{quote}

Then a select * against the same file results in:

{code}
0: jdbc:drill:zk=localhost:2181> ALTER SYSTEM SET `exec.enable_union_type` = 
true;
0: jdbc:drill:zk=localhost:2181> select * from dfs.stocks.`stocks.json` ;
java.lang.ArrayIndexOutOfBoundsException: -1
        at 
org.apache.drill.exec.vector.complex.impl.UnionReader.getReaderForIndex(UnionReader.java:125)
        at 
org.apache.drill.exec.vector.complex.impl.UnionReader.readObject(UnionReader.java:216)
        at 
org.apache.drill.exec.vector.accessor.UnionSqlAccessor.getObject(UnionSqlAccessor.java:117)
        at 
org.apache.drill.exec.vector.accessor.BoundCheckingAccessor.getObject(BoundCheckingAccessor.java:148)
        at 
org.apache.drill.jdbc.impl.TypeConvertingSqlAccessor.getObject(TypeConvertingSqlAccessor.java:795)
        at 
org.apache.drill.jdbc.impl.AvaticaDrillSqlAccessor.getObject(AvaticaDrillSqlAccessor.java:179)
        at 
net.hydromatic.avatica.AvaticaResultSet.getObject(AvaticaResultSet.java:351)
        at 
org.apache.drill.jdbc.impl.DrillResultSetImpl.getObject(DrillResultSetImpl.java:420)
        at sqlline.Rows$Row.<init>(Rows.java:157)
        at sqlline.IncrementalRows.hasNext(IncrementalRows.java:63)
        at 
sqlline.TableOutputFormat$ResizingRowsProvider.next(TableOutputFormat.java:87)
        at sqlline.TableOutputFormat.print(TableOutputFormat.java:118)
        at sqlline.SqlLine.print(SqlLine.java:1593)
        at sqlline.Commands.execute(Commands.java:852)
        at sqlline.Commands.sql(Commands.java:751)
        at sqlline.SqlLine.dispatch(SqlLine.java:746)
        at sqlline.SqlLine.begin(SqlLine.java:621)
        at sqlline.SqlLine.start(SqlLine.java:375)
        at sqlline.SqlLine.main(SqlLine.java:268)
{code}

I do not see the exception if there is a limit clause:

{code}
: jdbc:drill:zk=localhost:2181> select * from dfs.stocks.`stocks.json` limit 1;
+--------------------------------------+---------+-------------+------------------------+----------+-----------------+----------------------------------+----------------------------+----------+--------------------+----------------+------+---------------------+---------------------+-------------------+--------------------------+----------------------------------+--------------------+----------------+-----------------+-----------------------+-------+--------------+---------------+-------------------+-----------------------------+------------------------------------+----------+--------------+-------+------------------------+-------------+------------------+-------------------------------+-------+------------+--------+-------+-------+---------+-----------------------+--------------+--------------+--------------+----------------------+-----------------+---------------------+-------------+----------------+--------------------+---------------+--------------+-----------------------+-------------------+--------------------------+-------------------+-----------------------+-------------------+--------------------+-------------------------------+---------------------+--------------------------+----------------------------+--------------------------------+---------------------+-------------------------------+---------------+--------------------------+---------------+
|                 _id                  | Ticker  |   Sector    |     Earnings 
Date      | Country  | Dividend Yield  |             Industry             |     
     Company           |  Volume  | Insider Ownership  | Current Ratio  | Gap  
| Shares Outstanding  | Performance (Week)  | Change from Open  | EPS growth 
past 5 years  | EPS growth quarter over quarter  | Total Debt/Equity  | Analyst 
Recom  | LT Debt/Equity  | EPS growth this year  |  P/E  | Quick Ratio  | 
Payout Ratio  | Operating Margin  | Institutional Transactions  | Sales growth 
quarter over quarter  |  Change  | Forward P/E  |  P/B  | Performance (Quarter) 
 | Market Cap  | Relative Volume  | Relative Strength Index (14)  |  P/S  | EPS 
(ttm)  | Price  | Beta  |  PEG  | P/Cash  | Return on Investment  | Float Short 
 | Short Ratio  | 50-Day High  | Performance (Month)  | Average Volume  | 
Average True Range  | 50-Day Low  | Profit Margin  | Volatility (Week)  | 
Shares Float  | 52-Week Low  | EPS growth next year  | Return on Assets  | 
Performance (Half Year)  | Return on Equity  | Insider Transactions  | P/Free 
Cash Flow  | Performance (YTD)  | 20-Day Simple Moving Average  | Performance 
(Year)  | Institutional Ownership  | Sales growth past 5 years  | 200-Day 
Simple Moving Average  | Volatility (Month)  | 50-Day Simple Moving Average  | 
52-Week High  | EPS growth next 5 years  | Gross Margin  |
+--------------------------------------+---------+-------------+------------------------+----------+-----------------+----------------------------------+----------------------------+----------+--------------------+----------------+------+---------------------+---------------------+-------------------+--------------------------+----------------------------------+--------------------+----------------+-----------------+-----------------------+-------+--------------+---------------+-------------------+-----------------------------+------------------------------------+----------+--------------+-------+------------------------+-------------+------------------+-------------------------------+-------+------------+--------+-------+-------+---------+-----------------------+--------------+--------------+--------------+----------------------+-----------------+---------------------+-------------+----------------+--------------------+---------------+--------------+-----------------------+-------------------+--------------------------+-------------------+-----------------------+-------------------+--------------------+-------------------------------+---------------------+--------------------------+----------------------------+--------------------------------+---------------------+-------------------------------+---------------+--------------------------+---------------+
| {"$oid":"52853800bb1177ca391c17ff"}  | A       | Healthcare  | 2013-11-14 
21:30:00.0  | USA      | 0.0094          | Medical Laboratories & Research  | 
Agilent Technologies Inc.  | 1847978  | 0.001              | 3              | 0 
   | 339                 | 0.0031              | -0.0148           | 0.158      
              | -0.29                            | 0.56               | 1.6     
       | 0.56            | 0.147                 | 19.1  | 2.3          | 0.162 
        | 0.187             | -0.0074                     | -0.041              
               | -0.0148  | 16.11        | 3.63  | 0.0928                 | 
17356.8     | 0.79             | 46.51                         | 2.54  | 2.68   
    | 50.44  | 1.5   | 2.27  | 7.45    | 0.163                 | 0.008        | 
1.03         | -0.0544      | 0.0063               | 2569.36         | 0.86     
           | 0.0728      | 0.137          | 0.0177             | 330.21        
| 0.4378       | 0.1194                | 0.089             | 0.1439             
      | 0.182             | -0.1352               | 19.63             | 0.2605  
           | -0.0172                       | 0.4242              | 0.847        
            | 0.048                      | 0.1062                         | 
0.0168              | -0.0055                       | -0.0544       | 0.0843    
               | 0.512         |
+--------------------------------------+---------+-------------+------------------------+----------+-----------------+----------------------------------+----------------------------+----------+--------------------+----------------+------+---------------------+---------------------+-------------------+--------------------------+----------------------------------+--------------------+----------------+-----------------+-----------------------+-------+--------------+---------------+-------------------+-----------------------------+------------------------------------+----------+--------------+-------+------------------------+-------------+------------------+-------------------------------+-------+------------+--------+-------+-------+---------+-----------------------+--------------+--------------+--------------+----------------------+-----------------+---------------------+-------------+----------------+--------------------+---------------+--------------+-----------------------+-------------------+--------------------------+-------------------+-----------------------+-------------------+--------------------+-------------------------------+---------------------+--------------------------+----------------------------+--------------------------------+---------------------+-------------------------------+---------------+--------------------------+---------------+
1 row selected (0.292 seconds)
{code}


{code}
0: jdbc:drill:zk=localhost:2181> select * from sys.version;
+----------+-------------------------------------------+-----------------------------------------------------+----------------------------+----------------------------+----------------------------+
| version  |                 commit_id                 |                   
commit_message                    |        commit_time         |        
build_email         |         build_time         |
+----------+-------------------------------------------+-----------------------------------------------------+----------------------------+----------------------------+----------------------------+
| 1.4.0    | 32b871b24c7b69f59a1d2e70f444eed6e599e825  | [maven-release-plugin] 
prepare release drill-1.4.0  | 08.12.2015 @ 00:24:59 PST  | 
[email protected]  | 08.12.2015 @ 01:14:39 PST  |
+----------+-------------------------------------------+-----------------------------------------------------+----------------------------+----------------------------+----------------------------+
1 row selected (0.155 seconds)
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to