PostBOUND 0.23.3__tar.gz → 0.23.4__tar.gz

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 (79) hide show
  1. {postbound-0.23.3 → postbound-0.23.4}/PKG-INFO +1 -1
  2. {postbound-0.23.3 → postbound-0.23.4}/PostBOUND.egg-info/PKG-INFO +1 -1
  3. {postbound-0.23.3 → postbound-0.23.4}/postbound/postgres/_explain.py +22 -12
  4. {postbound-0.23.3 → postbound-0.23.4}/postbound/postgres/_pg.py +3 -0
  5. {postbound-0.23.3 → postbound-0.23.4}/postbound/qal/_qal.py +3 -6
  6. {postbound-0.23.3 → postbound-0.23.4}/pyproject.toml +1 -1
  7. {postbound-0.23.3 → postbound-0.23.4}/LICENSE.txt +0 -0
  8. {postbound-0.23.3 → postbound-0.23.4}/PostBOUND.egg-info/SOURCES.txt +0 -0
  9. {postbound-0.23.3 → postbound-0.23.4}/PostBOUND.egg-info/dependency_links.txt +0 -0
  10. {postbound-0.23.3 → postbound-0.23.4}/PostBOUND.egg-info/requires.txt +0 -0
  11. {postbound-0.23.3 → postbound-0.23.4}/PostBOUND.egg-info/top_level.txt +0 -0
  12. {postbound-0.23.3 → postbound-0.23.4}/README.md +0 -0
  13. {postbound-0.23.3 → postbound-0.23.4}/postbound/__init__.py +0 -0
  14. {postbound-0.23.3 → postbound-0.23.4}/postbound/__init__.pyi +0 -0
  15. {postbound-0.23.3 → postbound-0.23.4}/postbound/_base.py +0 -0
  16. {postbound-0.23.3 → postbound-0.23.4}/postbound/_core.py +0 -0
  17. {postbound-0.23.3 → postbound-0.23.4}/postbound/_hints.py +0 -0
  18. {postbound-0.23.3 → postbound-0.23.4}/postbound/_ipython.py +0 -0
  19. {postbound-0.23.3 → postbound-0.23.4}/postbound/_pipelines.py +0 -0
  20. {postbound-0.23.3 → postbound-0.23.4}/postbound/_qep.py +0 -0
  21. {postbound-0.23.3 → postbound-0.23.4}/postbound/_stages.py +0 -0
  22. {postbound-0.23.3 → postbound-0.23.4}/postbound/bench.py +0 -0
  23. {postbound-0.23.3 → postbound-0.23.4}/postbound/db/__init__.py +0 -0
  24. {postbound-0.23.3 → postbound-0.23.4}/postbound/db/_cache.py +0 -0
  25. {postbound-0.23.3 → postbound-0.23.4}/postbound/db/_db.py +0 -0
  26. {postbound-0.23.3 → postbound-0.23.4}/postbound/db/_stats.py +0 -0
  27. {postbound-0.23.3 → postbound-0.23.4}/postbound/duckdb/__init__.py +0 -0
  28. {postbound-0.23.3 → postbound-0.23.4}/postbound/duckdb/_duckdb.py +0 -0
  29. {postbound-0.23.3 → postbound-0.23.4}/postbound/opt/__init__.py +0 -0
  30. {postbound-0.23.3 → postbound-0.23.4}/postbound/opt/__init__.pyi +0 -0
  31. {postbound-0.23.3 → postbound-0.23.4}/postbound/opt/_cardinalities.py +0 -0
  32. {postbound-0.23.3 → postbound-0.23.4}/postbound/opt/_dynprog.py +0 -0
  33. {postbound-0.23.3 → postbound-0.23.4}/postbound/opt/_enumeration.py +0 -0
  34. {postbound-0.23.3 → postbound-0.23.4}/postbound/opt/_helpers.py +0 -0
  35. {postbound-0.23.3 → postbound-0.23.4}/postbound/opt/_native.py +0 -0
  36. {postbound-0.23.3 → postbound-0.23.4}/postbound/opt/_randomized.py +0 -0
  37. {postbound-0.23.3 → postbound-0.23.4}/postbound/parser.py +0 -0
  38. {postbound-0.23.3 → postbound-0.23.4}/postbound/postgres/__init__.py +0 -0
  39. {postbound-0.23.3 → postbound-0.23.4}/postbound/postgres/_config.py +0 -0
  40. {postbound-0.23.3 → postbound-0.23.4}/postbound/postgres/_ctl.py +0 -0
  41. {postbound-0.23.3 → postbound-0.23.4}/postbound/qal/__init__.py +0 -0
  42. {postbound-0.23.3 → postbound-0.23.4}/postbound/qal/_formatter.py +0 -0
  43. {postbound-0.23.3 → postbound-0.23.4}/postbound/relalg.py +0 -0
  44. {postbound-0.23.3 → postbound-0.23.4}/postbound/train/__init__.py +0 -0
  45. {postbound-0.23.3 → postbound-0.23.4}/postbound/train/_train.py +0 -0
  46. {postbound-0.23.3 → postbound-0.23.4}/postbound/transform.py +0 -0
  47. {postbound-0.23.3 → postbound-0.23.4}/postbound/util/__init__.py +0 -0
  48. {postbound-0.23.3 → postbound-0.23.4}/postbound/util/__init__.pyi +0 -0
  49. {postbound-0.23.3 → postbound-0.23.4}/postbound/util/_df.py +0 -0
  50. {postbound-0.23.3 → postbound-0.23.4}/postbound/util/_errors.py +0 -0
  51. {postbound-0.23.3 → postbound-0.23.4}/postbound/util/collections.py +0 -0
  52. {postbound-0.23.3 → postbound-0.23.4}/postbound/util/dicts.py +0 -0
  53. {postbound-0.23.3 → postbound-0.23.4}/postbound/util/jsonize.py +0 -0
  54. {postbound-0.23.3 → postbound-0.23.4}/postbound/util/logging.py +0 -0
  55. {postbound-0.23.3 → postbound-0.23.4}/postbound/util/misc.py +0 -0
  56. {postbound-0.23.3 → postbound-0.23.4}/postbound/util/num.py +0 -0
  57. {postbound-0.23.3 → postbound-0.23.4}/postbound/util/nx.py +0 -0
  58. {postbound-0.23.3 → postbound-0.23.4}/postbound/util/proc.py +0 -0
  59. {postbound-0.23.3 → postbound-0.23.4}/postbound/util/stats.py +0 -0
  60. {postbound-0.23.3 → postbound-0.23.4}/postbound/util/system.py +0 -0
  61. {postbound-0.23.3 → postbound-0.23.4}/postbound/util/typing.py +0 -0
  62. {postbound-0.23.3 → postbound-0.23.4}/postbound/validation.py +0 -0
  63. {postbound-0.23.3 → postbound-0.23.4}/postbound/vis/__init__.py +0 -0
  64. {postbound-0.23.3 → postbound-0.23.4}/postbound/vis/__init__.pyi +0 -0
  65. {postbound-0.23.3 → postbound-0.23.4}/postbound/vis/fdl.py +0 -0
  66. {postbound-0.23.3 → postbound-0.23.4}/postbound/vis/graphs.py +0 -0
  67. {postbound-0.23.3 → postbound-0.23.4}/postbound/vis/optimizer.py +0 -0
  68. {postbound-0.23.3 → postbound-0.23.4}/postbound/vis/plots.py +0 -0
  69. {postbound-0.23.3 → postbound-0.23.4}/postbound/vis/trees.py +0 -0
  70. {postbound-0.23.3 → postbound-0.23.4}/postbound/workloads.py +0 -0
  71. {postbound-0.23.3 → postbound-0.23.4}/setup.cfg +0 -0
  72. {postbound-0.23.3 → postbound-0.23.4}/tests/test_benchmarking.py +0 -0
  73. {postbound-0.23.3 → postbound-0.23.4}/tests/test_core.py +0 -0
  74. {postbound-0.23.3 → postbound-0.23.4}/tests/test_docs.py +0 -0
  75. {postbound-0.23.3 → postbound-0.23.4}/tests/test_duckdb.py +0 -0
  76. {postbound-0.23.3 → postbound-0.23.4}/tests/test_postgres.py +0 -0
  77. {postbound-0.23.3 → postbound-0.23.4}/tests/test_qal.py +0 -0
  78. {postbound-0.23.3 → postbound-0.23.4}/tests/test_relalg.py +0 -0
  79. {postbound-0.23.3 → postbound-0.23.4}/tests/test_util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PostBOUND
3
- Version: 0.23.3
3
+ Version: 0.23.4
4
4
  Summary: PostBOUND is a research framework to prototype and benchmark database query optimizers
5
5
  Author-email: Rico Bergmann <rico.bergmann1@tu-dresden.de>
6
6
  License-Expression: Apache-2.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PostBOUND
3
- Version: 0.23.3
3
+ Version: 0.23.4
4
4
  Summary: PostBOUND is a research framework to prototype and benchmark database query optimizers
5
5
  Author-email: Rico Bergmann <rico.bergmann1@tu-dresden.de>
6
6
  License-Expression: Apache-2.0
@@ -5,7 +5,7 @@ import warnings
5
5
  from collections.abc import Sequence
6
6
  from typing import Any, Literal, get_args, override
7
7
 
8
- from .._core import Cardinality, IntermediateOperator, JoinOperator, ScanOperator, TableReference
8
+ from .._core import Cardinality, IntermediateOperator, JoinOperator, ScanOperator, TableReference, TimeS
9
9
  from .._qep import QueryPlan, SortKey
10
10
 
11
11
  PostgresExplainJoinNodes = {
@@ -344,15 +344,15 @@ class PostgresExplain:
344
344
  )
345
345
  return TableReference(self.relation_name, alias)
346
346
 
347
- def as_qep(self) -> QueryPlan:
347
+ def as_qep(self, *, planning_time: TimeS = float("nan")) -> QueryPlan:
348
348
  """Transforms the postgres-specific plan to a standardized `QueryPlan` instance.
349
349
 
350
- Notice that this transformation is lossy since not all information from the Postgres plan can be represented in query
351
- execution plan instances. Furthermore, this transformation can be problematic for complicated queries that use
352
- special Postgres features. Most importantly, for queries involving subqueries, special node types and parent
353
- relationships can be contained in the plan, that cannot be represented by other parts of PostBOUND. If this method
354
- and the resulting query execution plans should be used on complex workloads, it is advisable to check the plans twice
355
- before continuing.
350
+ Notice that this transformation is lossy since not all information from the Postgres plan can be represented in
351
+ query execution plan instances. Furthermore, this transformation can be problematic for complicated queries that
352
+ use special Postgres features. Most importantly, for queries involving subqueries, special node types and parent
353
+ relationships can be contained in the plan, that cannot be represented by other parts of PostBOUND. If this
354
+ method and the resulting query execution plans should be used on complex workloads, it is advisable to check the
355
+ plans twice before continuing.
356
356
 
357
357
  Returns
358
358
  -------
@@ -364,7 +364,12 @@ class PostgresExplain:
364
364
  ValueError
365
365
  If the node contains more than two children.
366
366
  """
367
- return self._generate_qep()
367
+ qep = self._generate_qep()
368
+
369
+ if planning_time > 0:
370
+ qep.measures["planning_time"] = planning_time
371
+
372
+ return qep
368
373
 
369
374
  def _generate_qep(self, *, card_adjustment: float = 1.0) -> QueryPlan:
370
375
  child_nodes = []
@@ -442,6 +447,11 @@ class PostgresExplain:
442
447
  subplan_target_name=subplan_name,
443
448
  )
444
449
 
450
+ if not math.isnan(self.planned_workers):
451
+ plan.estimates["planned_workers"] = self.planned_workers
452
+ if not math.isnan(self.launched_workers):
453
+ plan.measures["launched_workers"] = self.launched_workers
454
+
445
455
  return plan
446
456
 
447
457
  def inspect(self, *, _indentation: int = 0) -> str:
@@ -551,10 +561,10 @@ class PostgresPlan:
551
561
  if not (isinstance(self.explain_data, dict) and "Plan" in self.explain_data):
552
562
  raise ValueError(f"Invalid explain data: missing 'Plan' key: {explain_data}")
553
563
 
554
- self.planning_time: float = self.explain_data.get("Planning Time", math.nan) / 1000
555
- self.execution_time: float = self.explain_data.get("Execution Time", math.nan) / 1000
564
+ self.planning_time: TimeS = self.explain_data.get("Planning Time", math.nan) / 1000
565
+ self.execution_time: TimeS = self.explain_data.get("Execution Time", math.nan) / 1000
556
566
  self.query_plan = PostgresExplain(self.explain_data["Plan"])
557
- self._normalized_plan = self.query_plan.as_qep()
567
+ self._normalized_plan = self.query_plan.as_qep(planning_time=self.planning_time)
558
568
 
559
569
  @property
560
570
  def root(self) -> PostgresExplain:
@@ -2361,6 +2361,9 @@ class PostgresOptimizer(OptimizerInterface):
2361
2361
  plan = plan[0]
2362
2362
  if isinstance(plan, tuple):
2363
2363
  plan = plan[0]
2364
+ if isinstance(plan, list):
2365
+ # the actual EXPLAIN output is wrapped in another list
2366
+ plan = plan[0]
2364
2367
 
2365
2368
  if not isinstance(plan, dict):
2366
2369
  warnings.warn(f"Could not parse plan: {plan}. Expected a dictionary, but got {type(plan)}.", stacklevel=2)
@@ -3727,7 +3727,7 @@ class PredicateVisitor(ABC, Generic[VisitorResult]):
3727
3727
  @overload
3728
3728
  def as_predicate(
3729
3729
  column: ColumnReference,
3730
- operation: Literal[BinaryOperator.In, "in", "IN"],
3730
+ operation: Literal[BinaryOperator.In, "in", "IN", BinaryOperator.NotIn, "not in", "NOT IN"],
3731
3731
  *arguments,
3732
3732
  ) -> InPredicate: ...
3733
3733
 
@@ -3843,12 +3843,9 @@ def as_predicate(column: ColumnReference, operation: BinaryOperator | UnaryOpera
3843
3843
  as_expression(upper, allow_star=False),
3844
3844
  ),
3845
3845
  )
3846
- elif operation == BinaryOperator.In:
3846
+ elif operation in (BinaryOperator.In, BinaryOperator.NotIn):
3847
3847
  arguments = util.flatten(arguments)
3848
- return InPredicate(
3849
- column,
3850
- [as_expression(value, allow_star=False) for value in arguments],
3851
- )
3848
+ return InPredicate(column, [as_expression(value, allow_star=False) for value in arguments], operator=operation)
3852
3849
  elif len(arguments) != 1:
3853
3850
  raise ValueError("Too many arguments for binary predicate: " + str(arguments))
3854
3851
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "PostBOUND"
7
- version = "0.23.3"
7
+ version = "0.23.4"
8
8
  authors = [{ name = "Rico Bergmann", email = "rico.bergmann1@tu-dresden.de" }]
9
9
  description = "PostBOUND is a research framework to prototype and benchmark database query optimizers"
10
10
  readme = "README.md"
File without changes
File without changes
File without changes
File without changes
File without changes