zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #11109
[Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba.
Requested reviews:
Markos Zaharioudakis (markos-za)
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch2/+merge/111108
Optimized hash sets used by fn:distinct-values and nodes-distinct
--
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch2/+merge/111108
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog 2012-06-19 17:58:10 +0000
+++ ChangeLog 2012-06-19 21:36:21 +0000
@@ -10,6 +10,7 @@
* Small optimization of comparison operations.
* Improved hoist rule: tighter hoisting of expressions (also fixes bug #967428,
which is only a performance bug)
+ * Optimized hash sets used by fn:distinct-values and nodes-distinct
Bug Fixes/Other Changes:
* Fixed bug #932314 (non-comparable values must be treated as distinct by
=== modified file 'src/runtime/indexing/index_ddl.cpp'
--- src/runtime/indexing/index_ddl.cpp 2012-06-15 21:31:03 +0000
+++ src/runtime/indexing/index_ddl.cpp 2012-06-19 21:36:21 +0000
@@ -38,7 +38,7 @@
#include "context/static_context.h"
#include "context/dynamic_context.h"
-#include "zorbautils/hashset_itemh.h"
+#include "zorbautils/hashset_node_itemh.h"
#include "diagnostics/xquery_exception.h"
#include "diagnostics/util_macros.h"
@@ -1372,7 +1372,7 @@
assert(state->theSearchItems.size() >= 1);
assert(state->theKeyType == NULL || state->theSearchItems.size() == 1);
- state->theNodeHashSet = new ItemHandleHashSet(1024, false);
+ state->theNodeHashSet = new NodeHandleHashSet(1024, false);
state->theSearchItemsIte = state->theSearchItems.begin();
state->theSearchItemsEnd = state->theSearchItems.end();
=== modified file 'src/runtime/indexing/index_ddl.h'
--- src/runtime/indexing/index_ddl.h 2012-06-15 21:31:03 +0000
+++ src/runtime/indexing/index_ddl.h 2012-06-19 21:36:21 +0000
@@ -29,7 +29,7 @@
{
class IndexDecl;
-class ItemHandleHashSet;
+class NodeHandleHashSet;
/*******************************************************************************
@@ -547,7 +547,7 @@
store::IndexProbeIterator_t theIterator;
- ItemHandleHashSet * theNodeHashSet;
+ NodeHandleHashSet * theNodeHashSet;
public:
ProbeIndexRangeGeneralIteratorState();
=== modified file 'src/runtime/sequences/SequencesImpl.cpp'
--- src/runtime/sequences/SequencesImpl.cpp 2012-06-15 21:31:03 +0000
+++ src/runtime/sequences/SequencesImpl.cpp 2012-06-19 21:36:21 +0000
@@ -36,7 +36,7 @@
#include "runtime/sequences/SequencesImpl.h"
#include "runtime/core/arithmetic_impl.h"
#include "runtime/util/iterator_impl.h"
-#include "runtime/util/handle_hashset_item_value.h"
+#include "runtime/booleans/BooleanImpl.h"
#include "runtime/visitors/planiter_visitor.h"
#include "system/globalenv.h"
@@ -51,6 +51,7 @@
#include "store/util/hashset_node_handle.h"
#include "context/static_context.h"
+#include "context/dynamic_context.h"
namespace zorba {
=== modified file 'src/runtime/sequences/pregenerated/sequences.cpp'
--- src/runtime/sequences/pregenerated/sequences.cpp 2012-06-15 21:31:03 +0000
+++ src/runtime/sequences/pregenerated/sequences.cpp 2012-06-19 21:36:21 +0000
@@ -29,7 +29,7 @@
#include "system/globalenv.h"
-#include "runtime/util/handle_hashset_item_value.h"
+#include "zorbautils/hashset_atomic_itemh.h"
namespace zorba {
=== modified file 'src/runtime/sequences/pregenerated/sequences.h'
--- src/runtime/sequences/pregenerated/sequences.h 2012-06-15 21:31:03 +0000
+++ src/runtime/sequences/pregenerated/sequences.h 2012-06-19 21:36:21 +0000
@@ -37,7 +37,7 @@
namespace store{
class NodeHashSet;
}
-class ItemValueCollHandleHashSet;
+class AtomicItemHandleHashSet;
/**
*
* op:concatenate
@@ -248,7 +248,7 @@
{
public:
bool theHasNaN; //indicates whether NaN was found in the sequence
- std::auto_ptr<ItemValueCollHandleHashSet> theAlreadySeenMap; //hashmap for doing the duplicate elimination
+ std::auto_ptr<AtomicItemHandleHashSet> theAlreadySeenMap; //hashmap for doing the duplicate elimination
FnDistinctValuesIteratorState();
=== modified file 'src/runtime/sequences/sequences_impl.cpp'
--- src/runtime/sequences/sequences_impl.cpp 2012-06-19 17:58:10 +0000
+++ src/runtime/sequences/sequences_impl.cpp 2012-06-19 21:36:21 +0000
@@ -40,7 +40,6 @@
#include <runtime/sequences/sequences.h>
#include <runtime/core/arithmetic_impl.h>
#include <runtime/util/iterator_impl.h>
-#include <runtime/util/handle_hashset_item_value.h>
#include <runtime/visitors/planiter_visitor.h>
#include <system/globalenv.h>
@@ -58,6 +57,8 @@
#include <context/static_context.h>
+#include "zorbautils/hashset_atomic_itemh.h"
+
namespace zorbatm = zorba::time;
using namespace std;
@@ -286,7 +287,7 @@
}
// theValueCompare managed by state->theAlreadySeenMap
- state->theAlreadySeenMap.reset(new ItemValueCollHandleHashSet(valueCompare));
+ state->theAlreadySeenMap.reset(new AtomicItemHandleHashSet(valueCompare));
while (consumeNext(result, theChildren[0].getp(), planState))
{
=== modified file 'src/runtime/spec/sequences/sequences.xml'
--- src/runtime/spec/sequences/sequences.xml 2012-06-15 21:31:03 +0000
+++ src/runtime/spec/sequences/sequences.xml 2012-06-19 21:36:21 +0000
@@ -16,11 +16,11 @@
<zorba:include form="Quoted">runtime/base/narybase.h</zorba:include>
<zorba:include form="Quoted">runtime/core/path_iterators.h</zorba:include>
<zorba:fwd-decl ns="store">NodeHashSet</zorba:fwd-decl>
- <zorba:fwd-decl ns="zorba">ItemValueCollHandleHashSet</zorba:fwd-decl>
+ <zorba:fwd-decl ns="zorba">AtomicItemHandleHashSet</zorba:fwd-decl>
</zorba:header>
<zorba:source>
- <zorba:include form="Quoted">runtime/util/handle_hashset_item_value.h</zorba:include>
+ <zorba:include form="Quoted">zorbautils/hashset_atomic_itemh.h</zorba:include>
</zorba:source>
<zorba:codegen>
@@ -235,7 +235,7 @@
brief="indicates whether NaN was found in the sequence"/>
<zorba:member name="theAlreadySeenMap"
- type="std::auto_ptr<ItemValueCollHandleHashSet>"
+ type="std::auto_ptr<AtomicItemHandleHashSet>"
brief="hashmap for doing the duplicate elimination"/>
</zorba:state>
=== removed file 'src/runtime/util/handle_hashset_item_value.h'
--- src/runtime/util/handle_hashset_item_value.h 2012-06-19 17:58:10 +0000
+++ src/runtime/util/handle_hashset_item_value.h 1970-01-01 00:00:00 +0000
@@ -1,140 +0,0 @@
-/*
- * Copyright 2006-2008 The FLWOR Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef ZORBA_RUNTIME_HANDLE_HAHSET_ITEM_VALUE_H
-#define ZORBA_RUNTIME_HANDLE_HAHSET_ITEM_VALUE_H
-
-#include "zorbautils/hashset.h"
-
-#include "runtime/booleans/BooleanImpl.h"
-
-#include "context/dynamic_context.h"
-
-namespace zorba
-{
-
-
-/*******************************************************************************
-
-********************************************************************************/
-class ValueCompareParam
-{
-public:
- ValueCompareParam(
- const QueryLoc& loc,
- dynamic_context* dctx,
- static_context* sctx)
- :
- theLocation(loc),
- theTypeManager(sctx->get_typemanager()),
- theTimezone(dctx->get_implicit_timezone()),
- theCollator(sctx->get_default_collator(loc))
- {
- }
-
- const QueryLoc & theLocation;
- TypeManager * theTypeManager;
- long theTimezone;
- XQPCollator * theCollator;
-};
-
-
-/*******************************************************************************
-
-********************************************************************************/
-class ItemValueCollHandleHashSet
-{
-public:
-
- class CompareFunction
- {
- private:
- ValueCompareParam * theCompareParam;
-
- public:
- CompareFunction(ValueCompareParam* comp) : theCompareParam(comp) {}
-
- bool equal(const store::Item_t& item1, const store::Item_t& item2) const
- {
- assert (item1 != NULL);
- assert (item2 != NULL);
- store::Item_t t1(item1);
- store::Item_t t2(item2);
-
- try
- {
- return CompareIterator::valueEqual(theCompareParam->theLocation,
- t1,
- t2,
- theCompareParam->theTypeManager,
- theCompareParam->theTimezone,
- theCompareParam->theCollator);
- }
- catch(ZorbaException& e)
- {
- if (e.diagnostic() == err::XPTY0004)
- {
- return false;
- }
-
- throw e;
- }
- }
-
- uint32_t hash(const store::Item_t& t) const
- {
- assert (t != NULL);
- return t->hash(theCompareParam->theTimezone, theCompareParam->theCollator);
- }
- };
-
-private:
- ValueCompareParam * theCompareParam;
- CompareFunction theCompareFunction;
- HashSet<store::Item_t, CompareFunction> theSet;
-
-public:
- ItemValueCollHandleHashSet(ValueCompareParam* compParam, ulong size = 1024)
- :
- theCompareParam(compParam),
- theCompareFunction(compParam),
- theSet(theCompareFunction, size, false)
- {
- }
-
- ~ItemValueCollHandleHashSet()
- {
- if (theCompareParam)
- delete theCompareParam;
- }
-
- void clear() { theSet.clear(); }
-
- bool exists(const store::Item_t& key) { return theSet.exists(key); }
-
- bool insert(store::Item_t& key) { return theSet.insert(key); }
-};
-
-
-} // namespace zorba
-
-#endif
-
-/*
- * Local variables:
- * mode: c++
- * End:
- */
-/* vim:set et sw=2 ts=2: */
=== modified file 'src/store/naive/node_iterators.h'
--- src/store/naive/node_iterators.h 2012-06-15 21:31:03 +0000
+++ src/store/naive/node_iterators.h 2012-06-19 21:36:21 +0000
@@ -21,7 +21,7 @@
#include "node_items.h"
#include "zorbautils/hashfun.h"
-#include "zorbautils/hashset_itemh.h"
+#include "zorbautils/hashset_node_itemh.h"
namespace zorba { namespace simplestore {
@@ -366,7 +366,7 @@
{
protected:
store::Iterator_t theInput;
- ItemHandleHashSet theNodeSet;
+ NodeHandleHashSet theNodeSet;
bool theCheckOnly;
public:
=== modified file 'src/zorbautils/CMakeLists.txt'
--- src/zorbautils/CMakeLists.txt 2012-06-15 21:31:03 +0000
+++ src/zorbautils/CMakeLists.txt 2012-06-19 21:36:21 +0000
@@ -15,7 +15,8 @@
SET(ZORBAUTILS_SRCS
fatal.cpp
properties_base.cpp
- hashset_itemh.cpp
+ hashset_node_itemh.cpp
+ hashset_atomic_itemh.cpp
mutex.cpp
condition.cpp
latch.cpp
=== added file 'src/zorbautils/hashset_atomic_itemh.cpp'
--- src/zorbautils/hashset_atomic_itemh.cpp 1970-01-01 00:00:00 +0000
+++ src/zorbautils/hashset_atomic_itemh.cpp 2012-06-19 21:36:21 +0000
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2006-2008 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "stdafx.h"
+
+#include "zorbautils/hashset_atomic_itemh.h"
+
+#include "runtime/booleans/BooleanImpl.h"
+
+
+namespace zorba
+{
+
+AtomicItemHandleHashSet::AtomicItemHandleHashSet(
+ ValueCompareParam* compParam,
+ csize size)
+ :
+ theCompareParam(compParam),
+ theCompareFunction(compParam),
+ theSet(theCompareFunction, size, false)
+{
+}
+
+
+AtomicItemHandleHashSet::~AtomicItemHandleHashSet()
+{
+ clear();
+
+ if (theCompareParam)
+ delete theCompareParam;
+}
+
+
+void AtomicItemHandleHashSet::clear()
+{
+ HashSet<store::Item*, AtomicItemHandleHashSet::CompareFunction>::iterator ite;
+ HashSet<store::Item*, AtomicItemHandleHashSet::CompareFunction>::iterator end;
+
+ ite = theSet.begin();
+ end = theSet.end();
+
+ for (; ite != end; ++ite)
+ {
+ store::Item* n = (*ite).first;
+ n->removeReference();
+ }
+
+ theSet.clear();
+}
+
+}
+
+/* vim:set et sw=2 ts=2: */
=== added file 'src/zorbautils/hashset_atomic_itemh.h'
--- src/zorbautils/hashset_atomic_itemh.h 1970-01-01 00:00:00 +0000
+++ src/zorbautils/hashset_atomic_itemh.h 2012-06-19 21:36:21 +0000
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2006-2008 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef ZORBA_ZORBAUTILS_HAHSET_ATOMIC_ITEMH
+#define ZORBA_ZORBAUTILS_HAHSET_ATOMIC_ITEMH
+
+#include "zorbautils/hashset.h"
+
+#include "runtime/booleans/BooleanImpl.h"
+
+#include "context/dynamic_context.h"
+#include "context/static_context.h"
+
+namespace zorba
+{
+
+
+/*******************************************************************************
+
+********************************************************************************/
+class ValueCompareParam
+{
+public:
+ ValueCompareParam(
+ const QueryLoc& loc,
+ dynamic_context* dctx,
+ static_context* sctx)
+ :
+ theLocation(loc),
+ theTypeManager(sctx->get_typemanager()),
+ theTimezone(dctx->get_implicit_timezone()),
+ theCollator(sctx->get_default_collator(loc))
+ {
+ }
+
+ const QueryLoc & theLocation;
+ TypeManager * theTypeManager;
+ long theTimezone;
+ XQPCollator * theCollator;
+};
+
+
+/*******************************************************************************
+ Used by the fn:distinct-values function.
+********************************************************************************/
+class AtomicItemHandleHashSet
+{
+public:
+
+ class CompareFunction
+ {
+ private:
+ ValueCompareParam * theCompareParam;
+
+ public:
+ CompareFunction(ValueCompareParam* comp) : theCompareParam(comp) {}
+
+ bool equal(store::Item* item1, store::Item* item2) const
+ {
+ assert(item1 != NULL);
+ assert(item2 != NULL);
+ store::Item_t t1(item1);
+ store::Item_t t2(item2);
+
+ try
+ {
+ return CompareIterator::valueEqual(theCompareParam->theLocation,
+ t1,
+ t2,
+ theCompareParam->theTypeManager,
+ theCompareParam->theTimezone,
+ theCompareParam->theCollator);
+ }
+ catch(ZorbaException& e)
+ {
+ if (e.diagnostic() == err::XPTY0004)
+ {
+ return false;
+ }
+
+ throw e;
+ }
+ }
+
+ uint32_t hash(store::Item* t) const
+ {
+ assert (t != NULL);
+ return t->hash(theCompareParam->theTimezone, theCompareParam->theCollator);
+ }
+ };
+
+private:
+ ValueCompareParam * theCompareParam;
+ CompareFunction theCompareFunction;
+ HashSet<store::Item*, CompareFunction> theSet;
+
+public:
+ AtomicItemHandleHashSet(ValueCompareParam* compParam, csize size = 1024);
+
+ ~AtomicItemHandleHashSet();
+
+ void clear();
+
+ bool exists(const store::Item_t& key)
+ {
+ return theSet.exists(key.getp());
+ }
+
+ bool insert(store::Item_t& key)
+ {
+ assert(key->isAtomic());
+ store::Item* tmp = key.getp();
+
+ bool inserted = theSet.insert(tmp);
+
+ if (inserted)
+ {
+ key->addReference();
+ }
+
+ return inserted;
+ }
+};
+
+
+} // namespace zorba
+
+#endif
+
+/*
+ * Local variables:
+ * mode: c++
+ * End:
+ */
+/* vim:set et sw=2 ts=2: */
=== removed file 'src/zorbautils/hashset_itemh.cpp'
--- src/zorbautils/hashset_itemh.cpp 2012-06-15 21:31:03 +0000
+++ src/zorbautils/hashset_itemh.cpp 1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright 2006-2008 The FLWOR Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "stdafx.h"
-
-#include "zorbautils/hashset_itemh.h"
-
-namespace zorba
-{
-
-void ItemHandleHashSet::clear()
-{
- HashSet<store::Item*, ItemHandleHashSet::CompareFunction>::iterator ite;
- HashSet<store::Item*, ItemHandleHashSet::CompareFunction>::iterator end;
-
- ite = theSet.begin();
- end = theSet.end();
-
- for (; ite != end; ++ite)
- {
- store::Item* n = (*ite).first;
- n->removeReference();
- }
-
- theSet.clear();
-}
-
-}
-
-/* vim:set et sw=2 ts=2: */
=== removed file 'src/zorbautils/hashset_itemh.h'
--- src/zorbautils/hashset_itemh.h 2012-06-15 21:31:03 +0000
+++ src/zorbautils/hashset_itemh.h 1970-01-01 00:00:00 +0000
@@ -1,95 +0,0 @@
-/*
- * Copyright 2006-2008 The FLWOR Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#pragma once
-#ifndef ZORBA_ZORBAUTILS_ITEM_HANDLE_HASHSET
-#define ZORBA_ZORBAUTILS_ITEM_HANDLE_HASHSET
-
-#include "zorbautils/hashfun.h"
-#include "zorbautils/hashset.h"
-
-#include "zorbatypes/collation_manager.h"
-
-#include "store/api/item.h"
-
-namespace zorba
-{
-
-/*******************************************************************************
- A hash-based set container of item handles, where equality is based on
- object identity (i.e. pointer equality) rather than object value.
-
- It is used by the NodeDistinctIterator and for the population of a general
- index.
-
- NOTE: Although the set uses raw item pointers instead of rchandles, reference
- counting is still done, but done manually (see insert and clear methods)
-********************************************************************************/
-class ItemHandleHashSet
-{
-public:
-
- class CompareFunction
- {
- public:
- static bool equal(const store::Item* t1, const store::Item* t2)
- {
- return t1 == t2;
- }
-
- static uint32_t hash(const store::Item* t)
- {
- return hashfun::h32((void*)(&t), sizeof(void*), FNV_32_INIT);
- }
- };
-
-private:
- HashSet<store::Item*, CompareFunction> theSet;
-
-public:
- ItemHandleHashSet(ulong size, bool sync) : theSet(size, sync) { }
-
- ~ItemHandleHashSet() { clear(); }
-
- void clear();
-
- bool exists(store::Item* const key)
- {
- return theSet.exists(key);
- }
-
- bool insert(store::Item* key)
- {
- bool inserted = theSet.insert(key);
-
- if (inserted)
- {
- key->addReference();
- }
- return inserted;
- }
-};
-
-
-} // namespace zorba
-
-#endif
-
-/*
- * Local variables:
- * mode: c++
- * End:
- */
-/* vim:set et sw=2 ts=2: */
=== added file 'src/zorbautils/hashset_node_itemh.cpp'
--- src/zorbautils/hashset_node_itemh.cpp 1970-01-01 00:00:00 +0000
+++ src/zorbautils/hashset_node_itemh.cpp 2012-06-19 21:36:21 +0000
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2006-2008 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "stdafx.h"
+
+#include "zorbautils/hashset_node_itemh.h"
+
+namespace zorba
+{
+
+void NodeHandleHashSet::clear()
+{
+ HashSet<store::Item*, NodeHandleHashSet::CompareFunction>::iterator ite;
+ HashSet<store::Item*, NodeHandleHashSet::CompareFunction>::iterator end;
+
+ ite = theSet.begin();
+ end = theSet.end();
+
+ for (; ite != end; ++ite)
+ {
+ store::Item* n = (*ite).first;
+ n->removeReference();
+ }
+
+ theSet.clear();
+}
+
+}
+
+/* vim:set et sw=2 ts=2: */
=== added file 'src/zorbautils/hashset_node_itemh.h'
--- src/zorbautils/hashset_node_itemh.h 1970-01-01 00:00:00 +0000
+++ src/zorbautils/hashset_node_itemh.h 2012-06-19 21:36:21 +0000
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2006-2008 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+#ifndef ZORBA_ZORBAUTILS_HASHSET_NODE_ITEMH
+#define ZORBA_ZORBAUTILS_HASHSET_NODE_ITEMH
+
+#include "zorbautils/hashfun.h"
+#include "zorbautils/hashset.h"
+
+#include "zorbatypes/collation_manager.h"
+
+#include "store/api/item.h"
+
+namespace zorba
+{
+
+/*******************************************************************************
+ A hash-based set container of item handles, where equality is based on
+ object identity (i.e. pointer equality) rather than object value.
+
+ It is used by the NodeDistinctIterator and for the population of a general
+ index.
+
+ NOTE: Although the set uses raw item pointers instead of rchandles, reference
+ counting is still done, but done manually (see insert and clear methods)
+********************************************************************************/
+class NodeHandleHashSet
+{
+public:
+
+ class CompareFunction
+ {
+ public:
+ static bool equal(const store::Item* t1, const store::Item* t2)
+ {
+ return t1 == t2;
+ }
+
+ static uint32_t hash(const store::Item* t)
+ {
+ return reinterpret_cast<uint32_t>(t);
+ }
+ };
+
+private:
+ HashSet<store::Item*, CompareFunction> theSet;
+
+public:
+ NodeHandleHashSet(csize size, bool sync) : theSet(size, sync) { }
+
+ ~NodeHandleHashSet() { clear(); }
+
+ void clear();
+
+ bool exists(store::Item* const key)
+ {
+ return theSet.exists(key);
+ }
+
+ bool insert(store::Item* key)
+ {
+ assert(key->isNode());
+
+ bool inserted = theSet.insert(key);
+
+ if (inserted)
+ {
+ key->addReference();
+ }
+ return inserted;
+ }
+};
+
+
+} // namespace zorba
+
+#endif
+
+/*
+ * Local variables:
+ * mode: c++
+ * End:
+ */
+/* vim:set et sw=2 ts=2: */
=== modified file 'test/rbkt/Queries/CMakeLists.txt'
--- test/rbkt/Queries/CMakeLists.txt 2012-06-15 21:31:03 +0000
+++ test/rbkt/Queries/CMakeLists.txt 2012-06-19 21:36:21 +0000
@@ -253,8 +253,8 @@
EXPECTED_FAILURE(test/rbkt/w3c_testsuite/XQuery/Basics/EQNames/eqname-008 997045)
EXPECTED_FAILURE(test/rbkt/w3c_testsuite/XQuery/Basics/EQNames/eqname-009 997045)
EXPECTED_FAILURE(test/rbkt/w3c_testsuite/XQuery/Basics/EQNames/eqname-010 997045)
- EXPECTED_FAILURE(test/rbkt/w3c_testsuite/XQuery/Basics/EQNames/eqname-011 997045)
- EXPECTED_FAILURE(test/rbkt/w3c_testsuite/XQuery/Basics/EQNames/eqname-012 997045)
+# EXPECTED_FAILURE(test/rbkt/w3c_testsuite/XQuery/Basics/EQNames/eqname-011 997045)
+# EXPECTED_FAILURE(test/rbkt/w3c_testsuite/XQuery/Basics/EQNames/eqname-012 997045)
IF (NOT ZORBA_WITH_BIG_INTEGER)
# These test will never pass without big integers beause the integers used
Follow ups
-
[Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: noreply, 2012-06-28
-
[Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: Zorba Build Bot, 2012-06-28
-
[Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: Zorba Build Bot, 2012-06-28
-
[Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: Markos Zaharioudakis, 2012-06-28
-
[Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: Zorba Build Bot, 2012-06-28
-
Re: [Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: Zorba Build Bot, 2012-06-28
-
[Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: Zorba Build Bot, 2012-06-28
-
[Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: Markos Zaharioudakis, 2012-06-28
-
[Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: Zorba Build Bot, 2012-06-28
-
Re: [Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: Zorba Build Bot, 2012-06-28
-
[Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: Markos Zaharioudakis, 2012-06-28
-
[Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: Zorba Build Bot, 2012-06-20
-
Re: [Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: Zorba Build Bot, 2012-06-20
-
[Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: Zorba Build Bot, 2012-06-20
-
[Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: Markos Zaharioudakis, 2012-06-20
-
[Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: Zorba Build Bot, 2012-06-19
-
Re: [Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: Zorba Build Bot, 2012-06-19
-
[Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: Zorba Build Bot, 2012-06-19
-
[Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: Markos Zaharioudakis, 2012-06-19
-
Re: [Merge] lp:~zorba-coders/zorba/markos-scratch2 into lp:zorba
From: Markos Zaharioudakis, 2012-06-19