[Zorba-coders] [Merge] lp:~zorba-coders/zorba/skip-items into lp:zorba

2013-07-26 Thread noreply
The proposal to merge lp:~zorba-coders/zorba/skip-items into lp:zorba has been 
updated.

Status: Approved => Merged

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-26 Thread Zorba Build Bot
Validation queue succeeded - proposal merged!
-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-26 Thread Zorba Build Bot
Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue
-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-26 Thread Matthias Brantner
Review: Approve


-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-26 Thread Zorba Build Bot
Validation queue result for 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723

Stage "AddTestSuitesUbuntu" failed.

Check console output at 
http://jenkins.lambda.nu/job/AddTestSuitesUbuntu/125/console to view the 
results.
-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-26 Thread Zorba Build Bot
Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue
-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-26 Thread Nicolae Brinza
I've fixed the crash and added the query as zorba/eval/eval16.xq.

--
-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-25 Thread Matthias Brantner
Review: Needs Fixing

The following query crashes:

xquery version "3.0";

import module namespace ddl = 
"http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";;
import module namespace dml = 
"http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";;
import module namespace e = "http://www.zorba-xquery.com/modules/reflection";;

ddl:create(xs:QName("ddl:test2"),(,));

subsequence(e:eval("dml:collection(xs:QName('ddl:test2'))"), 2, 1)
-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-25 Thread Zorba Build Bot
Validation queue result for 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723

Stage "CommitZorba" failed.

Check console output at http://jenkins.lambda.nu/job/CommitZorba/56/console to 
view the results.
-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-25 Thread Zorba Build Bot
Voting criteria failed for the following merge proposals:

https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723 :
Votes: {'Needs Information': 1, 'Approve': 1}
-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-25 Thread Zorba Build Bot
Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue
-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-25 Thread Zorba Build Bot
Validation queue result for 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723

Stage "TestZorbaUbuntu" failed.
1 tests failed (8415 total tests run).

Check test results at 
http://jenkins.lambda.nu/job/TestZorbaUbuntu/123/testReport/ to view the 
results.
-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-25 Thread Zorba Build Bot
Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue
-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-25 Thread Nicolae Brinza
> - In ZorbaCollectionIterator::initCollection lines 307 and 326, you eventually
> add skipCount twice. Something smells spooky here.

Yes, it seems it was added twice. I've fixed it. 

I've also added the skip() function to the EvalIterator.

--
-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-23 Thread Matthias Brantner
Review: Needs Information

Looks good to me. Only two issues.

- The thing with the probe iterators is that there are additional functions 
called probe-*-skip that allow
you to skip explicitly. However, subsequence is not rewritten into these 
functions. We will need to override the skip function in all the probe 
iterators (similar to count) such that subsequence(probe-*) will be executed 
efficiently. We can do this is a second step though. I'll create a follow up 
story for this.

- In ZorbaCollectionIterator::initCollection lines 307 and 326, you eventually 
add skipCount twice. Something smells spooky here.

-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-23 Thread Nicolae Brinza
I've looked into the index probe iterators but they already optimize any 
skipping. They take a Skip parameter and then they push it into an underlying 
iterator e.g. ProbeValueTreeIndexIterator which handles the skip internally. So 
there is nothing to be done there.

I've pushed the pending fixes and the branch is ready for merging. 


-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-19 Thread Nicolae Brinza
> - Shouldn't skip take an unsigned integer?

The parameters to fn:subsequence and co are all signed. E.g. you can pass a 
negative skip. 

> - Why is the while loop in collections_impl.cpp:397 necessary if
> initCollection is called before? I think there might be a bug in
> initCollection. Specifically, the else block in line 298 is never called
> because the CollectionIterator is not rewritten anymore (i.e.
> theChildren.size() will always return one)

You're very right. It was not really a bug, but the skip optimization didn't 
really happen because it was the while() that was doing the skipping instead of 
the getIterator(skip). I've fixed that. But the else block at line 298 cannot 
be deleted as the 3-parameter function was not only used by the rewriter, e.g. 
the collections/paging_1 to _5 use it.

> - state->theIteratorOpened == false => !state->theIteratorOpened

Fixed. 

> - could we implement and test skip for the EvalIterator as well?

All iterators have the default implementation of skip in plan_iterator.cpp. How 
can we improve that implementation for EvalIterator?

> - What about the index probe iterators (e.g. ProbeIndexPointValueIterator),
> they also skip

I was not aware they do. I'll write an optimization for them as well. 

--
-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-18 Thread Matthias Brantner
Review: Needs Fixing

- Shouldn't skip take an unsigned integer?
- Why is the while loop in collections_impl.cpp:397 necessary if initCollection 
is called before? I think there might be a bug in initCollection. Specifically, 
the else block in line 298 is never called because the CollectionIterator is 
not rewritten anymore (i.e. theChildren.size() will always return one)
- state->theIteratorOpened == false => !state->theIteratorOpened
- could we implement and test skip for the EvalIterator as well?
- What about the index probe iterators (e.g. ProbeIndexPointValueIterator), 
they also skip
-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-17 Thread Nicolae Brinza
Review: Approve


-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-15 Thread Zorba Build Bot
Validation queue result for 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723

Stage "TestZorbaUbuntu" failed.
3 tests failed (8344 total tests run).

Check test results at 
http://jenkins.lambda.nu/job/TestZorbaUbuntu/81/testReport/ to view the results.
-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-15 Thread Zorba Build Bot
Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue
-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-15 Thread Nicolae Brinza
The proposal to merge lp:~zorba-coders/zorba/skip-items into lp:zorba has been 
updated.

Status: Needs review => Approved

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
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/skip-items into lp:zorba

2013-07-15 Thread Nicolae Brinza
Nicolae Brinza has proposed merging lp:~zorba-coders/zorba/skip-items into 
lp:zorba.

Commit message:
Implemented the Skip-items facility

Requested reviews:
  Nicolae Brinza (nbrinza)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723

Implemented the Skip-items facility
-- 
https://code.launchpad.net/~zorba-coders/zorba/skip-items/+merge/174723
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/functions/func_sequences_impl.cpp'
--- src/functions/func_sequences_impl.cpp	2013-05-14 05:21:11 +
+++ src/functions/func_sequences_impl.cpp	2013-07-15 10:38:33 +
@@ -43,127 +43,6 @@
 
 
 /***
-
-/
-bool rewriteSubsequenceCollection(
-static_context* aSctx,
-const QueryLoc& aLoc,
-std::vector& aArgs,
-bool aIsIntSubsequence)
-{
-  ZorbaCollectionIterator* collIter = 
-  dynamic_cast(aArgs[0].getp());
-  assert(collIter);
-
-  std::vector& lCollectionArgs = collIter->getChildren();
-
-  SingletonIterator* lPosIter = dynamic_cast(aArgs[1].getp());
-  if (lPosIter == NULL)
-  {
-return false;
-  }
-
-  xs_long pos;
-  const store::Item_t& lPosItem = lPosIter->getValue();
-
-  try
-  {
-if (aIsIntSubsequence)
-{
-  pos = lPosItem->getLongValue();
-}
-else
-{
-  xs_double dpos = lPosItem->getDoubleValue().round();
-  xs_integer ipos(dpos.getNumber());
-  pos = to_xs_long(ipos);
-}
-  }
-  catch (std::exception const&)
-  {
-return false;
-  }
-
-  if (pos <= 1)
-  {
-// if the start position is less than 1 we can't push this down into
-// the collection skip parameter because the result won't be equivalent.
-return false;
-  }
-
-  // prepare helper
-  store::Item_t lItemOne;
-  GENV_ITEMFACTORY->createInteger(lItemOne, Integer(1));
-
-  int lNumCollArgs = lCollectionArgs.size();
-  if (lNumCollArgs == 1)
-  {
-// argument is of type collection(qname)
-// simply move the (pos-1) of subsequence into the skip of 
-// collection function
-// subsequence(collection(qname), 10, 20) 
-//   -> subsequence(collection(qname, 10-1), 1, 20)
-PlanIter_t& lNewCollSkipIter = aArgs[1];
-PlanIter_t lOneIter = new SingletonIterator(aSctx, aLoc, lItemOne);
-
-lCollectionArgs.push_back(
-  new NumArithIterator(aSctx,
- collIter->getLocation(),
- lNewCollSkipIter,
- lOneIter)
-  );
-  }
-  else if (lNumCollArgs <= 3 && lNumCollArgs != 0)
-  {
-// argument is of type collection(qname,skip) or 
-// collection(qname,start_uri,skip)
-int lSkipPosition = 1;
-if (lNumCollArgs == 3) 
-{
-  // collection function with start reference -> skip is the 3rd param
-  lSkipPosition = 2;
-}
-  
-// add position-1 of subsequence to collection skip
-// subsequence(collection(qname, 10), 10, 20) 
-//   -> subsequence(collection(qname, 10+10-1), 10, 20)
-PlanIter_t& lOldCollSkipIter = lCollectionArgs[lSkipPosition];
-PlanIter_t lOneIter = new SingletonIterator (aSctx, aLoc, lItemOne);
-PlanIter_t& lSubseqPosIter = aArgs[1];
-
-PlanIter_t lCollSkipAdditionIter = 
-new NumArithIterator(aSctx,
-   collIter->getLocation(),
-   lSubseqPosIter,
-   lOneIter);
-lCollectionArgs[lSkipPosition] = 
-new NumArithIterator(aSctx,
-  collIter->getLocation(), 
-  lOldCollSkipIter,
-  lCollSkipAdditionIter);
-  }
-  else
-  {
-// no collection function with 0 or >3 params
-assert(false);
-  }
-
-  aArgs[0] = new ZorbaCollectionIterator(aSctx,
- collIter->getLocation(),
- lCollectionArgs,
- collIter->isDynamic());
-
-  // after pushing the position param down we need to rewrite the actual 
-  // position to 1:
-  // subsequence(collection(qname, 10+10-1), 10, 20) 
-  //   -> subsequence(collection(qname, 10+10-1), 1, 20)
-  aArgs[1] = new SingletonIterator(aSctx, aLoc, lItemOne);
-
-  return true;
-}
-
-
-/***
 /
 xqtref_t fn_unordered::getReturnType(const fo_expr* caller) const
 {
@@ -573,8 +452,7 @@
 const QueryLoc& aLoc,
 std::vector& aArgs,
 expr& aAnn) const
-{
-  const std::type_info& lFirstArgType = typeid(*a