vastdb 1.3.6__py3-none-any.whl → 1.3.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. vastdb/_internal.py +170 -78
  2. vastdb/bench/test_perf.py +2 -2
  3. vastdb/config.py +3 -0
  4. vastdb/errors.py +6 -0
  5. vastdb/features.py +9 -0
  6. vastdb/schema.py +5 -3
  7. vastdb/table.py +76 -15
  8. vastdb/tests/test_imports.py +70 -1
  9. vastdb/tests/test_tables.py +217 -0
  10. vastdb/tests/util.py +2 -2
  11. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Aggregate.py +4 -4
  12. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Call.py +2 -2
  13. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/CaseFragment.py +2 -2
  14. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Cast.py +2 -2
  15. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/ConditionalCase.py +2 -2
  16. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Filter.py +3 -3
  17. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Grouping.py +1 -1
  18. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Join.py +4 -4
  19. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/KeyValue.py +2 -2
  20. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Limit.py +2 -2
  21. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/ListLiteral.py +1 -1
  22. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Literal.py +1 -1
  23. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/LiteralColumn.py +1 -1
  24. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/LiteralRelation.py +2 -2
  25. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/MapKey.py +1 -1
  26. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/MapLiteral.py +1 -1
  27. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/OrderBy.py +3 -3
  28. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Plan.py +1 -1
  29. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Project.py +3 -3
  30. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/SetOperation.py +2 -2
  31. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/SimpleCase.py +3 -3
  32. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/SortKey.py +1 -1
  33. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Source.py +4 -4
  34. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/StructLiteral.py +1 -1
  35. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/WindowCall.py +3 -3
  36. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/DictionaryBatch.py +1 -1
  37. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/DictionaryEncoding.py +1 -1
  38. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Field.py +3 -3
  39. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Footer.py +4 -4
  40. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Message.py +1 -1
  41. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/RecordBatch.py +3 -3
  42. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Schema.py +2 -2
  43. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/SparseMatrixIndexCSX.py +4 -4
  44. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/SparseTensor.py +2 -2
  45. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/SparseTensorIndexCOO.py +2 -2
  46. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/SparseTensorIndexCSF.py +4 -4
  47. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Tensor.py +2 -2
  48. vastdb/vast_flatbuf/tabular/ColumnDetails.py +56 -0
  49. {vast_flatbuf → vastdb/vast_flatbuf}/tabular/CreateProjectionRequest.py +1 -1
  50. vastdb/vast_flatbuf/tabular/FilterString.py +45 -0
  51. vastdb/vast_flatbuf/tabular/GetRowColumnSecurityResponse.py +166 -0
  52. vastdb/vast_flatbuf/tabular/GetTableStatsResponse.py +178 -0
  53. {vast_flatbuf → vastdb/vast_flatbuf}/tabular/ImportDataRequest.py +34 -1
  54. vastdb/vast_flatbuf/tabular/KeyName.py +45 -0
  55. {vast_flatbuf → vastdb/vast_flatbuf}/tabular/ListProjectionsResponse.py +1 -1
  56. {vast_flatbuf → vastdb/vast_flatbuf}/tabular/ListSchemasResponse.py +1 -1
  57. {vast_flatbuf → vastdb/vast_flatbuf}/tabular/ListTablesResponse.py +1 -1
  58. {vast_flatbuf → vastdb/vast_flatbuf}/tabular/ListViewsResponse.py +1 -1
  59. vastdb/vast_flatbuf/tabular/NameString.py +45 -0
  60. vastdb/vast_flatbuf/tabular/ObjectDetails.py +168 -0
  61. {vastdb-1.3.6.dist-info → vastdb-1.3.8.dist-info}/METADATA +1 -1
  62. vastdb-1.3.8.dist-info/RECORD +216 -0
  63. vastdb-1.3.8.dist-info/top_level.txt +1 -0
  64. vast_flatbuf/tabular/GetTableStatsResponse.py +0 -111
  65. vast_flatbuf/tabular/ObjectDetails.py +0 -112
  66. vastdb-1.3.6.dist-info/RECORD +0 -211
  67. vastdb-1.3.6.dist-info/top_level.txt +0 -2
  68. {vast_flatbuf → vastdb/vast_flatbuf}/__init__.py +0 -0
  69. {vast_flatbuf → vastdb/vast_flatbuf}/org/__init__.py +0 -0
  70. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/__init__.py +0 -0
  71. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/__init__.py +0 -0
  72. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/__init__.py +0 -0
  73. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/ArraySlice.py +0 -0
  74. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/ArraySubscript.py +0 -0
  75. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/BinaryLiteral.py +0 -0
  76. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/BooleanLiteral.py +0 -0
  77. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Bound.py +0 -0
  78. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/ConcreteBoundImpl.py +0 -0
  79. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/CurrentRow.py +0 -0
  80. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/DateLiteral.py +0 -0
  81. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/DecimalLiteral.py +0 -0
  82. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Deref.py +0 -0
  83. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/DurationLiteral.py +0 -0
  84. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Expression.py +0 -0
  85. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/ExpressionImpl.py +0 -0
  86. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/FieldIndex.py +0 -0
  87. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/FieldRef.py +0 -0
  88. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/FixedSizeBinaryLiteral.py +0 -0
  89. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Float16Literal.py +0 -0
  90. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Float32Literal.py +0 -0
  91. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Float64Literal.py +0 -0
  92. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Following.py +0 -0
  93. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Frame.py +0 -0
  94. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Int16Literal.py +0 -0
  95. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Int32Literal.py +0 -0
  96. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Int64Literal.py +0 -0
  97. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Int8Literal.py +0 -0
  98. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/IntervalLiteral.py +0 -0
  99. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/IntervalLiteralDaysMilliseconds.py +0 -0
  100. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/IntervalLiteralImpl.py +0 -0
  101. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/IntervalLiteralMonths.py +0 -0
  102. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/JoinKind.py +0 -0
  103. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/LiteralImpl.py +0 -0
  104. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Ordering.py +0 -0
  105. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Preceding.py +0 -0
  106. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/RelId.py +0 -0
  107. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Relation.py +0 -0
  108. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/RelationImpl.py +0 -0
  109. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/SetOpKind.py +0 -0
  110. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/StringLiteral.py +0 -0
  111. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/StructField.py +0 -0
  112. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/TimeLiteral.py +0 -0
  113. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/TimestampLiteral.py +0 -0
  114. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/UInt16Literal.py +0 -0
  115. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/UInt32Literal.py +0 -0
  116. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/UInt64Literal.py +0 -0
  117. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/UInt8Literal.py +0 -0
  118. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/Unbounded.py +0 -0
  119. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/computeir/flatbuf/__init__.py +0 -0
  120. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Binary.py +0 -0
  121. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Block.py +0 -0
  122. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/BodyCompression.py +0 -0
  123. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/BodyCompressionMethod.py +0 -0
  124. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Bool.py +0 -0
  125. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Buffer.py +0 -0
  126. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/CompressionType.py +0 -0
  127. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Date.py +0 -0
  128. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/DateUnit.py +0 -0
  129. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Decimal.py +0 -0
  130. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/DictionaryKind.py +0 -0
  131. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Duration.py +0 -0
  132. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Endianness.py +0 -0
  133. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Feature.py +0 -0
  134. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/FieldNode.py +0 -0
  135. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/FixedSizeBinary.py +0 -0
  136. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/FixedSizeList.py +0 -0
  137. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/FloatingPoint.py +0 -0
  138. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Int.py +0 -0
  139. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Interval.py +0 -0
  140. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/IntervalUnit.py +0 -0
  141. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/KeyValue.py +0 -0
  142. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/LargeBinary.py +0 -0
  143. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/LargeList.py +0 -0
  144. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/LargeUtf8.py +0 -0
  145. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/List.py +0 -0
  146. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Map.py +0 -0
  147. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/MessageHeader.py +0 -0
  148. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/MetadataVersion.py +0 -0
  149. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Null.py +0 -0
  150. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Precision.py +0 -0
  151. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/SparseMatrixCompressedAxis.py +0 -0
  152. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/SparseTensorIndex.py +0 -0
  153. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Struct_.py +0 -0
  154. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/TensorDim.py +0 -0
  155. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Time.py +0 -0
  156. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/TimeUnit.py +0 -0
  157. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Timestamp.py +0 -0
  158. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Type.py +0 -0
  159. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Union.py +0 -0
  160. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/UnionMode.py +0 -0
  161. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/Utf8.py +0 -0
  162. {vast_flatbuf → vastdb/vast_flatbuf}/org/apache/arrow/flatbuf/__init__.py +0 -0
  163. {vast_flatbuf → vastdb/vast_flatbuf}/tabular/AlterColumnRequest.py +0 -0
  164. {vast_flatbuf → vastdb/vast_flatbuf}/tabular/AlterProjectionTableRequest.py +0 -0
  165. {vast_flatbuf → vastdb/vast_flatbuf}/tabular/AlterSchemaRequest.py +0 -0
  166. {vast_flatbuf → vastdb/vast_flatbuf}/tabular/AlterTableRequest.py +0 -0
  167. {vast_flatbuf → vastdb/vast_flatbuf}/tabular/Column.py +0 -0
  168. {vast_flatbuf → vastdb/vast_flatbuf}/tabular/ColumnType.py +0 -0
  169. {vast_flatbuf → vastdb/vast_flatbuf}/tabular/CreateSchemaRequest.py +0 -0
  170. {vast_flatbuf → vastdb/vast_flatbuf}/tabular/CreateViewRequest.py +0 -0
  171. {vast_flatbuf → vastdb/vast_flatbuf}/tabular/GetProjectionTableStatsResponse.py +0 -0
  172. {vast_flatbuf → vastdb/vast_flatbuf}/tabular/S3File.py +0 -0
  173. {vast_flatbuf → vastdb/vast_flatbuf}/tabular/VipRange.py +0 -0
  174. {vast_flatbuf → vastdb/vast_flatbuf}/tabular/__init__.py +0 -0
  175. {vastdb-1.3.6.dist-info → vastdb-1.3.8.dist-info}/LICENSE +0 -0
  176. {vastdb-1.3.6.dist-info → vastdb-1.3.8.dist-info}/WHEEL +0 -0
vastdb/_internal.py CHANGED
@@ -3,6 +3,7 @@ import json
3
3
  import logging
4
4
  import re
5
5
  import struct
6
+ import time
6
7
  import urllib.parse
7
8
  from collections import defaultdict, namedtuple
8
9
  from enum import Enum
@@ -37,75 +38,82 @@ from ibis.expr.operations.relations import Field
37
38
  from ibis.expr.operations.strings import StartsWith, StringContains
38
39
  from ibis.expr.operations.structs import StructField
39
40
 
40
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.BinaryLiteral as fb_binary_lit
41
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.BooleanLiteral as fb_bool_lit
42
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.Call as fb_call
43
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.DateLiteral as fb_date32_lit
44
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.DecimalLiteral as fb_decimal_lit
45
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.Expression as fb_expression
46
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.FieldIndex as fb_field_index
47
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.FieldRef as fb_field_ref
48
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.Float32Literal as fb_float32_lit
49
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.Float64Literal as fb_float64_lit
50
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.Int8Literal as fb_int8_lit
51
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.Int16Literal as fb_int16_lit
52
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.Int32Literal as fb_int32_lit
53
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.Int64Literal as fb_int64_lit
54
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.Literal as fb_literal
55
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.Relation as fb_relation
56
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.RelationImpl as rel_impl
57
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.Source as fb_source
58
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.StringLiteral as fb_string_lit
59
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.TimeLiteral as fb_time_lit
60
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.TimestampLiteral as fb_timestamp_lit
61
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.UInt8Literal as fb_uint8_lit
62
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.UInt16Literal as fb_uint16_lit
63
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.UInt32Literal as fb_uint32_lit
64
- import vast_flatbuf.org.apache.arrow.computeir.flatbuf.UInt64Literal as fb_uint64_lit
65
- import vast_flatbuf.org.apache.arrow.flatbuf.Binary as fb_binary
66
- import vast_flatbuf.org.apache.arrow.flatbuf.Bool as fb_bool
67
- import vast_flatbuf.org.apache.arrow.flatbuf.Date as fb_date
68
- import vast_flatbuf.org.apache.arrow.flatbuf.Decimal as fb_decimal
69
- import vast_flatbuf.org.apache.arrow.flatbuf.Field as fb_field
70
- import vast_flatbuf.org.apache.arrow.flatbuf.FixedSizeBinary as fb_fixed_size_binary
71
- import vast_flatbuf.org.apache.arrow.flatbuf.FloatingPoint as fb_floating_point
72
- import vast_flatbuf.org.apache.arrow.flatbuf.Int as fb_int
73
- import vast_flatbuf.org.apache.arrow.flatbuf.List as fb_list
74
- import vast_flatbuf.org.apache.arrow.flatbuf.Map as fb_map
75
- import vast_flatbuf.org.apache.arrow.flatbuf.Schema as fb_schema
76
- import vast_flatbuf.org.apache.arrow.flatbuf.Struct_ as fb_struct
77
- import vast_flatbuf.org.apache.arrow.flatbuf.Time as fb_time
78
- import vast_flatbuf.org.apache.arrow.flatbuf.Timestamp as fb_timestamp
79
- import vast_flatbuf.org.apache.arrow.flatbuf.Utf8 as fb_utf8
80
- import vast_flatbuf.tabular.AlterColumnRequest as tabular_alter_column
81
- import vast_flatbuf.tabular.AlterProjectionTableRequest as tabular_alter_projection
82
- import vast_flatbuf.tabular.AlterSchemaRequest as tabular_alter_schema
83
- import vast_flatbuf.tabular.AlterTableRequest as tabular_alter_table
84
- import vast_flatbuf.tabular.Column as tabular_projecion_column
85
- import vast_flatbuf.tabular.ColumnType as tabular_proj_column_type
86
- import vast_flatbuf.tabular.CreateProjectionRequest as tabular_create_projection
87
- import vast_flatbuf.tabular.CreateSchemaRequest as tabular_create_schema
88
- import vast_flatbuf.tabular.ImportDataRequest as tabular_import_data
89
- import vast_flatbuf.tabular.S3File as tabular_s3_file
90
- from vast_flatbuf.org.apache.arrow.computeir.flatbuf.Deref import Deref
91
- from vast_flatbuf.org.apache.arrow.computeir.flatbuf.ExpressionImpl import (
41
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.BinaryLiteral as fb_binary_lit
42
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.BooleanLiteral as fb_bool_lit
43
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.Call as fb_call
44
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.DateLiteral as fb_date32_lit
45
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.DecimalLiteral as fb_decimal_lit
46
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.Expression as fb_expression
47
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.FieldIndex as fb_field_index
48
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.FieldRef as fb_field_ref
49
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.Float32Literal as fb_float32_lit
50
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.Float64Literal as fb_float64_lit
51
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.Int8Literal as fb_int8_lit
52
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.Int16Literal as fb_int16_lit
53
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.Int32Literal as fb_int32_lit
54
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.Int64Literal as fb_int64_lit
55
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.Literal as fb_literal
56
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.Relation as fb_relation
57
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.RelationImpl as rel_impl
58
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.Source as fb_source
59
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.StringLiteral as fb_string_lit
60
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.TimeLiteral as fb_time_lit
61
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.TimestampLiteral as fb_timestamp_lit
62
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.UInt8Literal as fb_uint8_lit
63
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.UInt16Literal as fb_uint16_lit
64
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.UInt32Literal as fb_uint32_lit
65
+ import vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.UInt64Literal as fb_uint64_lit
66
+ import vastdb.vast_flatbuf.org.apache.arrow.flatbuf.Binary as fb_binary
67
+ import vastdb.vast_flatbuf.org.apache.arrow.flatbuf.Bool as fb_bool
68
+ import vastdb.vast_flatbuf.org.apache.arrow.flatbuf.Date as fb_date
69
+ import vastdb.vast_flatbuf.org.apache.arrow.flatbuf.Decimal as fb_decimal
70
+ import vastdb.vast_flatbuf.org.apache.arrow.flatbuf.Field as fb_field
71
+ import vastdb.vast_flatbuf.org.apache.arrow.flatbuf.FixedSizeBinary as fb_fixed_size_binary
72
+ import vastdb.vast_flatbuf.org.apache.arrow.flatbuf.FloatingPoint as fb_floating_point
73
+ import vastdb.vast_flatbuf.org.apache.arrow.flatbuf.Int as fb_int
74
+ import vastdb.vast_flatbuf.org.apache.arrow.flatbuf.List as fb_list
75
+ import vastdb.vast_flatbuf.org.apache.arrow.flatbuf.Map as fb_map
76
+ import vastdb.vast_flatbuf.org.apache.arrow.flatbuf.Schema as fb_schema
77
+ import vastdb.vast_flatbuf.org.apache.arrow.flatbuf.Struct_ as fb_struct
78
+ import vastdb.vast_flatbuf.org.apache.arrow.flatbuf.Time as fb_time
79
+ import vastdb.vast_flatbuf.org.apache.arrow.flatbuf.Timestamp as fb_timestamp
80
+ import vastdb.vast_flatbuf.org.apache.arrow.flatbuf.Utf8 as fb_utf8
81
+ import vastdb.vast_flatbuf.tabular.AlterColumnRequest as tabular_alter_column
82
+ import vastdb.vast_flatbuf.tabular.AlterProjectionTableRequest as tabular_alter_projection
83
+ import vastdb.vast_flatbuf.tabular.AlterSchemaRequest as tabular_alter_schema
84
+ import vastdb.vast_flatbuf.tabular.AlterTableRequest as tabular_alter_table
85
+ import vastdb.vast_flatbuf.tabular.Column as tabular_projecion_column
86
+ import vastdb.vast_flatbuf.tabular.ColumnType as tabular_proj_column_type
87
+ import vastdb.vast_flatbuf.tabular.CreateProjectionRequest as tabular_create_projection
88
+ import vastdb.vast_flatbuf.tabular.CreateSchemaRequest as tabular_create_schema
89
+ import vastdb.vast_flatbuf.tabular.ImportDataRequest as tabular_import_data
90
+ import vastdb.vast_flatbuf.tabular.KeyName as import_key_name
91
+ import vastdb.vast_flatbuf.tabular.S3File as tabular_s3_file
92
+ from vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.Deref import Deref
93
+ from vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.ExpressionImpl import (
92
94
  ExpressionImpl,
93
95
  )
94
- from vast_flatbuf.org.apache.arrow.computeir.flatbuf.LiteralImpl import LiteralImpl
95
- from vast_flatbuf.org.apache.arrow.flatbuf.DateUnit import DateUnit
96
- from vast_flatbuf.org.apache.arrow.flatbuf.TimeUnit import TimeUnit
97
- from vast_flatbuf.org.apache.arrow.flatbuf.Type import Type
98
- from vast_flatbuf.tabular.GetProjectionTableStatsResponse import (
96
+ from vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.LiteralImpl import (
97
+ LiteralImpl,
98
+ )
99
+ from vastdb.vast_flatbuf.org.apache.arrow.flatbuf.DateUnit import DateUnit
100
+ from vastdb.vast_flatbuf.org.apache.arrow.flatbuf.TimeUnit import TimeUnit
101
+ from vastdb.vast_flatbuf.org.apache.arrow.flatbuf.Type import Type
102
+ from vastdb.vast_flatbuf.tabular.GetProjectionTableStatsResponse import (
99
103
  GetProjectionTableStatsResponse as get_projection_table_stats,
100
104
  )
101
- from vast_flatbuf.tabular.GetTableStatsResponse import (
105
+ from vastdb.vast_flatbuf.tabular.GetTableStatsResponse import (
102
106
  GetTableStatsResponse as get_table_stats,
103
107
  )
104
- from vast_flatbuf.tabular.ListProjectionsResponse import (
108
+ from vastdb.vast_flatbuf.tabular.ListProjectionsResponse import (
105
109
  ListProjectionsResponse as list_projections,
106
110
  )
107
- from vast_flatbuf.tabular.ListSchemasResponse import ListSchemasResponse as list_schemas
108
- from vast_flatbuf.tabular.ListTablesResponse import ListTablesResponse as list_tables
111
+ from vastdb.vast_flatbuf.tabular.ListSchemasResponse import (
112
+ ListSchemasResponse as list_schemas,
113
+ )
114
+ from vastdb.vast_flatbuf.tabular.ListTablesResponse import (
115
+ ListTablesResponse as list_tables,
116
+ )
109
117
 
110
118
  from . import errors, util
111
119
  from .config import BackoffConfig
@@ -238,7 +246,7 @@ class Predicate:
238
246
  field_path.append(subfield_name)
239
247
 
240
248
  if not isinstance(column, Field):
241
- raise NotImplementedError(self.expr)
249
+ raise NotImplementedError("predicates not supported for column types ", column, "expr=", self.expr)
242
250
 
243
251
  field_path.append(column.name)
244
252
  field_path.reverse() # first entry should be the top-level column name
@@ -786,7 +794,7 @@ def _decode_table_props(s):
786
794
  return {y: _prop_coding[x][1](z) for x, y, z in triplets if z != ''}
787
795
 
788
796
 
789
- TableInfo = namedtuple('TableInfo', 'name properties handle num_rows size_in_bytes num_partitions')
797
+ TableInfo = namedtuple('TableInfo', 'name properties handle num_rows size_in_bytes num_partitions sorting_key_enabled')
790
798
 
791
799
 
792
800
  def _parse_table_info(obj, parse_properties):
@@ -797,7 +805,8 @@ def _parse_table_info(obj, parse_properties):
797
805
  used_bytes = obj.SizeInBytes()
798
806
  num_partitions = obj.NumPartitions()
799
807
  properties = parse_properties(properties)
800
- return TableInfo(name, properties, handle, num_rows, used_bytes, num_partitions)
808
+ sorting_key_enabled = obj.SortingKeyEnabled()
809
+ return TableInfo(name, properties, handle, num_rows, used_bytes, num_partitions, sorting_key_enabled)
801
810
 
802
811
 
803
812
  # Results that returns from tablestats
@@ -961,12 +970,12 @@ class VastdbApi:
961
970
  prefix += '&'.join(params_list)
962
971
  return prefix
963
972
 
964
- def _fill_common_headers(self, txid=0, client_tags=[], version_id=1):
973
+ def _fill_common_headers(self, txid=0, client_tags=[], version_id=1, sorting_key=[]):
965
974
  common_headers = {
966
975
  'tabular-txid': str(txid),
967
976
  'tabular-api-version-id': str(version_id),
968
977
  'tabular-client-name': 'tabular-api'
969
- }
978
+ } | {f"tabular-sorted-column-{i}": str(k) for i, k in enumerate(sorting_key)}
970
979
 
971
980
  return common_headers | {f'tabular-client-tags-{index}': tag for index, tag in enumerate(client_tags)}
972
981
 
@@ -1110,17 +1119,28 @@ class VastdbApi:
1110
1119
 
1111
1120
  return snapshots, is_truncated, marker
1112
1121
 
1122
+ def _make_sure_schema_exists(self, bucket, schema, timeout_sec=3):
1123
+ start_time = time.time()
1124
+ while time.time() - start_time < timeout_sec:
1125
+ _, schemas, _, _, _ = self.list_schemas(bucket)
1126
+ if schema in (x[0] for x in schemas):
1127
+ return
1128
+ self.create_schema(bucket, schema)
1129
+ raise Exception(f"Failed to find or create schema {schema} in {timeout_sec} seconds.")
1130
+
1113
1131
  def create_table(self, bucket, schema, name, arrow_schema=None,
1114
1132
  txid=0, client_tags=[], expected_retvals=[],
1115
- create_imports_table=False, use_external_row_ids_allocation=False, table_props=None):
1133
+ create_imports_table=False, use_external_row_ids_allocation=False, table_props=None,
1134
+ sorting_key=[]):
1116
1135
  self._create_table_internal(bucket=bucket, schema=schema, name=name, arrow_schema=arrow_schema,
1117
1136
  txid=txid, client_tags=client_tags, expected_retvals=expected_retvals,
1118
1137
  create_imports_table=create_imports_table, use_external_row_ids_allocation=use_external_row_ids_allocation,
1119
- table_props=table_props)
1138
+ table_props=table_props, sorting_key=sorting_key)
1120
1139
 
1121
1140
  def create_topic(self, bucket, name, topic_partitions, expected_retvals=[],
1122
1141
  message_timestamp_type=None, retention_ms=None, message_timestamp_after_max_ms=None,
1123
1142
  message_timestamp_before_max_ms=None):
1143
+ self._make_sure_schema_exists(bucket, KAFKA_TOPICS_SCHEMA_NAME)
1124
1144
  table_props = _encode_table_props(message_timestamp_type=message_timestamp_type,
1125
1145
  retention_ms=retention_ms,
1126
1146
  message_timestamp_after_max_ms=message_timestamp_after_max_ms,
@@ -1132,7 +1152,8 @@ class VastdbApi:
1132
1152
 
1133
1153
  def _create_table_internal(self, bucket, schema, name, arrow_schema=None,
1134
1154
  txid=0, client_tags=[], expected_retvals=[], topic_partitions=0,
1135
- create_imports_table=False, use_external_row_ids_allocation=False, table_props=None):
1155
+ create_imports_table=False, use_external_row_ids_allocation=False, table_props=None,
1156
+ sorting_key=[]):
1136
1157
  """
1137
1158
  Create a table, use the following request
1138
1159
  POST /bucket/schema/table?table HTTP/1.1
@@ -1149,8 +1170,7 @@ class VastdbApi:
1149
1170
  The request will look like:
1150
1171
  POST /bucket/schema/table?table&sub-table=vastdb-imported-objects HTTP/1.1
1151
1172
  """
1152
- headers = self._fill_common_headers(txid=txid, client_tags=client_tags)
1153
-
1173
+ headers = self._fill_common_headers(txid=txid, client_tags=client_tags, sorting_key=sorting_key)
1154
1174
  if arrow_schema is None:
1155
1175
  arrow_schema = pa.schema([])
1156
1176
 
@@ -1211,7 +1231,7 @@ class VastdbApi:
1211
1231
  table_properties=table_properties, new_name=new_name, expected_retvals=expected_retvals)
1212
1232
 
1213
1233
  def alter_table(self, bucket, schema, name, txid=0, client_tags=[], table_properties="",
1214
- new_name="", expected_retvals=[]):
1234
+ new_name="", expected_retvals=[], sorting_key=[]):
1215
1235
  """
1216
1236
  PUT /mybucket/myschema/mytable?table HTTP/1.1
1217
1237
  Content-Length: ContentLength
@@ -1235,7 +1255,7 @@ class VastdbApi:
1235
1255
  builder.Finish(params)
1236
1256
  alter_table_req = builder.Output()
1237
1257
 
1238
- headers = self._fill_common_headers(txid=txid, client_tags=client_tags)
1258
+ headers = self._fill_common_headers(txid=txid, client_tags=client_tags, sorting_key=sorting_key)
1239
1259
  headers['Content-Length'] = str(len(alter_table_req))
1240
1260
  url_params = {'tabular-new-table-name': schema + "/" + new_name} if len(new_name) else {}
1241
1261
 
@@ -1404,9 +1424,9 @@ class VastdbApi:
1404
1424
  url=self._url(bucket=bucket, schema=schema, table=table, command="column"),
1405
1425
  data=serialized_schema, headers=headers)
1406
1426
 
1407
- def list_columns(self, bucket, schema, table, *, txid=0, client_tags=None, max_keys=None, next_key=0,
1408
- count_only=False, name_prefix="", exact_match=False,
1409
- expected_retvals=None, bc_list_internals=False, list_imports_table=False):
1427
+ def _list_columns_internal(self, command, bucket, schema, table, txid, client_tags, max_keys, next_key,
1428
+ count_only, name_prefix, exact_match, expected_retvals, bc_list_internals,
1429
+ list_imports_table):
1410
1430
  """
1411
1431
  GET /mybucket/myschema/mytable?columns HTTP/1.1
1412
1432
  tabular-txid: TransactionId
@@ -1436,7 +1456,7 @@ class VastdbApi:
1436
1456
  url_params = {'sub-table': IMPORTED_OBJECTS_TABLE_NAME} if list_imports_table else {}
1437
1457
  res = self._request(
1438
1458
  method="GET",
1439
- url=self._url(bucket=bucket, schema=schema, table=table, command="column", url_params=url_params),
1459
+ url=self._url(bucket=bucket, schema=schema, table=table, command=command, url_params=url_params),
1440
1460
  headers=headers)
1441
1461
 
1442
1462
  res_headers = res.headers
@@ -1447,6 +1467,20 @@ class VastdbApi:
1447
1467
 
1448
1468
  return columns, next_key, is_truncated, count
1449
1469
 
1470
+ def list_columns(self, bucket, schema, table, *, txid=0, client_tags=None, max_keys=None, next_key=0,
1471
+ count_only=False, name_prefix="", exact_match=False,
1472
+ expected_retvals=None, bc_list_internals=False, list_imports_table=False):
1473
+ return self._list_columns_internal('column', bucket, schema, table, txid, client_tags, max_keys, next_key,
1474
+ count_only, name_prefix, exact_match, expected_retvals, bc_list_internals,
1475
+ list_imports_table)
1476
+
1477
+ def list_sorted_columns(self, bucket, schema, table, *, txid=0, client_tags=None, max_keys=None, next_key=0,
1478
+ count_only=False, name_prefix="", exact_match=False,
1479
+ expected_retvals=None, bc_list_internals=False, list_imports_table=False):
1480
+ return self._list_columns_internal('sorted-columns', bucket, schema, table, txid, client_tags, max_keys, next_key,
1481
+ count_only, name_prefix, exact_match, expected_retvals, bc_list_internals,
1482
+ list_imports_table)
1483
+
1450
1484
  def head_bucket(self, bucket_name):
1451
1485
  """
1452
1486
  Reimplemented, instead of depending on boto3 for checking the existence of a bucket.
@@ -1585,7 +1619,7 @@ class VastdbApi:
1585
1619
  source_files: list of (bucket_name, file_name)
1586
1620
  """
1587
1621
  def import_data(self, bucket, schema, table, source_files, txid=0, client_tags=[], expected_retvals=[], case_sensitive=True,
1588
- schedule_id=None, retry_count=0, blocking=True):
1622
+ schedule_id=None, retry_count=0, blocking=True, key_names=[]):
1589
1623
  """
1590
1624
  POST /mybucket/myschema/mytable?data HTTP/1.1
1591
1625
  Content-Length: ContentLength
@@ -1627,8 +1661,23 @@ class VastdbApi:
1627
1661
  builder.PrependUOffsetTRelative(f)
1628
1662
 
1629
1663
  files = builder.EndVector()
1664
+
1665
+ key_names_arr = []
1666
+ for key in key_names:
1667
+ kname = builder.CreateString(key)
1668
+ import_key_name.Start(builder)
1669
+ import_key_name.AddName(builder, kname)
1670
+ key_names_arr.append(import_key_name.End(builder))
1671
+
1672
+ tabular_import_data.StartKeyNamesVector(builder, len(key_names_arr))
1673
+ for key in reversed(key_names_arr):
1674
+ builder.PrependUOffsetTRelative(key)
1675
+
1676
+ key_names_vec = builder.EndVector()
1677
+
1630
1678
  tabular_import_data.Start(builder)
1631
1679
  tabular_import_data.AddS3Files(builder, files)
1680
+ tabular_import_data.AddKeyNames(builder, key_names_vec)
1632
1681
  params = tabular_import_data.End(builder)
1633
1682
  builder.Finish(params)
1634
1683
  import_req = builder.Output()
@@ -1942,6 +1991,49 @@ class QueryDataInternalError(Exception):
1942
1991
  pass
1943
1992
 
1944
1993
 
1994
+ def read_first_batch(fileobj):
1995
+ readers = {} # {stream_id: pa.ipc.RecordBatchStreamReader}
1996
+ while True:
1997
+ stream_id_bytes = fileobj.read(4)
1998
+ if not stream_id_bytes:
1999
+ if readers:
2000
+ raise EOFError(f'no readers ({readers}) should be open at EOF')
2001
+ break
2002
+
2003
+ stream_id, = struct.unpack('<L', stream_id_bytes)
2004
+ if stream_id == TABULAR_KEEP_ALIVE_STREAM_ID:
2005
+ continue
2006
+
2007
+ if stream_id == TABULAR_QUERY_DATA_COMPLETED_STREAM_ID:
2008
+ # read the terminating end chunk from socket
2009
+ res = fileobj.read()
2010
+ _logger.debug("stream_id=%d res=%s (finish)", stream_id, res)
2011
+ return None
2012
+
2013
+ if stream_id == TABULAR_QUERY_DATA_FAILED_STREAM_ID:
2014
+ # read the terminating end chunk from socket
2015
+ res = fileobj.read()
2016
+ _logger.debug("stream_id=%d res=%s (failed)", stream_id, res)
2017
+ raise QueryDataInternalError() # connection closed by server due to an internal error
2018
+
2019
+ next_row_id_bytes = fileobj.read(8)
2020
+ next_row_id, = struct.unpack('<Q', next_row_id_bytes)
2021
+ _logger.debug("stream_id=%d next_row_id=%d", stream_id, next_row_id)
2022
+
2023
+ if stream_id not in readers:
2024
+ # we implicitly read 1st message (Arrow schema) when constructing RecordBatchStreamReader
2025
+ reader = pa.ipc.RecordBatchStreamReader(fileobj)
2026
+ _logger.debug("stream_id=%d schema=%s", stream_id, reader.schema)
2027
+ readers[stream_id] = reader
2028
+ continue
2029
+
2030
+ reader = readers[stream_id]
2031
+ try:
2032
+ return reader.read_next_batch() # read single-column chunk data
2033
+ except StopIteration: # we got an end-of-stream IPC message for a given stream ID
2034
+ return None
2035
+
2036
+
1945
2037
  def _iter_query_data_response_columns(fileobj, stream_ids=None):
1946
2038
  readers = {} # {stream_id: pa.ipc.RecordBatchStreamReader}
1947
2039
  while True:
vastdb/bench/test_perf.py CHANGED
@@ -10,11 +10,11 @@ log = logging.getLogger(__name__)
10
10
 
11
11
 
12
12
  @pytest.mark.benchmark
13
- def test_bench(session, bucket_name, parquets_path, crater_path):
13
+ def test_bench(session, test_bucket_name, parquets_path, crater_path):
14
14
  files = [str(parquets_path / f) for f in (parquets_path.glob('**/*.pq'))]
15
15
 
16
16
  with session.transaction() as tx:
17
- b = tx.bucket(bucket_name)
17
+ b = tx.bucket(test_bucket_name)
18
18
  s = b.create_schema('s1')
19
19
  t = util.create_table_from_files(s, 't1', files, config=ImportConfig(import_concurrency=8))
20
20
  config = QueryConfig(num_splits=8, num_sub_splits=4)
vastdb/config.py CHANGED
@@ -63,3 +63,6 @@ class ImportConfig:
63
63
  """Import execution configiration."""
64
64
 
65
65
  import_concurrency: int = 2
66
+
67
+ # import key column names
68
+ key_names: Optional[List[str]] = None
vastdb/errors.py CHANGED
@@ -17,6 +17,7 @@ class HttpStatus(Enum):
17
17
  INTERNAL_SERVER_ERROR = 500
18
18
  NOT_IMPLEMENTED = 501
19
19
  SERVICE_UNAVAILABLE = 503
20
+ INSUFFICIENT_CAPACITY = 507
20
21
 
21
22
 
22
23
  log = logging.getLogger(__name__)
@@ -79,6 +80,10 @@ class UnexpectedError(HttpError):
79
80
  pass
80
81
 
81
82
 
83
+ class InsufficientCapacity(HttpError):
84
+ pass
85
+
86
+
82
87
  @dataclass
83
88
  class ImportFilesError(Exception):
84
89
  message: str
@@ -197,6 +202,7 @@ ERROR_TYPES_MAP = {
197
202
  HttpStatus.INTERNAL_SERVER_ERROR: InternalServerError,
198
203
  HttpStatus.NOT_IMPLEMENTED: NotImplemented,
199
204
  HttpStatus.SERVICE_UNAVAILABLE: handle_unavailable,
205
+ HttpStatus.INSUFFICIENT_CAPACITY: InsufficientCapacity,
200
206
  }
201
207
 
202
208
 
vastdb/features.py CHANGED
@@ -13,6 +13,7 @@ class Features:
13
13
  def __init__(self, vast_version):
14
14
  """Save the server version."""
15
15
  self.vast_version = vast_version
16
+ log.info("VAST version: %s", self.vast_version)
16
17
 
17
18
  self.check_imports_table = self._check(
18
19
  "Imported objects' table feature requires 5.2+ VAST release",
@@ -30,6 +31,14 @@ class Features:
30
31
  "External row IDs allocation requires 5.1+ VAST release",
31
32
  vast_version >= (5, 1))
32
33
 
34
+ self.check_elysium = self._check(
35
+ "Elysium requires 5.3.5+ VAST release",
36
+ vast_version >= (5, 3, 5))
37
+
38
+ self.check_zip_import = self._check(
39
+ "Zip import requires 5.3.1+ VAST release",
40
+ vast_version >= (5, 3, 1))
41
+
33
42
  def _check(self, msg, supported):
34
43
  log.debug("%s (current version is %s): supported=%s", msg, self.vast_version, supported)
35
44
  if not supported:
vastdb/schema.py CHANGED
@@ -76,7 +76,8 @@ class Schema:
76
76
  break
77
77
  return result
78
78
 
79
- def create_table(self, table_name: str, columns: pa.Schema, fail_if_exists=True, use_external_row_ids_allocation=False) -> "Table":
79
+ def create_table(self, table_name: str, columns: pa.Schema, fail_if_exists=True,
80
+ use_external_row_ids_allocation=False, sorting_key=[]) -> "Table":
80
81
  """Create a new table under this schema.
81
82
 
82
83
  A virtual `vastdb_rowid` column (of `int64` type) can be created to access and filter by internal VAST row IDs.
@@ -91,7 +92,8 @@ class Schema:
91
92
  self.tx._rpc.features.check_external_row_ids_allocation()
92
93
 
93
94
  self.tx._rpc.api.create_table(self.bucket.name, self.name, table_name, columns, txid=self.tx.txid,
94
- use_external_row_ids_allocation=use_external_row_ids_allocation)
95
+ use_external_row_ids_allocation=use_external_row_ids_allocation,
96
+ sorting_key=sorting_key)
95
97
  log.info("Created table: %s", table_name)
96
98
  return self.table(table_name) # type: ignore[return-value]
97
99
 
@@ -149,4 +151,4 @@ class Schema:
149
151
 
150
152
 
151
153
  def _parse_table_info(table_info, schema: "schema.Schema"):
152
- return table.Table(name=table_info.name, schema=schema, handle=int(table_info.handle), _imports_table=False)
154
+ return table.Table(name=table_info.name, schema=schema, handle=int(table_info.handle), _imports_table=False, sorted_table=table_info.sorting_key_enabled)