Hive Select 选择语句排除一列或多列

    xiaoxiao2022-06-24  203

    有时候我们需要几乎所有的列,但是不包括分区列或其中的某些列,比如分区列要放最后,我们要在之前插入新列并插入新的数据,这时候排除一列或者多列的 select 语句就十分有用了

    排除num列

    set hive.support.quoted.identifiers=none; select `(num)?+.+` from (select row_number() over (partition by uid order by pay_time asc) as num ,* from order) first_order where num = 1;

    排除num和uid列 

    set hive.support.quoted.identifiers=none; select `(num|uid)?+.+` from (select row_number() over (partition by uid order by pay_time asc) as num ,* from order) first_order where num = 1;

    上面的 set hive.support.quoted.identifiers=none; 可以替换操作为:

    在 'hive-site.xml' 中添加以下配置,

    hive.support.quoted.identifiers=none


    最新回复(0)