drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Barclay (Drill) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-2459) INFO._SCHEMA's CHARACTER_MAXIMUM_LENGTH is -1 for type CHAR
Date Sat, 14 Mar 2015 03:10:38 GMT
Daniel Barclay (Drill) created DRILL-2459:
---------------------------------------------

             Summary: INFO._SCHEMA's CHARACTER_MAXIMUM_LENGTH is -1 for type CHAR
                 Key: DRILL-2459
                 URL: https://issues.apache.org/jira/browse/DRILL-2459
             Project: Apache Drill
          Issue Type: Bug
          Components: Metadata
            Reporter: Daniel Barclay (Drill)
            Assignee: Steven Phillips


INFORMATION_SCHEMA.COLUMNS.CHARACTER_MAXIMUM_LENGTH does not report the length for type CHAR.
 For example, for type descriptor "CHAR(4)", it doesn't return 4.  Instead, it returns 1:

0: jdbc:drill:zk=local> USE dfs.tmp;
+------------+------------+
|     ok     |  summary   |
+------------+------------+
| true       | Default schema changed to 'dfs.tmp' |
+------------+------------+
1 row selected (0.05 seconds)
0: jdbc:drill:zk=local> CREATE OR REPLACE VIEW TempView AS SELECT CAST( NULL AS VARCHAR(3)
), CAST( NULL AS CHAR(4) )  FROM INFORMATION_SCHEMA.CATALOGS LIMIT 1 ;
+------------+------------+
|     ok     |  summary   |
+------------+------------+
| true       | View 'TempView' replaced successfully in 'dfs.tmp' schema |
+------------+------------+
1 row selected (0.05 seconds)
0: jdbc:drill:zk=local> SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'TempView';
+---------------+--------------+------------+-------------+------------------+-------------+------------+--------------------------+-------------------------+---------------+-------------------+
| TABLE_CATALOG | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | ORDINAL_POSITION | IS_NULLABLE
| DATA_TYPE  | CHARACTER_MAXIMUM_LENGTH | NUMERIC_PRECISION_RADIX | NUMERIC_SCALE | NUMERIC_PRECISION
|
+---------------+--------------+------------+-------------+------------------+-------------+------------+--------------------------+-------------------------+---------------+-------------------+
| DRILL         | dfs.tmp      | TempView   | EXPR$0      | 0                | NO        
 | VARCHAR    | 3                        | -1                      | -1            | -1  
             |
| DRILL         | dfs.tmp      | TempView   | EXPR$1      | 1                | NO        
 | CHAR       | -1                       | -1                      | -1            | 4   
             |
+---------------+--------------+------------+-------------+------------------+-------------+------------+--------------------------+-------------------------+---------------+-------------------+
2 rows selected (0.072 seconds)
0: jdbc:drill:zk=local> 


Hmm.  Note the 4 in the NUMERIC_PRECISION column:

0: jdbc:drill:zk=local> SELECT DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION FROM
INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'TempView';
+------------+--------------------------+-------------------+
| DATA_TYPE  | CHARACTER_MAXIMUM_LENGTH | NUMERIC_PRECISION |
+------------+--------------------------+-------------------+
| VARCHAR    | 3                        | -1                |
| CHAR       | -1                       | 4                 |
+------------+--------------------------+-------------------+
2 rows selected (0.065 seconds)
0: jdbc:drill:zk=local> 




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

Mime
View raw message