streaming-sql-engine 0.1.7__tar.gz → 0.1.8__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 (73) hide show
  1. {streaming_sql_engine-0.1.7/streaming_sql_engine.egg-info → streaming_sql_engine-0.1.8}/PKG-INFO +1 -1
  2. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/__init__.py +1 -1
  3. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/planner.py +91 -11
  4. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/pyproject.toml +1 -1
  5. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/setup.py +1 -1
  6. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8/streaming_sql_engine.egg-info}/PKG-INFO +1 -1
  7. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/DEPLOYMENT.md +0 -0
  8. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/MANIFEST.in +0 -0
  9. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/QUICK_DEPLOY.md +0 -0
  10. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/QUICK_FIX.md +0 -0
  11. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/README.md +0 -0
  12. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/APACHE_DRILL_COMPARISON.md +0 -0
  13. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/API_JOIN_OPERATIONS.md +0 -0
  14. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/ARCHITECTURAL_RECOMMENDATION.md +0 -0
  15. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/ARCHITECTURE_DECISION.md +0 -0
  16. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/ARCHITECTURE_SYNCED.md +0 -0
  17. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/BEST_USE_CASES.md +0 -0
  18. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/BETTER_FILTER_APPROACH.md +0 -0
  19. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/CHANGES_SUMMARY.md +0 -0
  20. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/COMPREHENSIVE_DOCUMENTATION.md +0 -0
  21. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/DEVELOPER_GUIDE.md +0 -0
  22. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/DUCKDB_COMPARISON.md +0 -0
  23. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/FINAL_IMPLEMENTATION_RECOMMENDATIONS.md +0 -0
  24. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/FINAL_RECOMMENDATION.md +0 -0
  25. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/HOW_PROTOCOL_DETECTION_WORKS.md +0 -0
  26. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/HOW_TO_ADD_TO_PROJECT.md +0 -0
  27. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/INSTALLATION.md +0 -0
  28. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/JSONL_EXECUTOR_ANALYSIS.md +0 -0
  29. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/JSONL_EXECUTOR_REMOVED.md +0 -0
  30. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/LIBRARY_DOCUMENTATION.md +0 -0
  31. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/MIGRATION_GUIDE.md +0 -0
  32. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/MULTI_SOURCE_EXAMPLE_README.md +0 -0
  33. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/MYSQL_USAGE.md +0 -0
  34. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/OPTIMIZATIONS_BREAKDOWN.md +0 -0
  35. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/OPTIMIZATIONS_NOT_DATABASE_ONLY.md +0 -0
  36. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/OPTIMIZATIONS_VS_POLARS.md +0 -0
  37. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/OPTIMIZER_AUTOMATED.md +0 -0
  38. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/PERFORMANCE.md +0 -0
  39. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/PERFORMANCE_COMPARISON.md +0 -0
  40. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/POLARS_AND_MMAP_GUIDE.md +0 -0
  41. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/PROTOCOL_AND_OPTIMIZATIONS_EXPLAINED.md +0 -0
  42. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/PROTOCOL_EXPLANATION.md +0 -0
  43. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/PUBLISHING.md +0 -0
  44. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/PYPI_CHECKLIST.md +0 -0
  45. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/QUICK_PUBLISH.md +0 -0
  46. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/QUICK_START.md +0 -0
  47. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/SIMPLE_PROTOCOL_GUIDE.md +0 -0
  48. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/SIMPLE_SOURCE_FUNCTIONS.md +0 -0
  49. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/SOURCE_COMBINATIONS_GUIDE.md +0 -0
  50. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/TECHNICAL_DOCUMENTATION.md +0 -0
  51. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/USER_GUIDE.md +0 -0
  52. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/WHAT_IS_WHERE_TO_PARAMS.md +0 -0
  53. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/WHY_API_CONVERTER_NEEDED.md +0 -0
  54. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/WHY_MANUAL_PARSING.md +0 -0
  55. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/documentation/WHY_PROTOCOL_IN_SOURCES.md +0 -0
  56. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/engine.py +0 -0
  57. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/evaluator.py +0 -0
  58. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/executor.py +0 -0
  59. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/mmap_index.py +0 -0
  60. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/operators.py +0 -0
  61. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/operators_mmap.py +0 -0
  62. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/operators_polars.py +0 -0
  63. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/optimizer.py +0 -0
  64. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/parser.py +0 -0
  65. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/polars_expression_translator.py +0 -0
  66. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/polars_operators.py +0 -0
  67. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/protocol_helpers.py +0 -0
  68. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/requirements.txt +0 -0
  69. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/setup.cfg +0 -0
  70. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/streaming_sql_engine.egg-info/SOURCES.txt +0 -0
  71. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/streaming_sql_engine.egg-info/dependency_links.txt +0 -0
  72. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/streaming_sql_engine.egg-info/requires.txt +0 -0
  73. {streaming_sql_engine-0.1.7 → streaming_sql_engine-0.1.8}/streaming_sql_engine.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streaming-sql-engine
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: A lightweight SQL execution engine for streaming row-by-row queries with joins across multiple data sources
5
5
  Home-page: https://github.com/Ierofantis/streaming-sql-engine/tree/master
6
6
  Author: Theodore Pantazopoulo
@@ -27,5 +27,5 @@ try:
27
27
  except ImportError:
28
28
  __all__ = ["Engine"]
29
29
 
30
- __version__ = "0.1.7"
30
+ __version__ = "0.1.8"
31
31
 
@@ -15,6 +15,7 @@ class JoinInfo:
15
15
  join_type: str # "INNER" or "LEFT"
16
16
  left_key: str # e.g., "sp.fk_abs"
17
17
  right_key: str # e.g., "spa.id"
18
+ additional_where: object = None # Additional WHERE conditions from ON clause
18
19
 
19
20
 
20
21
  @dataclass
@@ -56,9 +57,13 @@ def build_logical_plan(ast, registered_tables):
56
57
 
57
58
  # Extract JOINs
58
59
  joins = []
60
+ additional_where_conditions = []
59
61
  for join_expr in ast.args.get("joins", []):
60
62
  join_info = _extract_join(join_expr, registered_tables)
61
63
  joins.append(join_info)
64
+ # Collect additional WHERE conditions from JOIN ON clauses
65
+ if join_info.additional_where is not None:
66
+ additional_where_conditions.append(join_info.additional_where)
62
67
 
63
68
  # Extract WHERE clause
64
69
  where_expr = ast.args.get("where")
@@ -68,6 +73,21 @@ def build_logical_plan(ast, registered_tables):
68
73
  where_expr = where_expr.this
69
74
  # where_expr is now the actual expression (And, Or, EQ, etc.)
70
75
 
76
+ # Merge additional WHERE conditions from JOIN ON clauses into main WHERE clause
77
+ if additional_where_conditions:
78
+ if where_expr is None:
79
+ # No existing WHERE clause, use the first additional condition
80
+ where_expr = additional_where_conditions[0]
81
+ # Combine remaining conditions with AND
82
+ for cond in additional_where_conditions[1:]:
83
+ where_expr = exp.And(this=where_expr, expression=cond)
84
+ else:
85
+ # Combine existing WHERE with additional conditions using AND
86
+ combined = where_expr
87
+ for cond in additional_where_conditions:
88
+ combined = exp.And(this=combined, expression=cond)
89
+ where_expr = combined
90
+
71
91
  # Extract SELECT projections
72
92
  projections = list(ast.expressions)
73
93
 
@@ -130,32 +150,92 @@ def _extract_join(join_expr, registered_tables):
130
150
  if not on_expr:
131
151
  raise ParseError("JOIN must have an ON condition")
132
152
 
133
- left_key, right_key = _extract_join_keys(on_expr)
153
+ result = _extract_join_keys(on_expr)
154
+ if len(result) == 3:
155
+ left_key, right_key, additional_where = result
156
+ else:
157
+ # Backward compatibility: if function returns 2 values
158
+ left_key, right_key = result
159
+ additional_where = None
134
160
 
135
- return JoinInfo(
161
+ join_info = JoinInfo(
136
162
  table=table,
137
163
  alias=alias,
138
164
  join_type=join_type,
139
165
  left_key=left_key,
140
166
  right_key=right_key
141
167
  )
168
+
169
+ # Store additional WHERE conditions to be added later
170
+ if additional_where is not None:
171
+ join_info.additional_where = additional_where
172
+ else:
173
+ join_info.additional_where = None
174
+
175
+ return join_info
142
176
 
143
177
 
144
178
  def _extract_join_keys(on_expr):
145
179
  """
146
180
  Extract join keys from ON condition.
147
- Currently only supports equality joins: alias1.col1 = alias2.col2
181
+ Supports single equality joins: alias1.col1 = alias2.col2
182
+ For multiple conditions with AND, uses the first equality condition as the join key
183
+ and returns additional conditions to be moved to WHERE clause.
148
184
  """
149
- if not isinstance(on_expr, exp.EQ):
150
- raise ParseError("Only equality joins are supported in ON clause")
151
-
152
- left = on_expr.this
153
- right = on_expr.expression
185
+ # Handle multiple conditions with AND
186
+ if isinstance(on_expr, exp.And):
187
+ # Extract all equality conditions
188
+ equality_conditions = []
189
+ other_conditions = []
190
+
191
+ def _extract_conditions(expr):
192
+ if isinstance(expr, exp.And):
193
+ _extract_conditions(expr.this)
194
+ _extract_conditions(expr.expression)
195
+ elif isinstance(expr, exp.EQ):
196
+ equality_conditions.append(expr)
197
+ else:
198
+ other_conditions.append(expr)
199
+
200
+ _extract_conditions(on_expr)
201
+
202
+ if not equality_conditions:
203
+ raise ParseError("ON clause must contain at least one equality condition")
204
+
205
+ # Use the first equality condition as the join key
206
+ first_eq = equality_conditions[0]
207
+ left = first_eq.this
208
+ right = first_eq.expression
209
+
210
+ left_key = _column_to_string(left)
211
+ right_key = _column_to_string(right)
212
+
213
+ # Combine remaining conditions to be added to WHERE clause
214
+ remaining_conditions = equality_conditions[1:] + other_conditions
215
+ additional_where = None
216
+ if remaining_conditions:
217
+ if len(remaining_conditions) == 1:
218
+ additional_where = remaining_conditions[0]
219
+ else:
220
+ # Combine multiple conditions with AND
221
+ additional_where = remaining_conditions[0]
222
+ for cond in remaining_conditions[1:]:
223
+ additional_where = exp.And(this=additional_where, expression=cond)
224
+
225
+ return left_key, right_key, additional_where
154
226
 
155
- left_key = _column_to_string(left)
156
- right_key = _column_to_string(right)
227
+ # Handle single equality condition
228
+ elif isinstance(on_expr, exp.EQ):
229
+ left = on_expr.this
230
+ right = on_expr.expression
231
+
232
+ left_key = _column_to_string(left)
233
+ right_key = _column_to_string(right)
234
+
235
+ return left_key, right_key, None
157
236
 
158
- return left_key, right_key
237
+ else:
238
+ raise ParseError("Only equality joins are supported in ON clause")
159
239
 
160
240
 
161
241
  def _column_to_string(expr):
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "streaming-sql-engine"
7
- version = "0.1.7"
7
+ version = "0.1.8"
8
8
  description = "A lightweight SQL execution engine for streaming row-by-row queries with joins across multiple data sources"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -12,7 +12,7 @@ with open("requirements.txt", "r", encoding="utf-8") as fh:
12
12
 
13
13
  setup(
14
14
  name="streaming-sql-engine",
15
- version="0.1.7",
15
+ version="0.1.8",
16
16
  author="Theodore Pantazopoulo",
17
17
  author_email="your.email@example.com",
18
18
  description="A lightweight SQL execution engine for streaming row-by-row queries with joins across multiple data sources",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streaming-sql-engine
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: A lightweight SQL execution engine for streaming row-by-row queries with joins across multiple data sources
5
5
  Home-page: https://github.com/Ierofantis/streaming-sql-engine/tree/master
6
6
  Author: Theodore Pantazopoulo