cube icon indicating copy to clipboard operation
cube copied to clipboard

Error when use word "term" in schema

Open frimuchkov opened this issue 3 years ago • 2 comments

Hi!

In some cases, when we use field Report."adTerm" in reports, Cube say thant there is no Report."ad" (!) field.

Doesn't work:

AND (Report."adTerm" LIKE '%First%' OR Report."campaign" = 'main_campaign')

Works fine:

AND (Report."campaign" = 'main_campaign' OR Report."adTerm" LIKE '%First%')

Original query:

SELECT
    'none' as "first_interval_dimension",
    MEASURE(Report.cost) as "first_interval_cost",
FROM Report
WHERE Report."date" >= '2022-09-09' AND  Report."date" <= '2022-10-06'
    AND (adTerm LIKE '%First%' OR campaign = 'main_campaign')
ORDER BY first_interval_sessions DESC NULLS LAST LIMIT 25 OFFSET 0

Error:

Internal: Error during planning: No field named 'report.ad'.
Valid fields are 'report__ad_account', 'report__ad_content', 'report__ad_platform',
'report__boost', 'report__campaign', 'report__city', 'report__country',
'report__data_source_id', 'report__date', 'report__device',
'report__domain', 'report__medium', 'report__source',
'report__source_medium', 'report__date_day', 'report__clicks'

As you can see, there is no report__ad_term in error, but we have it in our Cube and if we use adTerm before campaign everething works fine.

frimuchkov avatar Oct 10 '22 15:10 frimuchkov

BTW, noticed, we don't use Report."adTerm" in in preaggregation

frimuchkov avatar Oct 10 '22 16:10 frimuchkov

Hi @frimuchkov. I will investigate and come back soon. Thank you 🤝

gandronchik avatar Nov 03 '22 07:11 gandronchik

Hi @frimuchkov 👋

I've tried to reproduce this with the following data model but wasn't able to:

cubes:
  - name: meta_prefix
    sql: SELECT * FROM tbl WHERE (Report."adTerm" LIKE '%First%' OR Report."campaign" = 'main_campaign')

    measures:
      - name: count
        type: count

It works just fine: Screenshot 2024-09-02 at 17 34 53

Could you please help me reproduce this?

igorlukanin avatar Sep 02 '24 15:09 igorlukanin

It looks like this has been resolved. Closing for now, please feel free to reopen if needed.

igorlukanin avatar Sep 25 '24 15:09 igorlukanin