Commit 19ba343
feat: allow default scheme and netloc for schemeless path (#2291)
<!--
Thanks for opening a pull request!
-->
<!-- In the case this PR will resolve an issue, please replace
${GITHUB_ISSUE_ID} below with the actual Github issue id. -->
<!-- Closes #${GITHUB_ISSUE_ID} -->
# Rationale for this change
For hdfs it's common to get scheme and netloc from config and have paths
be just the uri. This PR adds properties to configure `DEFAULT_SCHEME`
and `DEFAULT_NETLOC`
For example
```
from pyiceberg.catalog import load_catalog
catalog = load_catalog("default", {
...,
"DEFAULT_SCHEME": "hdfs",
"DEFAULT_NETLOC": "ltx1-yugioh-cluster01.linkfs.prod-ltx1.atd.prod.linkedin.com:9000",
}
```
or if not using catalog
```
static_table = StaticTable.from_metadata(
"/warehouse/wh/nyc.db/taxis/metadata/00002-6ea51ce3-62aa-4197-9cf8-43d07c3440ca.metadata.json"
properties={
'DEFAULT_SCHEME': 'hdfs',
'DEFAULT_NETLOC': 'ltx1-yugioh-cluster01.linkfs.prod-ltx1.atd.prod.linkedin.com:9000',
}
)
```
Previously, schemeless paths are assumed to be for the local filesystem
only. This PR allows schemeless paths to be passed to the HDFS
Filesystem
# Are these changes tested?
Tested in test env at linkedin and with unit tests
# Are there any user-facing changes?
No user facing changes by default. If you add these env variables, if
file path doesn't have scheme/netloc it'll use the defaults specified.
<!-- In the case of user-facing changes, please add the changelog label.
-->
---------
Co-authored-by: Tom McCormick <[email protected]>1 parent 86b0fe8 commit 19ba343
2 files changed
+38
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
396 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
397 | 400 | | |
| 401 | + | |
398 | 402 | | |
399 | | - | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
400 | 406 | | |
401 | 407 | | |
402 | 408 | | |
| |||
614 | 620 | | |
615 | 621 | | |
616 | 622 | | |
617 | | - | |
| 623 | + | |
618 | 624 | | |
619 | 625 | | |
620 | 626 | | |
| |||
631 | 637 | | |
632 | 638 | | |
633 | 639 | | |
634 | | - | |
| 640 | + | |
635 | 641 | | |
636 | 642 | | |
637 | 643 | | |
| |||
652 | 658 | | |
653 | 659 | | |
654 | 660 | | |
655 | | - | |
| 661 | + | |
656 | 662 | | |
657 | 663 | | |
658 | 664 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2785 | 2785 | | |
2786 | 2786 | | |
2787 | 2787 | | |
| 2788 | + | |
| 2789 | + | |
| 2790 | + | |
| 2791 | + | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
| 2796 | + | |
| 2797 | + | |
| 2798 | + | |
| 2799 | + | |
| 2800 | + | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
| 2805 | + | |
| 2806 | + | |
| 2807 | + | |
| 2808 | + | |
| 2809 | + | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
0 commit comments