[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fix-fncall-iterator into lp:zorba

2014-04-15 Thread Zorba Build Bot
Validation queue succeeded - proposal merged!
-- 
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fix-fncall-iterator into lp:zorba

2014-04-15 Thread noreply
The proposal to merge lp:~zorba-coders/zorba/fix-fncall-iterator into lp:zorba 
has been updated.

Status: Needs review => Merged

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934
-- 
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fix-fncall-iterator into lp:zorba

2014-04-15 Thread Zorba Build Bot
Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934

Progress dashboard at http://jenkins.zorba.io:8180/view/ValidationQueue
-- 
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/fix-fncall-iterator into lp:zorba

2014-04-15 Thread Federico Cavalieri
Review: Approve


-- 
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fix-fncall-iterator into lp:zorba

2014-04-15 Thread Zorba Build Bot
Validation queue result for 
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934

Stage "CommitZorba" failed.

Check console output at 
http://jenkins.lambda.nu:8180/job/CommitZorba/317/console to view the results.
-- 
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fix-fncall-iterator into lp:zorba

2014-04-15 Thread Zorba Build Bot
Voting criteria failed for the following merge proposals:

https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934
 :
Votes: {'Approve': 1}
-- 
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fix-fncall-iterator into lp:zorba

2014-04-15 Thread Zorba Build Bot
Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934

Progress dashboard at http://jenkins.zorba.io:8180/view/ValidationQueue
-- 
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fix-fncall-iterator into lp:zorba

2014-04-15 Thread Zorba Build Bot
Validation queue result for 
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934

Stage "CommitZorba" failed.

Check console output at 
http://jenkins.lambda.nu:8180/job/CommitZorba/316/console to view the results.
-- 
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fix-fncall-iterator into lp:zorba

2014-04-15 Thread Zorba Build Bot
Voting criteria failed for the following merge proposals:

https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934
 :
Votes: {'Approve': 1}
-- 
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fix-fncall-iterator into lp:zorba

2014-04-15 Thread Zorba Build Bot
Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934

Progress dashboard at http://jenkins.zorba.io:8180/view/ValidationQueue
-- 
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/fix-fncall-iterator into lp:zorba

2014-04-15 Thread Matthias Brantner
Review: Approve


-- 
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/fix-fncall-iterator into lp:zorba

2014-04-15 Thread Federico Cavalieri
I found a regression, investigating
-- 
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fix-fncall-iterator into lp:zorba

2014-04-15 Thread Federico Cavalieri
Federico Cavalieri has proposed merging 
lp:~zorba-coders/zorba/fix-fncall-iterator into lp:zorba.

Commit message:
Fixed external functions skip iterator

Requested reviews:
  Matthias Brantner (matthias-brantner)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934

Fixed external functions skip iterator
-- 
https://code.launchpad.net/~zorba-coders/zorba/fix-fncall-iterator/+merge/215934
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/runtime/core/fncall_iterator.cpp'
--- src/runtime/core/fncall_iterator.cpp	2014-02-25 03:58:17 +
+++ src/runtime/core/fncall_iterator.cpp	2014-04-15 18:58:26 +
@@ -773,7 +773,8 @@
 /***
 
 /
-ExtFunctionCallIteratorState::ExtFunctionCallIteratorState()
+ExtFunctionCallIteratorState::ExtFunctionCallIteratorState():
+  theIsEvaluated(false)
 {
 }
 
@@ -951,48 +952,40 @@
   STACK_END( state );
 }
 
-bool ExtFunctionCallIterator::skip( int64_t count,
-PlanState &planState ) const {
+bool ExtFunctionCallIterator::skip(int64_t count, PlanState &planState) const
+{
   ItemSequence_t api_seq;
   bool more_items;
-
-  ExtFunctionCallIteratorState *state;
-  DEFAULT_STACK_INIT( ExtFunctionCallIteratorState, state, planState );
-
-  try {
-if ( theFunction->isContextual() ) {
-  ContextualExternalFunction const *const f =
-dynamic_cast( theFunction );
-  ZORBA_ASSERT( f );
-  StaticContextImpl sctx(
-theModuleSctx,
-planState.theQuery ?
-  planState.theQuery->getRegisteredDiagnosticHandlerNoSync() :
-  nullptr
-  );
-  DynamicContextImpl dctx(
-nullptr, planState.theGlobalDynCtx, theModuleSctx
-  );
-  api_seq = f->evaluate( state->m_extArgs, &sctx, &dctx );
-} else {
-  NonContextualExternalFunction const *const f =
-dynamic_cast( theFunction );
-  ZORBA_ASSERT( f );
-  api_seq = f->evaluate( state->m_extArgs );
-}
-if ( !!api_seq ) {
-  Iterator_t api_iter( api_seq->getIterator() );
-  api_iter->open();
-  more_items = api_iter->skip( count );
-  api_iter->close();
+  ExtFunctionCallIteratorState *state =
+  StateTraitsImpl::getState(planState, this->theStateOffset);
+
+  try
+  {
+ZORBA_ASSERT(!state->theIsEvaluated);
+evaluate(state, planState);
+
+if ( !state->theResult.isNull() )
+{
+  state->theResultIter = state->theResult->getIterator();
+  state->theResultIter->open();
+  more_items = state->theResultIter->skip( count );
+  if (!more_items)
+state->theResultIter->close();
 }
   }
-  catch ( ZorbaException &e ) {
+  catch ( ZorbaException &e )
+  {
 set_source( e, loc );
 throw;
   }
-  STACK_PUSH( more_items, state );
-  STACK_END( state );
+  catch (std::exception const& e)
+  {
+throw XQUERY_EXCEPTION(
+  zerr::ZXQP0001_DYNAMIC_RUNTIME_ERROR,
+  ERROR_PARAMS(e.what()),
+  ERROR_LOC(loc));
+  }
+  return more_items;
 }
 
 bool ExtFunctionCallIterator::nextImpl(
@@ -1000,102 +993,110 @@
 PlanState& planState) const
 {
   Item lOutsideItem;
-  const NonContextualExternalFunction* lPureFct = 0;
-  const ContextualExternalFunction* lNonePureFct = 0;
 
   ExtFunctionCallIteratorState* state;
   DEFAULT_STACK_INIT(ExtFunctionCallIteratorState, state, planState);
 
-  try
-  {
-if (!theFunction->isContextual())
-{
-  lPureFct = dynamic_cast(theFunction);
-  ZORBA_ASSERT(lPureFct);
-
-  state->theResult = lPureFct->evaluate(state->m_extArgs);
-  if(state->theResult.get() != NULL)
-state->theResultIter = state->theResult->getIterator();
-}
-else
-{
-  lNonePureFct = dynamic_cast(theFunction);
-  ZORBA_ASSERT(lNonePureFct);
-
-  // The planState.theQuery maybe null, e.g. in the case of constant-folding
-  // of global variable expressions
-  StaticContextImpl theSctxWrapper(theModuleSctx,
-   (planState.theQuery == NULL?
-NULL :
-planState.theQuery->getRegisteredDiagnosticHandlerNoSync()));
-
-  DynamicContextImpl theDctxWrapper(NULL,
-planState.theGlobalDynCtx,
-theModuleSctx);
-
-  state->theResult = lNonePureFct->evaluate(state->m_extArgs,
-&theSctxWrapper,
-&theDctxWrapper);
-  
-  if(state->theResult.get() != NULL)
-state->theResultIter = state->theResult->getIterator();
-} // if (!theFunction->isContextual())
-  }
-  catch (ZorbaException& e)
-  {
-set_source( e, loc );
-throw;
-  }
-  catch (std::exception const&