Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions python/fate_arch/storage/hdfs/_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# limitations under the License.
#
import io
import os
import subprocess
from typing import Iterable

from pyarrow import fs
Expand Down Expand Up @@ -46,12 +48,17 @@ def __init__(
store_type=store_type,
)
# tricky way to load libhdfs
try:
from pyarrow import HadoopFileSystem
#try:
# from pyarrow import HadoopFileSystem

HadoopFileSystem(self.path)
except Exception as e:
LOGGER.warning(f"load libhdfs failed: {e}")
# HadoopFileSystem(self.path)
#except Exception as e:
# LOGGER.warning(f"load libhdfs failed: {e}")

hadoop_classpath = subprocess.check_output(
'$HADOOP_HOME/bin/hadoop classpath --glob', shell=True, executable='/bin/bash'
).decode('utf-8').strip()
os.environ['CLASSPATH'] = hadoop_classpath
self._hdfs_client = fs.HadoopFileSystem.from_uri(self.path)

def check_address(self):
Expand Down