Function causes Attempted to dereference nonexistent field error
book
Article ID: KB0078122
calendar_today
Updated On:
Description
I have a function which uses a named schema
function removeNullSequence (test TestSchema, sequenceNumber int) { TestSchema(test.id, coalesce(sequenceNumber, test.value)) }
If the application does not also have an Query Table element, then the application uses the function and runs without error.
If the application does have a Query Table, then the application fails at startup with error:
ERROR c.streambase.sb.xmlrpc.XmlRpcManager - Exception processing RPC: GenerationContext$DereferenceNonExistentFieldException: Attempted to dereference nonexistent field TupleHandle@38510607(Constant_TestSchema).TestSchema
How can I use my function in an application that also has a Query Table?
Resolution
This issue is defect "SB-46124 Attempted to dereference nonexistent field from constant function using named schema" found to affect TIBCO StreamBase 7.7.6 and TIBCO Streaming 10.4.2 and likely earlier versions as well. This may be fixed in a future release, so please check the Release Notes.
There are two workarounds...
A) Change the function to not use a the named schema in the implementation by name, but the type of a parameter of that type, using the new_tuple() function:
function removeNullSequence (test TestSchema, sequenceNumber int) { new_tuple(test,test.id as id, coalesce(sequenceNumber, test.value) as test.value) }
B) Remove the function as a Constant and use it in a Map declaration where needed in Additional Expressions:
This prevents the function from being typechecked before the named schemas are defined.
Issue/Introduction
Known defect and alternatives
Feedback
thumb_up
Yes
thumb_down
No