Open jeancochrane opened 3 months ago
@dfsnow After some investigation by @Damonamajor, I think that we may be operating on an incorrect assumption about the data here. Try these two queries to confirm that tot57
is consistently 0 when dweldat
and comdat
have omitted classes:
select dweldat.class, dweldat.taxyr, asmt.procname, asmt.tot57
from iasworld.dweldat dweldat
left join iasworld.asmt_all asmt
on dweldat.parid = asmt.parid
and dweldat.taxyr = asmt.taxyr
and asmt.deactivat is null
and asmt.valclass is null
and asmt.procname in ('CCAOVALUE', 'CCAOFINAL', 'BORVALUE')
and asmt.rolltype != 'RR'
where dweldat.cur = 'Y'
and dweldat.deactivat is null
and dweldat.class like 'OA%'
select comdat.class, comdat.taxyr, asmt.procname, asmt.tot57
from iasworld.comdat comdat
left join iasworld.asmt_all asmt
on comdat.parid = asmt.parid
and comdat.taxyr = asmt.taxyr
and asmt.deactivat is null
and asmt.valclass is null
and asmt.procname in ('CCAOVALUE', 'CCAOFINAL', 'BORVALUE')
and asmt.rolltype != 'RR'
where comdat.cur = 'Y'
and comdat.deactivat is null
and comdat.class like 'OA%'
Is something wrong with these queries, or is tot57
not actually consistently 0 when the dweldat
or comdat
class is omitted?
@jeancochrane I don't think the typical filtering rules apply here unfortunately. The OA2
record for the first record returned by your first query has both a non-null valclass
(equal to OA2
) and a null procname
.
OK, I think we can do this, but we'll see incorrect failures until we can update our sqoop job to import past tax years with OA classes. Once that's done, the correct query to find the asmt_all
record with a nonzero value for tot57
should look something like this (with dweldat as an example detail table):
select dweldat.parid, dweldat.taxyr, dweldat.class, asmt.valclass, asmt.cur, asmt.tot57
from iasworld.comdat dweldat
left join iasworld.asmt_all asmt
on dweldat.parid = asmt.parid
and dweldat.taxyr = asmt.taxyr
and asmt.valclass like 'OA%'
and asmt.cur = 'Y'
where dweldat.cur = 'Y'
and dweldat.deactivat is null
and dweldat.class like 'OA%'
Since this doesn't neatly map to any of our generic tests due to the complex join, I think we'll probably want to make a view in the qc
schema that joins all of the detail tables (dweldat
, comdat
, etc.) to asmt_all
with the filters listed above, and then add two tests on tot57
:
accepted_range
with min_value: 0
and inclusive: false
not_null
@jeancochrane @Damonamajor What's going on with this issue? Looks like the blocker reason is Awaiting updated sqoop job
, but sqoop should run each night.
@dfsnow If I recall correctly, the issue was that we weren't sqooping historical data that contained new omitted class codes, so the test was failing incorrectly due to our data warehouse mirror being out of date. Not sure if we've found a way around that problem yet, but I'll defer to your judgment.
Got it, in that case, we're blocked by https://github.com/ccao-data/service-sqoop-iasworld/issues/14.
This is our current understanding of the new omitted class codes:
Let's implement that a test specifying that rows in detail tables with
OA
class codes need to have a correspondingtot57
value in the same year.