新增字段:alter table dbname.table_name add columns (dln_d bigint);
修改字段:alter table dbname.tablea change clumna clumnb decimal(38,2) comment 'test' ;
表迁移至其他库 : A.test 移动到B中
alter table A.test rename to B.test;
如出错执行:invalidate metadata B.test;
时间转换:
select from_unixtime(unix_timestamp('2017-09-06 15:22:28'),'yyyyMMddHHmm');
select from_unixtime(unix_timestamp('2017-09-06 15:22:28'),'yyyyMMddHHmm');
select from_unixtime(unix_timestamp('201709061522','yyyyMMddHHmm'),'yyyy-MM-dd HH:mm');
impala-shell时报警告:
set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable
impala安装目录下引用的python包权限问题
root用户下执行: chmod g-wx,o-wx /var/lib/impala/.python-eggs/
【时间转换】
select from_unixtime(unix_timestamp('2017-09-06 15:22:28'),'yyyyMMddHHmm');
select from_unixtime(unix_timestamp('2017-09-06 15:22:28'),'yyyyMMddHHmm');
select from_unixtime(unix_timestamp('201709061522','yyyyMMddHHmm'),'yyyy-MM-dd HH:mm');
时间差
datediff(timestamp,timestamp)
加8小时
SELECT date_add(cast(FROM_UNIXTIME(1501582482) as TIMESTAMP), interval 8 hours);添加权限:
grant select on table test.test_table to role user;