4

我正在尝试使用以下查询创建一个临时表,我正在尝试修改它以创建按日期分区的表

create table scratch.myTable
        as (
        select 
            concat(eid,'_',group) as eid_group,
            name,
            test
        from 
            test_logs 
        where 
            regexp_like(eid, '[A-Z0-9]{22}') and 
            (regexp_like(group, '[a-z0-9]{8}') OR group = '') and
            line_type = 'test' and
            date between '2018-09-27' and '2018-09-30' and
            eid NOT IN ('123456789','ABCDEFF')
        ) WITH (partitioned_by sequence('2018-09-27','2018-09-30'))

此查询在 s3 上创建一个临时表并将所有内容转储为 orc 文件。我正在partition按日期范围尝试此表

有人可以帮我查询吗?

4

1 回答 1

0

你试过用“over”代替“with”吗?

create table scratch.myTable
        as (
        select 
            concat(eid,'_',group) as eid_group,
            name,
            test
        from 
            test_logs 
        where 
            regexp_like(eid, '[A-Z0-9]{22}') and 
            (regexp_like(group, '[a-z0-9]{8}') OR group = '') and
            line_type = 'test' and
            date between '2018-09-27' and '2018-09-30' and
            eid NOT IN ('123456789','ABCDEFF')
        ) over(partition by date)
于 2018-10-12T15:20:25.293 回答