[
https://issues.apache.org/jira/browse/DRILL-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Krystal updated DRILL-4062:
---------------------------
Labels: interval (was: )
> SUM function does not work against interval data type from csv or json files
> ----------------------------------------------------------------------------
>
> Key: DRILL-4062
> URL: https://issues.apache.org/jira/browse/DRILL-4062
> Project: Apache Drill
> Issue Type: Bug
> Components: Functions - Drill
> Reporter: Krystal
> Labels: interval
>
> I have a csv table with the following interval year data:
> select columns[1] from `interval_data.csv`;
> +---------+
> | EXPR$0 |
> +---------+
> | P12Y |
> | P152Y |
> | P-152Y |
> | P5Y |
> | P10Y |
> | P0Y |
> | P-50Y |
> | P12Y |
> | P152Y |
> +---------+
> I got an exception when trying to use the SUM function against the data:
> select sum(cast(columns[1] as interval year)) from `interval_data.csv`;
> Error: VALIDATION ERROR: From line 1, column 8 to line 1, column 45: Cannot
> apply 'SUM' to arguments of type 'SUM(<INTERVAL YEAR>)'. Supported form(s):
> 'SUM(<NUMERIC>)'
> Same error is encountered for same data from JSON file.
> This works for interval data from parquet file:
> ./parquet-schema ../interval_data.parquet
> message root {
> optional int32 c_row;
> optional fixed_len_byte_array(12) c_interval_year;
> optional fixed_len_byte_array(12) c_interval_month;
> optional fixed_len_byte_array(12) c_interval_day;
> optional fixed_len_byte_array(12) c_interval_hour;
> optional fixed_len_byte_array(12) c_interval_minute;
> optional fixed_len_byte_array(12) c_interval_second;
> optional binary c_interval (UTF8);
> optional int32 c_time;
> optional int32 c_date;
> optional int64 c_timestamp;
> }
> select sum(c_interval_year) from `interval_data.parquet`;
> +---------+
> | EXPR$0 |
> +---------+
> | P1692M |
> +---------+
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)