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?
- Paul
On Wednesday, April 25, 2018, 10:09:34 PM PDT, Aman Sinha
<[email protected]> wrote:
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;
*+------------+------------+--------------+-----------------+*
*| ** n_name ** | **name_type ** | **n_nationkey ** | **nationkey_type **
|*
*+------------+------------+--------------+-----------------+*
*| *ALGERIA * | *VARCHAR * | *0 * | *INT * |*
*| *ARGENTINA * | *VARCHAR * | *1 * | *INT * |*
*+------------+------------+--------------+-----------------+*
On Wed, Apr 25, 2018 at 9:22 PM, Paul Rogers <[email protected]>
wrote:
> 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 only known at run time.) Is there a statement, system table or some
> other trick to display column types in, say, Sqlline?
> In the past, I've gotten the types by using unit test style code. But,
> that is not to handy for use as an example for non-developers...
> Thanks,
> - Paul
>
>