A Friday 12 November 2010 10:56:30 Francesc Alted escrigué:
> [Some of you keep sending messages from unsubscribed addresses. I
> very rarely check for such a messages so, *PLEASE* do not do that if
> you want to receive some answers to your questions. Thanks!]
>
> ---------------------------------------------------------------------
> ----- De: "David Briant" <david.bri...@tradingroomassociates.com>
> A: pytables-users@lists.sourceforge.net
> Data: Ahir 09:14:07
>
> Hi
>
> In my File I currently have 160 tables with a CSIndex on one column.
> At least one of the tables has no data. I get the following message
> when I attempt to display the File object in a command line:
>
> Traceback (most recent call last):
> File "<input>", line 1, in <module>
> File "c:\python26qv\lib\site-packages\tables\file.py", line 2217,
> in __repr__
> astring += repr(node) + '\n'
> File "c:\python26qv\lib\site-packages\tables\node.py", line 61, in
> newmethod
> return oldmethod(self)
> File "c:\python26qv\lib\site-packages\tables\table.py", line 2568,
> in __repr__
> _ColIndexes(self.colindexes) )
> File "c:\python26qv\lib\site-packages\tables\table.py", line 122,
> in __repr__
> rep = [ ' \"%s\": %s' % (k, self[k]) for k in self.keys()]
> File "c:\python26qv\lib\site-packages\tables\node.py", line 61, in
> newmethod
> return oldmethod(self)
> File "c:\python26qv\lib\site-packages\tables\index.py", line 2055,
> in __str__
> (self.optlevel, self.kind, filters, self.is_CSI)
> File "c:\python26qv\lib\site-packages\tables\index.py", line 261,
> in _is_CSI
> self.compute_overlaps(self, None, False)
> File "c:\python26qv\lib\site-packages\tables\index.py", line 1600,
> in compute_overlaps
> erange = float(ranges[-1,1]) - float(ranges[0,0])
> IndexError: index (-1) out of range (0<=index<0) in dimension 0
> tsdb.close()
> openTSDB()
> tsdb
> Traceback (most recent call last):
> File "<input>", line 1, in <module>
> File "c:\python26qv\lib\site-packages\tables\file.py", line 2217,
> in __repr__
> astring += repr(node) + '\n'
> File "c:\python26qv\lib\site-packages\tables\node.py", line 61, in
> newmethod
> return oldmethod(self)
> File "c:\python26qv\lib\site-packages\tables\table.py", line 2568,
> in __repr__
> _ColIndexes(self.colindexes) )
> File "c:\python26qv\lib\site-packages\tables\table.py", line 122,
> in __repr__
> rep = [ ' \"%s\": %s' % (k, self[k]) for k in self.keys()]
> File "c:\python26qv\lib\site-packages\tables\node.py", line 61, in
> newmethod
> return oldmethod(self)
> File "c:\python26qv\lib\site-packages\tables\index.py", line 2055,
> in __str__
> (self.optlevel, self.kind, filters, self.is_CSI)
> File "c:\python26qv\lib\site-packages\tables\index.py", line 261,
> in _is_CSI
> self.compute_overlaps(self, None, False)
> File "c:\python26qv\lib\site-packages\tables\index.py", line 1600,
> in compute_overlaps
> erange = float(ranges[-1,1]) - float(ranges[0,0])
> IndexError: index (-1) out of range (0<=index<0) in dimension 0
That's a bug:
http://pytables.org/trac/ticket/312
The fix will be included in next version of Pro. Meanwhile, you may
want to apply the patch by yourself (attached).
--
Francesc Alted
Index: RELEASE_NOTES.txt
===================================================================
--- RELEASE_NOTES.txt (revision 4636)
+++ RELEASE_NOTES.txt (revision 4637)
@@ -9,7 +9,8 @@
Changes from 2.2.1 to 2.2.2
===========================
-- (None yet.)
+- Indexes with no elements are now evaluated as non-CSI ones. Closes
+ #312.
Changes from 2.2.1rc1 to 2.2.1
Index: tables/index.py
===================================================================
--- tables/index.py (revision 4636)
+++ tables/index.py (revision 4637)
@@ -250,6 +250,9 @@
"Whether we should try to build a completely sorted index or not.")
def _is_CSI(self):
+ if self.nelements == 0:
+ # An index with 0 indexed elements is not a CSI one (by definition)
+ return False
if self.indsize < 8:
# An index that is not full cannot be completely sorted
return False
Index: tables/tests/test_indexes.py
===================================================================
--- tables/tests/test_indexes.py (revision 4636)
+++ tables/tests/test_indexes.py (revision 4637)
@@ -2197,7 +2197,17 @@
table2.copy, "/", 'table3',
sortby="rcol", checkCSI=True)
+ def test07_isCSI_noelements(self):
+ """Testing the representation of an index with no elements."""
+ t2 = self.h5file.createTable('/', 't2', self.MyDescription)
+ irows = t2.cols.rcol.createCSIndex()
+ if verbose:
+ print "repr(t2)-->\n", repr(t2)
+ self.assert_(irows == 0)
+ self.assert_(t2.colindexes['rcol'].is_CSI == False)
+
+
class readSortedIndexTestCase(TempFileMixin, PyTablesTestCase):
"""Test case for testing sorted reading in a "full" sorted column."""
------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users