In the version of Impala that you're using, unixtime_micros will not
be supported by Impala, though I don't know why the error is
complaining about 'bool'.
I can't reproduce this issue on Impala master (which now supports
UNIXTIME_MICROS):
import kudu
from kudu.client import Partitioning
builder = kudu.schema_builder()
builder.add_column('key').type(kudu.int64).nullable(False).primary_key()
builder.add_column('id1').type(kudu.int8).nullable(False)
builder.add_column('id2').type(kudu.int32).nullable(False)
builder.add_column('id3').type(kudu.int16).nullable(False)
builder.add_column('id4').type(kudu.float).nullable(False)
builder.add_column('id5').type(kudu.double).nullable(False)
builder.add_column('id6').type(kudu.bool).nullable(False)
builder.add_column('str', type_=kudu.string, nullable=False, compression='lz4')
builder.add_column('time', type_=kudu.unixtime_micros, nullable=False,
compression='lz4')
schema = builder.build()
partitioning = Partitioning().add_hash_partitions(column_names=['key'],
num_buckets=3)
c.create_table('foo', schema, partitioning)
In Impala:
[localhost:21000] > create external table foo stored as kudu TBLPROPERTIES (
'kudu.table_name' = 'foo' );
Query: create external table foo stored as kudu TBLPROPERTIES (
'kudu.table_name' = 'foo' )
Fetched 0 row(s) in 0.05s
[localhost:21000] > describe foo;
Query: describe foo
+------+-----------+---------+-------------+----------+---------------+---------------+---------------------+------------+
| name | type | comment | primary_key | nullable | default_value
| encoding | compression | block_size |
+------+-----------+---------+-------------+----------+---------------+---------------+---------------------+------------+
| key | bigint | | true | false |
| AUTO_ENCODING | DEFAULT_COMPRESSION | 0 |
| id1 | tinyint | | false | false |
| AUTO_ENCODING | DEFAULT_COMPRESSION | 0 |
| id2 | int | | false | false |
| AUTO_ENCODING | DEFAULT_COMPRESSION | 0 |
| id3 | smallint | | false | false |
| AUTO_ENCODING | DEFAULT_COMPRESSION | 0 |
| id4 | float | | false | false |
| AUTO_ENCODING | DEFAULT_COMPRESSION | 0 |
| id5 | double | | false | false |
| AUTO_ENCODING | DEFAULT_COMPRESSION | 0 |
| id6 | boolean | | false | false |
| AUTO_ENCODING | DEFAULT_COMPRESSION | 0 |
| str | string | | false | false |
| AUTO_ENCODING | LZ4 | 0 |
| time | timestamp | | false | false |
| AUTO_ENCODING | LZ4 | 0 |
+------+-----------+---------+-------------+----------+---------------+---------------+---------------------+------------+
Fetched 9 row(s) in 4.75s
On Thu, Jun 1, 2017 at 10:34 PM, x_hsky <[email protected]> wrote:
> impala versoin: cdh5.10.0
> kudu verson: 1.3.0-SNAPSHOT
>
>
> Create the table by kudu api, it is ok:
> builder = kudu.schema_builder()
> builder.add_column('key').type(kudu.int64).nullable(False).primary_key()
> builder.add_column('id1').type(kudu.int8).nullable(False)
> builder.add_column('id2').type(kudu.int32).nullable(False)
> builder.add_column('id3').type(kudu.int16).nullable(False)
> builder.add_column('id4').type(kudu.float).nullable(False)
> builder.add_column('id5').type(kudu.double).nullable(False)
> builder.add_column('id6').type(kudu.bool).nullable(False)
> builder.add_column('str', type_=kudu.string, nullable=False,
> compression='lz4')
> builder.add_column('time', type_=kudu.unixtime_micros, nullable=False,
> compression='lz4')
> schema = builder.build()
>
>
> However, when I create a kudu table from impala-shell, I will report errors:
> [db.sky.org:21000] > create table test(id int primary key,id2 binary)
> partition by hash partitions 8 stored as kudu;
> Query: create table test(id int primary key,id2 binary) partition by hash
> partitions 8 stored as kudu
> ERROR: AnalysisException: Unsupported data type: BINARY
> [db.sky.org:21000] > create external table test stored as kudu
> TBLPROPERTIES('kudu.table_name'='test_type');
> Query: create external table test stored as kudu
> TBLPROPERTIES('kudu.table_name'='test_type')
> ERROR:
> ImpalaRuntimeException: Error loading schema of table 'test_type'
> CAUSED BY: ImpalaRuntimeException: Kudu type 'bool' is not supported in Impala
> [db.sky.org:21000] >
> I found that, in addition to integer and string type, the other kudu field
> types can not be supported in the impala-shell.why ?
>