Come risolvere fine di indice non deve essere negativo in SQL?

0

Domanda

Ciao provo a creare una tabella con una query semplice come di seguito:

select distinct 
    b.week_start_date,
    count(distinct visitor_id) as uu,
    count(distinct visit_id) as session,
    sum(1) FILTER (WHERE event_name = 'pageview') AS pageview
from  
    table a
join 
    table b on a.date = b.cy_date_num_yyyymmdd
where 
    a.date between '20211107' and '20211113' 
group by 
    1

Tuttavia, ho un errore

GENERIC_INTERNAL_ERROR: fine indice (-2147483642), non deve essere negativo

E ho bisogno di pulire manualmente i dati da posizioni specificate nel manifesto. Athena non cancella i dati nel tuo account.

Così ho provato a creare un super-tabella vuota (query riportata di seguito) con formato definito per ogni metrica e quindi inserire la query di cui sopra, in questo super tabella. Ma restituisce sempre lo stesso errore. Qualcuno può aiutarmi a risolvere questo problema?

CREATE EXTERNAL TABLE IF NOT EXISTS database.super_table 
(
    week_start_date date,
    uu bigint,
    session bigint,
    pageview bigint
)ROW FORMAT SERDE 
  'org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe' 
STORED AS INPUTFORMAT 
  'org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat' 
OUTPUTFORMAT 
  'org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat'
LOCATION
  's3://abc-dataeng-temp-prod/xyz/product/'
TBLPROPERTIES (
  'has_encrypted_data'='false', 
  'parquet.compression'='GZIP');
1

Migliore risposta

0

Io non sono sicuro circa l'errore (una grande colonna valore, forse?). Provare questo approccio:

select
   b.week_start_date,
   count(distinct visitor_id) as uu,
   count(distinct session) as session,
   sum(1) as pageview
from table a
join table b on a.date = b.cy_date_num_yyyymmdd
where a.date between '20211107' and '20211113' 
and visitor_id is not null and session_id is not null and event_name = 'pageview'
group by 1
2021-12-06 00:50:41

In altre lingue

Questa pagina è in altre lingue

Русский
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................