CA Service Management

 View Only
  • 1.  Data partition generating a Cartesian product

    Posted May 16, 2023 07:12 AM

    Hi everyone,

    I have to create a data partition in call_req table where the user can see tickets that he opened by itself and tickets from a specific end users administrative organization. 

    So I created this condition below: 

    log_agent = @root.id OR customer.admin_org.name ='PMBH.SMSA'

    But when I save it, an error message appears stating that it generated a Cartesian product.



    Anyone know a alternative for this error?



    ------------------------------
    Regards,
    Felipe Nunes
    ------------------
    IT Analyst
    Prodabel
    ------------------------------


  • 2.  RE: Data partition generating a Cartesian product

    Posted May 16, 2023 09:04 AM
    Edited by Felipe V May 16, 2023 09:04 AM

    Hi,
    You must re-defining a where clause.

    You can try (I can't test):
    (NOT(NOT  ((customer.admin_org.name ='PMBH.SMSA') OR (log_agent = @root.id) )))

    The idea is avoid error situation, the further information on:
    How to avoid a cartesian product in a where clause



    ------------------------------
    Regards,

    Felipe Vandrilho

    Linkedin: https://www.linkedin.com/in/vandrilho/
    ------------------------------



  • 3.  RE: Data partition generating a Cartesian product

    Posted May 16, 2023 12:29 PM

    Hi Felipe, 

    Thanks for you replay. 
    But I did as you suggested and I've got the same error. 



    ------------------------------
    Regards,
    Felipe Nunes
    ------------------
    IT Analyst
    Prodabel
    ------------------------------



  • 4.  RE: Data partition generating a Cartesian product

    Posted May 17, 2023 08:19 AM

    You could rewrite the condition, following the KB logic:
    (A AND B) OR (A AND NOT B) OR (NOT A AND B)

    Sounds like:

    ((log_agent = @root.id) AND (customer.admin_org.name = 'PMBH.SMSA')) OR
    ((log_agent != @root.id) AND (customer.admin_org.name = 'PMBH.SMSA')) OR
    ((log_agent = @root.id) AND (customer.admin_org.name != 'PMBH.SMSA'))

    Another way is reduce depth check, minus depth prevents cartesian product

    ((log_agent = @root.id) AND (customer.admin_org = <SREL_ATTRIBUTE>)) OR
    ((log_agent != @root.id) AND (customer.admin_org = <SREL_ATTRIBUTE>)) OR
    ((log_agent = @root.id) AND (customer.admin_org != <SREL_ATTRIBUTE>))




    ------------------------------
    Regards,

    Felipe Vandrilho

    Linkedin: https://www.linkedin.com/in/vandrilho/
    ------------------------------



  • 5.  RE: Data partition generating a Cartesian product

    Posted May 18, 2023 08:46 AM

    Hi Felipe,

    It's worked fine!
    Thank you again for your support!



    ------------------------------
    Regards,
    Felipe Nunes
    ------------------
    IT Analyst
    Prodabel
    ------------------------------