In ODSI 10gR3 fn:string-length() not pushing down to db (SR: 7714015.993)

Under ALDSP 2.5, the following XQuery...
where string-length($medacf) = 0 or $medacf = $acf/column_name
...used to generate this SQL:
where ((? = 0) OR (? = t1."COLUMN_NAME"))
However, under ODSI 10gR3, the where clause is missing. Here's the query plan:
<?xml version="1.0"?>
<FLWOR>
<return>
<elementConstructor name="UserGroup" tip="{ld:PhysicalLayer/UserProfile/UserGroup}UserGroup">
<elementConstructor field="(0)" name="UserID" from="$f7815">
</elementConstructor>
<elementConstructor field="(1)" name="GroupID" from="$f7815">
</elementConstructor>
</elementConstructor>
</return>
<where sqlstop="Unable to generate SQL for XQuery expression: Cannot generate SQL for the function {http://www.bea.com/xquery/xquery-operators}integer-equal with parameters (Parameter,INTEGER), (Constant,INTEGER). There is no equivalent SQL for this function in general or with these particular parameter kinds/types. ">
<operator ns="op" name="boolean-or" tip="{http://www.w3.org/2004/07/xpath-operators}boolean-or">
<EQ sqlstop="Cannot generate SQL for the function {http://www.bea.com/xquery/xquery-operators}integer-equal with parameters (Parameter,INTEGER), (Constant,INTEGER). There is no equivalent SQL for this function in general or with these particular parameter kinds/types. " tip="{http://www.bea.com/xquery/xquery-operators}integer-equal">
<operator ns="fn" name="string-length" tip="{http://www.w3.org/2004/07/xpath-functions}string-length">
<variable name="__fparam0" kind="EXTERNAL">
</variable>
</operator>
<constant>
<![CDATA[[integer 0]]]>
</constant>
</EQ>
<EQ tip="{http://www.bea.com/xquery/xquery-operators}string-equal">
<variable name="__fparam0" kind="EXTERNAL">
</variable>
<variable name="(2)" from="$f7815" kind="extracted">
</variable>
</EQ>
</operator>
</where>
<for name="$f7815">
<source ns="fn-bea" name="UsrProfDataSource" sqlwarning="Generated SQL query does not have a WHERE clause. This may cause the query to take longer to finish and use excessive memory resources." kind="relational" tip="UsrProfDataSource">
<![CDATA[SELECT UPPER(t1."USER_ID") AS c1, t1."GRP_ID" AS c2, t1."USER_ID" AS c3
FROM "USRPROF"."USER_GRP" t1]]>
</source>
</for>
</FLWOR>

We have found that in ODSI 10gR3, the code pattern below is not pushed down if $logicalExpression is an expression that compares two atomic values and one of the values is a constant (used to work in ALDSP 2.5):
where $logicalExpression or $table/column = $input
Sample code that is not pushed down as expected:
where fn:string-length($accountNumber) _<= 0_ or $account/ACCT_NUM = $accountNumber
where fn:empty($accountNumber) or $accountNumber _= ''_ or $account/ACCT_NUM = $accountNumber
where fn:empty($clientId) or $clientId _= 0_ or $account/CLIENT_ID = $clientId
where fn:empty($effectiveDate) or $effectiveDate _= xs:date('0001-01-01')_ or $account/ACCT_EFF_DT = $effectiveDate
We have also found that a workaround is to tweak the code and replace $logicalExpression with something that can be pushed down and functionally equivalent (using fn:not, fn-bea:fence, fn:exactly-one, etc.).
Code that works:
where fn:not(fn:string-length($accountNumber) > 0) or $account/ACCT_NUM = $accountNumber
where fn-bea:fence(fn:string-length($accountNumber) <= 0) or $account/ACCT_NUM = $accountNumber
where fn:exactly-one(fn:string-length($accountNumber) <= 0) or $account/ACCT_NUM = $accountNumber
After examining the query plans, it appears to me (please correct me if any of these is not true):
- Comparators for atomic types ({http://www.bea.com/xquery/xquery-operators} integer-less-than-or-equal, string-equal, date-equal, etc.) are not pushed down if they are used to compare anything with a constant
- An "or" operation ({http://www.w3.org/2004/07/xpath-operators} boolean-or) is not pushed down if any of its operands cannot be pushed down
- fn:not, fn-bea:fence, and fn:exactly-one can be pushed down even if their operand cannot be pushed down
So the question is, why comparators are not pushed down when constants are involved? Is this a bug?
Thanks!
-r.

Similar Messages

  • Formula Aggregation not pushed down to HANA DB

    Hi SAP Experts,
    We are creating a query in Query Designer. The query contains a formula with exception aggregate on material. See attachment 1 for details.
    When I execute and explain the query in RSRT, it runs for more than 1 min and the explain also says it has not been pushed down to HANA DB
    In RSRT query properties, we've tried each 'Operation in BWA/HANA' parameters, but the result is same.
    We are on BW7.4 SP7. HANA DB version is 1.00.70.00.386119
    According to SAP document, formula exception aggregate should be pushed down to HANA DB.
    Can any SAP expert advise if there's any specific setting you need to make to enable this? Thanks.
    Regards,
    Aaron

    Also would want to know if there are issues with the latest rev. SP7 w.r.t alerts and hdbstatisticsserver service under Landscape?
    I have observed the hdbstatisticsserver (and daemon.ini) doesnt come up on its own after db instance is restarted.
    FYI: I have HANA Instance on Linux VM (sandbox). 

  • Where clause one query not being pushed down

    I am having a problem where I cannot get a certain "optional" parameter to be pushed down to a query. The parameter gets applied in memory after the result set is returned but not pushed down to the DB. The function is as follows:
    declare function getFoo($key as xs:string, $optinalInput as xs:string*) as element(b:bar)*
    for $foo in f:getFoo()
    where $key = $foo/key
    where not(exists($optinalInput)) or $foo/optional = $optinalInput<- does not get pushed down to the query
    return $foo
    If I make optinalInput an xs:string instead of xs:string * and the optional parameter will get pushed to the query. The problem is for this optional parameter I could get anywhere from 0-50 in the sequence. Seems like when the parameter is a sequence it doesn't get applied to the query. Is there any way around this?

    Mike,
    I understand the difference between * and ? and I was one of the people working on the "string-length not getting pushed" problem so I am very familiar with it. I tried you solution that you mentioned below and it still did not push the where clause to the query. I know I could achieve this with an ad-hoc query but I wanted to do a pure xquery implementation of this component because of the benefits it could have when interacting with other components in our ODSI project...such as SQL joining and potentially pushing additional where clause down from components that call this component. The only way I did get this to kind of work is to do this:
    return
    for $o in $optinalInput
    for $foo in f:getFoo()
    where $key = $foo/key
    where $o = $foo/optional
    return
    $foo
    for $count in 1
    where not(exists($optinalInput))
    for $foo in f:getFoo()
    where $key = $foo/key
    return
    $foo
    By putting the optional parameter into a FOR statement above the table call it guarantees that at least one will exists and that's why the optional parameter gets pushed properly to the DB with a parameterized query. The problem with this is that even though a parameterized query gets pushed it will call the SQL statement multiple times!...not good.
    Another solution that was suggested to me would be to create the number of sequences for each item in the sequence and treat each item as it's own. For example if you know that the schema limits the sequence from 0..50 then you could make 50 items and 50 where clauses....probably not an optimal solution either but it would achieve properly pushing the where clause tot he DB.
    For now I am satisfied with this optional parameter not being pushed to the DB because the performance was still good but it would be nice if there was a maintainable pure xquery solution to this problem.
    Thanks for the help it's always appreciated!
    Mike

  • Questions on: 1) Last Update; 2) Max String Length; 3) dynamic table keys

    Hi:
    - I am currently prototyping a plug-in but I have some questions:
    - 1) At the 'All Metrics' table, what is the intent of the 'Last Upload' field,
    and how is this field updated?
    - I have created some metrics but for some metrics the 'Last Upload' field
    has a timestamp but for other metrics there is no data.
    As far as I know, the metrics are similar but I do not know why the behaviour is different.
    - 2) Is there a maximum string length that the Oracle agent can accept?
    - I have a script which just returns all the environment variables into one cell.
    In emagent.trc, the Oracle agent issues the following warning:
    2009-08-27 12:38:47 Thread-76336 WARN upload: Truncating value of "STRING_VALUE" from "AGENT_HOME=
    - Is the truncation an issue?
    - 3) I have created some dynamic tables from performing an snmp walk, but the key that I use
    is the index of the SNMP table. The data is collected correctly, but I am not sure that using
    the table index as the key for OEM is a good idea because the metrics are stored according to the SNMP table index.
    Should the OEM key be the something like 'object name' instead of the index number from performing an SNMP walk ?
    For example, when I click a metric, the metric name is: Sensor Index 1.
    But should it not be something like 'Fan #1' ?
    Thanks John

    Metrics are collected at certain intervals, the Last Upload field indicates the date and time of the last time a metric collection was uploaded. The quicker the interval, the more recent that date should be. If you don't specify a CollectionItem in your default collection file for your metrics, they won't be collected or uploaded.
    If your metric column is a STRING type, it is stored in a VARCHAR2(4000)
    I'm not sure I understand your last problem... You have a table metric with a set of columns. The column you use as the key is just some tracking index which doesn't really mean anything. As long as your key column(s) make the row unique, the agent will be satisfied. If you want something more meaningful as your key, then it's something you will have to inject into your dataset if it isn't already there.

  • While trying to invoke the method java.lang.String.length() of an object loaded from local variable 'payload'

    Hi,
    Our PI is getting data from WebSphere MQ and pushing to SAP. So our sender CC is JMS and receiver is Proxy. Our PI version is 7.31.
    Our connectivity between the MQ is success but getting the following error while trying to read the payload.
    Text: TxManagerFilter received an error:
    [EXCEPTION]
    java.lang.NullPointerException: while trying to invoke the method java.lang.String.length() of an object loaded from local variable 'payload'
           at com.sap.aii.adapter.jms.core.channel.filter.ConvertJmsMessageToBinaryFilter.filter(ConvertJmsMessageToBinaryFilter.java:73)
           at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:204)
           at com.sap.aii.adapter.jms.core.channel.filter.InboundDuplicateCheckFilter.filter(InboundDuplicateCheckFilter.java:348)
           at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:204)
    I have searched SDN but couldn't fix it. Please provide your suggestion.
    With Regards
    Amarnath M

    Hi Amarnath,
    Where exactly you are getting this error?
    If you are getting at JMS Sender communication channel, try to stop and start the JMS communication channel and see the status, also use XPI Inspector to get the exact error log.
    for reference follow below blogs:
    Michal's PI tips: ActiveMQ - JMS - topics with SAP PI 7.3
    Michal's PI tips: XPI inspector - help OSS and yourself
    XPI Inspector

  • Approval task SP09: Evaluation of approvalid failed with Exception: while trying to invoke the method java.lang.String.length() of an object loaded from local variable 'aValue'

    Hi everyone,
    I just installed SP09 and i was testing the solution. And I found a problem with the approvals tasks.
    I configured a simple ROLE approval task for validate add event. And when the runtime executes the task, the dispatcher log shows a error:
    ERROR: Evaluation of approvalid failed with Exception: while trying to invoke the method java.lang.String.length() of an object loaded from local variable 'aValue'
    And the notifications configured on approval task does not start either.
    The approval goes to the ToDO tab of the approver, but when approved, also the ROLE stays in "Pending" State.
    I downgraded the Runtime components to SP08 to test, and the approvals tasks works correctly.
    Has anyone passed trough this situation in SP09?
    I think there is an issue with the runtime components delivered with this initial package of SP09.
    Suggestions?

    Hi Kelvin,2016081
    The issue is caused by a program error in the Dispatcher component. A fix will be provided in Identity Management SP9 Patch 2 for the Runtime component. I expect the patch will be delivered within a week or two.
    For more info about the issue and the patch please refer to SAPNote 2016081.
    @Michael Penn - I might be able to assist if you provide the ticket number
    Cheers,
    Kristiyan
    IdM Development

  • Using "string-length" in STANDARD receiver determ xpath rule in PI 7.11

    Hi
    I have a situation, where I need to call one system, if the businesspartner value is 6 characters long and call an other system, if the length is different from 6 characters.
    I am trying to use the standard receiver determination by entering this rule, but it does not work:
    (string-length(/p1:ValidateUserRequest/Businesspartner)) = 6          ->   system1
    (string-length(/p1:ValidateUserRequest/Businesspartner)) not=  6   ->   system2
    Is there no way of sprucing up the standard xpath expression in the way I try?
    What alternatives do I have?
    Mikael

    Hi,
    Please try giving the XPath expression as given below:
    /p1:ValidateUserRequest [string-length(Businesspartner) = 6]  system1
    /p1:ValidateUserRequest [string-length(Businesspartner) != 6] system 2
    Please use square brackets before "string" and after "6"...its not getting displayed in my reply...:-(
    Rgds,
    Lekshmi.
    Edited by: Lekshmi N on Jan 6, 2010 12:29 PM

  • How to increase the string length of an uploaded file

    Hi,
    i use a abap webser where i've uploaded some JAR files into the mime repository.
    Unfortunately the string length is limited by 40 characters and so longer file names are cut.
    How can I increase the default string length? Does somebody know a workaround?
    Thanks.
    Edited by: Martin Gardyan on Oct 22, 2008 9:48 AM

    what i guess copying those jars should not create this problem.U just try in db using
    "ALTER TABLE <table_name> MODIFY <column_name> VARCHAR2(<new, larger length>)"
    may be it works.
    Regards,
    Anu

  • How to know the total string length of a range of cell in excel sheets

    Hi,
           I am working on Excel automation. I want to read data of collection of cells from excel for that i need to know the total string length in one shot.
    Can anyone suggest me the answer for this

    Still not sure about your requirements, but how about this
    SQL> CREATE OR REPLACE FUNCTION get_max_length(p_table in varchar2, p_col in varchar2) return pls_integer
      2  is
      3    v_cnt pls_integer;
      4  begin
      5    execute immediate 'select max(length('||p_col||')) from '||p_table into v_cnt;
      6    return v_cnt;
      7  end get_max_length;
      8  /
    Function created.
    SQL>
    SQL> SELECT COLUMN_NAME,
      2         DATA_LENGTH,
      3         get_max_length(TABLE_NAME, COLUMN_NAME) max_length
      4  FROM USER_TAB_COLUMNS
      5  WHERE TABLE_NAME='EMP'
      6  AND DATA_TYPE like '%CHAR%'
      7  ;
    COLUMN_NAME                    DATA_LENGTH MAX_LENGTH
    ENAME                                   10          6
    JOB                                      9          9
    SQL>

  • Regular expressions string length

    Hi
    New to regular expressions and trying to create an expressions that will test if a string does not contain any number and is less than 20 characters long! This works for determining if it has any numbers in it, but how do I specify that it can be between 1 and 20 characters in length? The + means >1 but how do I cap it?
    Pattern p = Pattern.compile("[a-zA-Z]+");
             Matcher m = p.matcher(value);
             if (m.matches()) System.out.println("yes");I have tried [a-zA-Z]+{5} but that doesn't work. Any handy hints... can't find much stuff that is applicable via google, frustrating.
    Thanks.

    Looce wrote:
    Pattern p = Pattern.compile("[a-zA-Z]{1,20}"); // repetition totally replaces +, doesn't coexist with it
    Matcher m = p.matcher(value);
    if (m.matches()) System.out.println("yes");
    Note that the following code can be shortened by doing:
    if(value.matches("[a-zA-Z]{1,20}")) { /* ... */ }

  • Limit string-length in Reporting Data Source

    Hello,
    we want to report some attributes to the BI. For this we use the standard reporting activity in the BPM. After we done a lot of configuration on the CE and the BI we achieved to connect the two systems. All attributes are passed correctly to the BI and now we have a problem with the string-length we pass to the BI. The string-length they get from the CE is 512 but the BI can only handle strings with a 60-length. Is it possible to limit the length of a string in the BPM or the CE?
    Manuel

    Hello Jun,
    I have created reporting data source in my BPM where my parameter defined is of type "STRING'.
    This data source is accessed by BW system for reporting purpose where they get an error as below -
    "STRING/XTRING types used Not supported by currently selected access method UDCGEN; cannot use this method"
    Looks like BW does not support string type, how can we make this datatype compatible?
    Please share if you have any idea.
    Thanks,
    Priya

  • Error : Summary String length exceeds maximum

    I just got an error while trying to Update a User on my IDM instance.
    com.waveset.util.InternalError  :  Summary String length (3003) exceeds maximum (2048)
    I already checked this forum for similar issues, and I found a couple of threads. However, for some reason, I was unable to VIEW those threads (something about not having the rights/access to read those threads)
    So, I am posting my issue here.
    Any help will be greatly appreciated

    Roman,
    if you are using NETBEANS, this is what you do :
    (a) right-click on the name of your instance (in the Projects Tab)
    (b) select IDM
    (c) then select "Download Objects"
    (d) From the list that appears, choose "Common Configuration Object Types"
    (e) Next, choose "*Repository Configuration"*
    Somewhere in this file, there is a clause which states : *"Maximum Summary = '2048'*
    Change this value to something higher (but, *NOT* too high !)
    This should solve your problem

  • Regarding calculation of string length.

    Hi All,
    can anybody tell me how to calculate length of a string which is having blank lines at the end of the string.
    DATA: v_text(132) TYPE c.
    EX: v_text = 'THIS IS TEST DATA                    '.
    How to find above strings length including blank spaces.
    Answer should be 37, It should not be 17 (or) 132.
    Please let me know if anybody have solution.
    Thanks in advance.
    Thanks & Regards,
    Rayeez.

    Hi Rayeez,
    37 ? Perhaps 18?
    Anyway I don't think it's possible, if your variables is more long than text how can it understand how many blank chars should be considered?
    In your example:
    - V_TEXT is long 132 CHAR,
    - the text is long 18 CHAR: 17 char and last blank char
    but when it moves the text to V_TEXT, it loses the information about last blank char, now for the system it's as if it was a text of 17 chars and blank space of 115 chars.
    I should know how many blank chars are before moving the text into variable.
    Max
    Message was edited by: max bianchi

  • Javax.crypto.IllegalBlockSizeException: Input data length not a multiple

    Hi All ,
    M worknig with NWCE 7.1.1. I have written code for decryption for decryption.  Earlier my web dynpro application was on CE7.1. We migrated it to CE 7.1.1 just week ago after migrating to CE 7.1.1 , on execution of decryption code m gtting as
    javax.crypto.IllegalBlockSizeException: Input data length not a multiple of blocksize
    i have written following code for decryption.
    public String decrypt( String encryptedString, String encryptionKey )
         String UNICODE_FORMAT = "UTF8";
         try
              if ( encryptedString == null || encryptedString.trim().length() <= 0 )
                   throw new IllegalArgumentException( "encrypted string was null or empty" );
                byte[] keyAsBytes = encryptionKey.getBytes(UNICODE_FORMAT);
                keySpec = new DESKeySpec(keyAsBytes);
                keyFactory = SecretKeyFactory.getInstance( "DES" );
                cipher = Cipher.getInstance( "DES" );
              SecretKey key = keyFactory.generateSecret( keySpec );
              cipher.init( Cipher.DECRYPT_MODE, key );
              BASE64Decoder base64decoder = new BASE64Decoder();
              byte[] cleartext = base64decoder.decodeBuffer( encryptedString );
              byte[] ciphertext = cipher.doFinal( cleartext );
              return new String( ciphertext );
         }catch (Exception e){
              IWDMessageManager messageManager = wdComponentAPI.getMessageManager();
              messageManager.reportException("Error while Decryption");
              e.printStackTrace();
              return "";
    This code was working fine in CE 7.1 . After migrating to CE 7.1.1 it started giving this error.

    Thank you for your answer
    how the code is usedI have hardcoded key, example
    byte[] key = "123456789abcdefg".getBytes();and String for crypt (Example, String in = "green";)
    Then I encrypt string in with code above (in qwestion body) and get exception IllegalBlockSizeException: Input data length not a multiple of blocksize
    String encrypt(String in) throws Exception{
      String out="";
      byte[] key = "123456789abcdefg".getBytes();
      Cipher ecipher = Cipher.getInstance("AES");
      ecipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "AES"));
      byte[] utf8 = in.getBytes("UTF8");
      byte[] enc = ecipher.doFinal(utf8);
      out = (new sun.misc.BASE64Encoder().encode(enc)).toString();
      return out;
    }Clients use JRE1.4 or high. I have JRE1.4 and all work correctly. Also, many clients have 1.4, but only part of they get exception. Code is in the server (this is part of servlet)
    This function run in one thread and doesn't use shared resources

  • Check string length server-side

    Hi guys,
    how do i check the string length server-side?
    I am using the date object to gather the current date.
    quote:
    var d = new Date();
    var mm = d.getMonth()+1;
    var yy = d.getFullYear();
    var dd = d.getDate();
    month is returned as "2" which is correct
    but i need to be able to check for a single char so that i
    can add a leading zero before it is submitted to the database. This
    is also required for day.
    thanks
    Paul

    Unfortunately, it's not possible to evaluate an environment variable within an SHTML tag.

Maybe you are looking for

  • How can I use my array in another method.... Or better yet, what's wrong?

    I guess I'll show you what I am trying to do rather and then explain it public class arraycalc int[] dog; public void arraycalc() dog = new int[2]; public void setSize(int size) dog[1] = size; public int getSize() return dog[1]; This gives me a null

  • How to get full row from F4 pop up window into selection-screen fields

    HI , I had a selection screen having 3 fields (vbeln, posnr, ebeln ) If i press F4 on field 1 i will get a pop up having all values. If i click on any one row in that popup, only the first field is getting filled with the value. But i want all the ot

  • ATG and Browser Cookies

    Hi All,   Wanted to know what are all the information stored in browser cookie and session.??? When talking about session in ATG, is it related to browser session/httpSesssion/session scoped component???/ Is the whole Order object is stored in the co

  • Missing effect problem!

    I have downloaded a project from a friend and in this project he uses the plug-in effect Trapcode Particular. I knew this before i downloaded his project so i intalled the effect on my machine too. But now when i open his project i always get the err

  • HT4571 can i pay this fee one time for one month with no contract or further charges

    if I activate my ipad with internet service by using this method... is it a one time charge, 30 day charge? no contract?  I would like to do this on occasion but not on a month to month basis with auto charges... help?