You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@tsfile.apache.org by "ColinLeeo (via GitHub)" <gi...@apache.org> on 2026/08/25 10:32:11 UTC

[PR] fix(python): make dataframe index opt-in [tsfile]

ColinLeeo opened a new pull request, #919:
URL: https://github.com/apache/tsfile/pull/919

   ## Description
   
   This PR makes the Python `TsFileDataFrame` persistent dataset index opt-in.
   
   By default, `TsFileDataFrame(..., use_index=False)` now keeps the previous direct metadata loading behavior and does not create or reuse any `.tsidx` file. Users can explicitly enable persistent indexing with `use_index=True`; when enabled, the dataframe will reuse a matching index if present, or build one when the matching index is missing or stale.
   
   The persistent index file name is now scoped by the expanded canonical TsFile set, so different subsets under the same directory no longer contend for the same `.tsidx` file.
   
   ## Changes
   
   - Add `use_index: bool = False` to `TsFileDataFrame`.
   - Preserve direct scan behavior when indexing is disabled.
   - Use a hash of the expanded absolute file set in the persistent index file name.
   - Keep index validation based on file fingerprints before reuse.
   - Add tests for default no-index behavior.
   - Add tests for same-directory different-file-subset index isolation.
   - Update runtime/index-specific tests to pass `use_index=True`.
   
   ## Validation
   
   - `./mvnw -P with-cpp -pl cpp -DskipTests package`
   - `./mvnw -P with-python -pl python test`
     - `200 passed`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@tsfile.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(python): make dataframe index opt-in [tsfile]

Posted by "ColinLeeo (via GitHub)" <gi...@apache.org>.
ColinLeeo merged PR #919:
URL: https://github.com/apache/tsfile/pull/919


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@tsfile.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(python): make dataframe index opt-in [tsfile]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #919:
URL: https://github.com/apache/tsfile/pull/919#issuecomment-5409640485

   ## [Codecov](https://app.codecov.io/gh/apache/tsfile/pull/919?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 61.26%. Comparing base ([`b4b40c0`](https://app.codecov.io/gh/apache/tsfile/commit/b4b40c0b43ae7e9434e03fc12df9d24465c3b569?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`7b9aa9a`](https://app.codecov.io/gh/apache/tsfile/commit/7b9aa9a27813d43a0908bd748566079b0f6ef26e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@           Coverage Diff            @@
   ##           develop     #919   +/-   ##
   ========================================
     Coverage    61.26%   61.26%           
   ========================================
     Files          746      746           
     Lines        51560    51560           
     Branches      8353     8353           
   ========================================
     Hits         31586    31586           
     Misses       18359    18359           
     Partials      1615     1615           
   ```
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/tsfile/pull/919?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@tsfile.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(python): make dataframe index opt-in [tsfile]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #919:
URL: https://github.com/apache/tsfile/pull/919#discussion_r3860140863


##########
python/tsfile/dataset/index.py:
##########
@@ -460,10 +462,18 @@ def find_series_id(self, device_id: int, column_id: int) -> int:
 
 
 def index_path_for(paths: Sequence[str]) -> str:
-    common = os.path.commonpath([os.path.abspath(path) for path in paths])
+    canonical_paths = sorted(os.path.abspath(path) for path in paths)
+    common = os.path.commonpath(canonical_paths)

Review Comment:
   `index_path_for()` calls `os.path.commonpath()` on `canonical_paths` without guarding for an empty `paths` input. If a user constructs `TsFileDataFrame([] , use_index=True)` (or any empty sequence reaches here), this raises a low-level `ValueError` from `commonpath` instead of a clear validation error.
   
   Add an explicit empty-check and raise a user-facing `ValueError` before computing the common path/hash.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@tsfile.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org