I have an MDX query which is referencing a level backed by a closure. The query is rolling up values so it is referencing the parent side of the closure. My aggregation table includes a foreign key to the child side, and therefore the bit keys are not matching.

This comment in section 6.1 of the Mondrian manual makes me believe that it should be able to recognize the need to join to the parent_id:
But because the aggregate table has the same foreign key as the salary fact table, Mondrian is able to automatically join salary.employee_id to eitheragg_salary_Employee_Time_Year.employee_id or agg_salary_Employee_Time_Year.supervisor_id to rollup employees efficiently.
Any help on figuring out why the AggregationManager is not able to recognize the need to do a join would be appreciated.

My MDX Query
Code:
SELECT {[Measures].[Amount]} on COLUMNS,
        {[Category].[Services].Children} on ROWS
from [AP]
My Schema
Code:
<Schema name="MySchema">
        <Cube name="AP">
                <Table name="ap_row"/>
                <Dimension name="Category" foreignKey="matched_category_id">
                        <Hierarchy hasAll="false" primaryKey="id" primaryKeyTable="category_view">
                                <Table name="category"/>
                                <Level name="Category Id" uniqueMembers="true" type="Numeric" column="id" nameColumn="name" parentColumn="parent_id" nullParentValue="null">
                                        <Closure parentColumn="parent_id" childColumn="id">
                                                <Table name="category_closure"/>
                                        </Closure>
                                        <Property name="FQName" column="fqname"/>
                                </Level>
                        </Hierarchy>
                </Dimension>
                <Measure name="Amount" column="amount" aggregator="sum" dataType="Numeric" formatString="#,###.00"/>
        </Cube>
</Schema>
Database Structure
Code:
TABLE: ap_row
          Column          |            Type             |                      Modifiers
--------------------------+-----------------------------+-----------------------------------------------------
 id                       | bigint                      | not null default nextval('ap_row_id_seq'::regclass)
 gl_date                  | timestamp without time zone |
 vendor_number            | character varying(100)      |
 name                     | character varying(255)      | not null
 gl_account               | character varying(100)      |
 gl_description           | character varying(255)      |
 amount                   | numeric(15,2)               |
 raw                      | text                        |
 raw_name                 | character varying(255)      |
 batch_id                 | bigint                      | not null
 matched_vendor_id        | bigint                      |
 matched_business_line_id | bigint                      |
 matched_category_id      | bigint                      |
 date_processed           | timestamp without time zone |
 last_updated             | timestamp without time zone |
 last_updated_by          | bigint                      |
 department               | character varying           |
 department_name          | character varying           |


TABLE: agg_monthly_ap_row
       Column        |  Type   | Modifiers
---------------------+---------+-----------
 matched_category_id | bigint  |
 amount              | numeric |
 fact_count          | bigint  |


TABLE: category_closure
  Column   |  Type   | Modifiers
-----------+---------+-----------
 id        | bigint  |
 parent_id | bigint  |
 distance  | integer |


TABLE: category
  Column   |          Type          | Modifiers
-----------+------------------------+-----------
 id        | bigint                 |
 level     | integer                |
 name      | character varying(100) |
 parent_id | bigint                 |
 level0    | bigint                 |
 level1    | bigint                 |
 level2    | bigint                 |
 level3    | bigint                 |
 level4    | bigint                 |
 level5    | bigint                 |
 fqname    | text                   |
Relevant Log Lines
Code:
DEBUG FastBatchingCellReader - FastBatchingCellReader: bitkey=0x0000000000000000000000000000000000000000000000000000000000000100
  Closure (2): "category_closure"."parent_id"


DEBUG SegmentCacheIndexImpl - SegmentCacheIndexImpl(1092609876).add:
*Segment Header
Schema:[MySchema]
Checksum:[d9f42a20353ef99f524ad6777abf54ee]
Cube:[AP]
Measure:[Amount]
Axes:[
    {category_closure.parent_id=('57.0','111.0','256.0','398.0','507.0','787.0','888.0')}]
Excluded Regions:[]
Compound Predicates:[]
ID:[0b6404bd7ef1517b397fe2cb94fab35d9809d5580def4c14d8432e2faa2a1e81]


DEBUG BatchLoader$Batch - Batch.load (millis) 18
DEBUG FastBatchingCellReader - load (millis): 24
DEBUG AggregationManager - NO MATCH : ap_row
Foreign columns bit key=0x0000000000000000000000000000000000000000000000000000000000000100
Measure bit key=        0x0000000000000000000000000000000000000000000000000000000000010000
Agg Stars=[
AggStar:agg_monthly_ap_row
   bk=0x0000000000000000000000000000000000000000000000000000000000010011
  fbk=0x0000000000000000000000000000000000000000000000000000000000000011
  mbk=0x0000000000000000000000000000000000000000000000000000000000010000
  has foreign key=true
    Amount (4): sum("agg_monthly_ap_row"."amount")
    Category Id (0): "category"."name"
    Category Id (Key) (1): "category"."id"
  Table:
    name=agg_monthly_ap_row
    relation=agg_monthly_ap_row
    numberofrows=651341
    FactCount:
      Fact Count (-1): "agg_monthly_ap_row"."fact_count"
    Measures:
      Amount (4): sum("agg_monthly_ap_row"."amount")
    Levels:
    Table:
      name=category
      relation=category
      Levels:
        Category Id (0): "category"."name"
        Category Id (Key) (1): "category"."id"
      JoinCondition:
        left="agg_monthly_ap_row"."matched_category_id"
        right="category"."id"
]
DEBUG AggregationManager - generateSqlQuery: sql=select
    "category_closure"."parent_id" as "c0",
    sum("ap_row"."amount") as "m0"
from
    "category_closure" as "category_closure",
    "ap_row" as "ap_row"
where
    "ap_row"."matched_category_id" = "category_closure"."id"
and
    "category_closure"."parent_id" in (57.0, 111.0, 256.0, 398.0, 507.0, 787.0, 888.0)
group by
    "category_closure"."parent_id"
DEBUG sql - 8: Segment.load: executing sql [
select
    "category_closure"."parent_id" as "c0",
    sum("ap_row"."amount") as "m0"
from
    "category_closure" as "category_closure",
    "ap_row" as "ap_row"
where
    "ap_row"."matched_category_id" = "category_closure"."id"
and
    "category_closure"."parent_id" in (57.0, 111.0, 256.0, 398.0, 507.0, 787.0, 888.0)
group by
    "category_closure"."parent_id"]