Turns out I really needed better type functions in order to explain the nuances
of Drill types, so I went ahead and created them.
See DRILL-6361, PR #1242 [1]. Examples shown in the PR. Reviewers very much
appreciated.
Thanks,
- Paul
[1] https://github.com/apache/drill/pull/1242
On Sat
I’d like to weigh in here, but this would be EXTREMELY useful. When I was
trying to write connectors to enable various BI tools to connect to Drill, such
as SQLPad and Metabase, the inability to get information about how drill
interprets the data was really difficult to get around. Just me .02
Hi Rob,
Thanks for the suggestion. While this works for Hive (as you showed), it does
not work for CSV files:
DESCRIBE `csvh/cust.csvh`;
+--++--+
| COLUMN_NAME | DATA_TYPE | IS_NULLABLE |
+--++--+
+--+
Thanks!
A it turns out, typeof() is not documented on the Apache Drill website which is
why I was confused. Maybe we should document it.
Just tried typeof(). Turns out it only returns the type, not the nullability or
repeated mode. Is there a separate function to get the "mode" information?
-
Hi Paul,
You could also use DESCRIBE (https://drill.apache.org/docs/describe/).
0: jdbc:drill:drillbit=localhost:31010> describe
`hive.default`.`integer_table`
. . . . . . . . . . . . . . . . . . . > ;
+--++--+
| COLUMN_NAME | DATA_TYPE | IS_N
Hey Paul,
You could use the typeof() function for this purpose. It takes a single
parameter - the column name.
For example:
> select typeof(c_current_cdemo_sk) from customer limit 1;
+-+
| EXPR$0 |
+-+
| BIGINT |
+-+
1 row selected (0.472 seconds)
On Wed, Apr 25, 2018
You can do it through SQL using typeof() function. Since there is no
global schema, Drill evaluates this for each row.
0: jdbc:drill:drillbit=10.10.101.41> select n_name, typeof(n_name) as
name_type, n_nationkey, typeof(n_nationkey) as nationkey_type from
cp.`tpch/nation.parquet` limit 2;
*+
Hi All,
Anyone know if there is a non-code way to display the data types of columns
returned from a Drill query? Sqlline appears to only show the column names and
values. The same is true of the Drill web console.
The EXPLAIN PLAN FOR ... command shows the query plan, but not type (which are
onl