You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Paul Rogers (JIRA)" <ji...@apache.org> on 2018/04/28 22:45:00 UTC
[jira] [Created] (DRILL-6366) Inconsistency between typeof(), CAST
types
Paul Rogers created DRILL-6366:
----------------------------------
Summary: Inconsistency between typeof(), CAST types
Key: DRILL-6366
URL: https://issues.apache.org/jira/browse/DRILL-6366
Project: Apache Drill
Issue Type: Bug
Affects Versions: 1.13.0
Reporter: Paul Rogers
Drill supports the {{CAST(value AS type)}} syntax. However, Drill does not support the use of its own {{FLOAT4}} or {{FLOAT8}} types:
{noformat}
SELECT CAST(`balance` AS FLOAT4) AS `balance` FROM `csvh/cust.csvh`;
Error: VALIDATION ERROR: From line 1, column 26 to line 1, column 31: Unknown datatype name 'FLOAT4'
SELECT CAST(`balance` AS FLOAT8) AS `balance` FROM `csvh/cust.csvh`;
Error: VALIDATION ERROR: From line 1, column 26 to line 1, column 31: Unknown datatype name 'FLOAT8'
{noformat}
As it turns out, Drill requires the types {{FLOAT}} and {{DOUBLE}}
{noformat}
SELECT CAST(`balance` AS FLOAT) AS `balance` FROM `csvh/cust.csvh`;
+----------+
| balance |
+----------+
| 456.78 |
+----------+
SELECT CAST(`balance` AS DOUBLE) AS `balance` FROM `csvh/cust.csvh`;
+----------+
| balance |
+----------+
| 456.78 |
+----------+
{noformat}
The [documentation|http://drill.apache.org/docs/supported-data-types/] does only mention the SQL types ({{FLOAT}}, {{DOUBLE}}), so this may be OK. Except that {{typeof()}} reports internal types:
{noformat}
SELECT typeof(CAST(`balance` AS FLOAT)) AS `bal_type` FROM `csvh/cust.csvh`;
+-----------+
| bal_type |
+-----------+
| FLOAT4 |
+-----------+
SELECT typeof(CAST(`balance` AS DOUBLE)) AS `bal_type` FROM `csvh/cust.csvh`;
+-----------+
| bal_type |
+-----------+
| FLOAT8 |
+-----------+
{noformat}
As noted in DRILL-6362, {{typeof()}} does make up its own type names some times. Seems if it is going to make up type names, it should do so consistently to emit the type that the user should use in {{CAST}} to get a column of that type.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)