BigQuery: SPLIT() returns only one value

前端 未结 5 1291
时光说笑
时光说笑 2020-12-05 11:35

I have a page URL column components of which are delimited by /. I tried to run the SPLIT() function in BigQuery but it only gives the first value.

5条回答
  •  鱼传尺愫
    2020-12-05 12:19

    Solved it in a way.

       SELECT
       date, 
       hits_time, 
       fullVisitorId, 
       visitNumber, 
       hits_hitNumber,
       X.page_path,
       REGEXP_EXTRACT(X.page_path,r'/(\w*)\/') as one,
       REGEXP_EXTRACT(X.page_path,r'/\w*\/(\w*)') as two,
       REGEXP_EXTRACT(X.page_path,r'/\w*\/\w*\/(\w*)') as three,
       REGEXP_EXTRACT(X.page_path,r'/\w*/\w*/\w*\/(\w*)\/.*') as four
       from
       (
       select 
       date, hits_time, fullVisitorId, visitNumber, hits_hitNumber,
       REGEXP_REPLACE (hits_page_pagePath, '-', '') as page_path
       from
       [Intent.All2mon]
       ) X 
       limit 1000
    

提交回复
热议问题