Exemple #1
0
    def __init__(self, host="default", port=0, user=None, kerb_ticket=None,
                 driver='libhdfs', extra_conf=None):
        warnings.warn(
            _DEPR_MSG.format(
                "hdfs.HadoopFileSystem", "2.0.0", "fs.HadoopFileSystem"),
            FutureWarning, stacklevel=2)
        if driver == 'libhdfs':
            _maybe_set_hadoop_classpath()

        self._connect(host, port, user, kerb_ticket, extra_conf)
Exemple #2
0
def connect(host="default",
            port=0,
            user=None,
            kerb_ticket=None,
            extra_conf=None):
    """
    DEPRECATED: Connect to an HDFS cluster.

    All parameters are optional and should only be set if the defaults need
    to be overridden.

    Authentication should be automatic if the HDFS cluster uses Kerberos.
    However, if a username is specified, then the ticket cache will likely
    be required.

    .. deprecated:: 2.0
        ``pyarrow.hdfs.connect`` is deprecated,
        please use ``pyarrow.fs.HadoopFileSystem`` instead.

    Parameters
    ----------
    host : NameNode. Set to "default" for fs.defaultFS from core-site.xml.
    port : NameNode's port. Set to 0 for default or logical (HA) nodes.
    user : Username when connecting to HDFS; None implies login user.
    kerb_ticket : Path to Kerberos ticket cache.
    extra_conf : dict, default None
      extra Key/Value pairs for config; Will override any
      hdfs-site.xml properties

    Notes
    -----
    The first time you call this method, it will take longer than usual due
    to JNI spin-up time.

    Returns
    -------
    filesystem : HadoopFileSystem
    """
    warnings.warn(_DEPR_MSG.format("hdfs.connect", "2.0.0",
                                   "fs.HadoopFileSystem"),
                  FutureWarning,
                  stacklevel=2)
    return _connect(host=host,
                    port=port,
                    user=user,
                    kerb_ticket=kerb_ticket,
                    extra_conf=extra_conf)
Exemple #3
0
# specific language governing permissions and limitations
# under the License.

import os
import inspect
import posixpath
import sys
import urllib.parse
import warnings

from os.path import join as pjoin

import pyarrow as pa
from pyarrow.util import implements, _stringify_path, _is_path_like, _DEPR_MSG

_FS_DEPR_MSG = _DEPR_MSG.format("filesystem.LocalFileSystem", "2.0.0",
                                "fs.LocalFileSystem")


class FileSystem:
    """
    Abstract filesystem interface.
    """
    def cat(self, path):
        """
        Return contents of file as a bytes object.

        Parameters
        ----------
        path : str
            File path to read content from.