-
Notifications
You must be signed in to change notification settings - Fork 0
QDB-16841 - Optimize indexed dataframe construction #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QDB-16841 - Optimize indexed dataframe construction #100
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Optimize the query function to construct DataFrames with an index in one step, introduce named indexes, and deprecate unused parameters.
- Directly pass the index to
pd.DataFramefor faster construction - Use a named index (
"$index"or the provided column name) - Add deprecation warnings for the now-ignored
blobsandnumpyarguments
Comments suppressed due to low confidence (5)
quasardb/pandas/init.py:187
- Docstring is missing a
Returnssection—please document that the function returns apandas.DataFrame.
Execute *query* and return the result as a pandas DataFrame.
quasardb/pandas/init.py:201
- Combine parameter names in the docstring is confusing; list
blobsandnumpyeach with their own description line.
blobs, numpy
quasardb/pandas/init.py:205
- Add unit tests to verify that passing non-default values for
blobsandnumpytriggers aDeprecationWarning.
# ------------------------------------------------------------------ deprecations
quasardb/pandas/init.py:206
- Inconsistent indentation: this
ifshould align with the function’s 4-space indent level (remove the extra space beforeif).
if blobs is not False:
quasardb/pandas/init.py:213
- Inconsistent indentation: this
ifshould align with the function’s 4-space indent level (remove the extra space beforeif).
if numpy is not True:
| df = pd.DataFrame(m) | ||
| index_vals, m = qdbnp.query(cluster, query, index=index, dict=True) | ||
|
|
||
| index_name = "$index" if index is None else index |
Copilot
AI
Jun 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider extracting the magic string "$index" into a module-level constant to improve clarity and avoid duplication.
| index_name = "$index" if index is None else index | |
| index_name = DEFAULT_INDEX_NAME if index is None else index |
* Constructing dataframe while providing index at the same time is much faster * We're now using named indexes, so users can refer to e.g. df['$timestamp'] and it will work * Added deprecation notices for unused parameters
df['$timestamp']and it will work