<commit_before>HDFS
====

Into interacts with the Hadoop File System using WebHDFS and the ``pywebhdfs``
Python lirary.

URIs
----

HDFS uris consist of the ``hdfs://`` protocol, a hostname, and a filename.
Simple and complex examples follow::

    hdfs://hostname:myfile.csv
    hdfs://username@hostname:/path/to/myfile.csv

Alternatively you may want to pass authentication information through keyword
arguments to the into function as in the following example

.. code-block:: python

   >>> into('hfds://hostname:myfile.csv', 'localfile.csv',
   ...      port=14000, user='hdfs')

We pass through authentication keyword arguments to the
``pywebhdfs.webhdfs.PyWebHdfsClient`` class.


Constructing HDFS Objects explicitly
------------------------------------

Most users usually interact with into using URI strings.

Alternatively you can construct objects programmatically.  HDFS uses the
``HDFS`` type modifier

.. code-block:: python

   >>> auth = {'user': 'hdfs', 'port': 14000, 'host': 'hostname'}
   >>> data = HDFS(CSV)('/user/hdfs/data/accounts.csv', **auth)
   >>> data = HDFS(JSONLines)('/user/hdfs/data/accounts.json', **auth)
   >>> data = HDFS(Directory(CSV))('/user/hdfs/data/', **auth)

Conversions
-----------

We can convert any text type (``CSV, JSON, JSONLines, TextFile``) to its
equivalent on HDFS (``HDFS(CSV), HDFS(JSON), ...``).  The ``into`` network
allows conversions from other types, like a pandas dataframe to a CSV file on
HDFS, by routing through a temporary local csv file.::

    HDFS(*) <-> *

Additionally we know how to load HDFS files into the Hive metastore::

    HDFS(*) -> Hive

The network also allows conversions from other types, like a pandas
``DataFrame`` to an HDFS CSV file, by routing through a temporary local csv<commit_msg>specify hdfs hive<commit_after>HDFS
====

Into interacts with the Hadoop File System using WebHDFS and the ``pywebhdfs``
Python lirary.

URIs
----

HDFS uris consist of the ``hdfs://`` protocol, a hostname, and a filename.
Simple and complex examples follow::

    hdfs://hostname:myfile.csv
    hdfs://username@hostname:/path/to/myfile.csv

Alternatively you may want to pass authentication information through keyword
arguments to the into function as in the following example

.. code-block:: python

   >>> into('hfds://hostname:myfile.csv', 'localfile.csv',
   ...      port=14000, user='hdfs')

We pass through authentication keyword arguments to the
``pywebhdfs.webhdfs.PyWebHdfsClient`` class.


Constructing HDFS Objects explicitly
------------------------------------

Most users usually interact with into using URI strings.

Alternatively you can construct objects programmatically.  HDFS uses the
``HDFS`` type modifier

.. code-block:: python

   >>> auth = {'user': 'hdfs', 'port': 14000, 'host': 'hostname'}
   >>> data = HDFS(CSV)('/user/hdfs/data/accounts.csv', **auth)
   >>> data = HDFS(JSONLines)('/user/hdfs/data/accounts.json', **auth)
   >>> data = HDFS(Directory(CSV))('/user/hdfs/data/', **auth)

Conversions
-----------

We can convert any text type (``CSV, JSON, JSONLines, TextFile``) to its
equivalent on HDFS (``HDFS(CSV), HDFS(JSON), ...``).  The ``into`` network
allows conversions from other types, like a pandas dataframe to a CSV file on
HDFS, by routing through a temporary local csv file.::

    HDFS(*) <-> *

Additionally we know how to load HDFS files into the Hive metastore::

    HDFS(Directory(CSV)) -> Hive

The network also allows conversions from other types, like a pandas
``DataFrame`` to an HDFS CSV file, by routing through a temporary local csv
{'fraction_non_alphanumeric': 0.14956667598546267, 'fraction_numerical': 0.005591277606933185, 'mean_word_length': 3.689384010484928, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7618429', 'n_tokens_mistral': 1151, 'n_tokens_neox': 1046, 'n_words': 395}