<commit_before>.. _ref_eql_funcops_bytes:

=====
Bytes
=====

:edb-alt-title: Bytes Functions and Operators


.. list-table::
    :class: funcoptable

    * - :eql:op:`bytes[i] <BYTESIDX>`
      - :eql:op-desc:`BYTESIDX`

    * - :eql:op:`bytes[from:to] <BYTESSLICE>`
      - :eql:op-desc:`BYTESSLICE`

    * - :eql:op:`bytes ++ bytes <BYTEPLUS>`
      - :eql:op-desc:`BYTEPLUS`

    * - :eql:func:`bytes_get_bit`
      - :eql:func-desc:`bytes_get_bit`


----------


.. eql:operator:: BYTESIDX: bytes [ int64 ] -> bytes

    Bytes indexing.

    Examples:

    .. code-block:: edgeql-repl

        db> SELECT b'\x01\x02\x03\x04 world!'[1];
        {b'\x02'}


----------


.. eql:operator:: BYTESSLICE: bytes [ int64 : int64 ] -> bytes

    Bytes slicing.

    Examples:

    .. code-block:: edgeql-repl

        db> SELECT b'\x01\x02\x03\x04 world!'[1:-1];
        {b'\x02\x03\x04 world'}
        db> SELECT b'some bytes'[2:-3];
        {b'me by'}


---------


.. eql:operator:: BYTEPLUS: A ++ B

    :optype A: bytes
    :optype B: bytes
    :resulttype: bytes

    Bytes concatenation.

    .. code-block:: edgeql-repl

        db> SELECT b'\x01\x02' ++ b'\x03\x04';
        {b'\x01\x02\x03\x04'}

<commit_msg>docs: Fix JSON ++ operator<commit_after>.. _ref_eql_funcops_bytes:

=====
Bytes
=====

:edb-alt-title: Bytes Functions and Operators


.. list-table::
    :class: funcoptable

    * - :eql:op:`bytes[i] <BYTESIDX>`
      - :eql:op-desc:`BYTESIDX`

    * - :eql:op:`bytes[from:to] <BYTESSLICE>`
      - :eql:op-desc:`BYTESSLICE`

    * - :eql:op:`bytes ++ bytes <BYTEPLUS>`
      - :eql:op-desc:`BYTEPLUS`

    * - :eql:func:`bytes_get_bit`
      - :eql:func-desc:`bytes_get_bit`


----------


.. eql:operator:: BYTESIDX: bytes [ int64 ] -> bytes

    Bytes indexing.

    Examples:

    .. code-block:: edgeql-repl

        db> SELECT b'\x01\x02\x03\x04 world!'[1];
        {b'\x02'}


----------


.. eql:operator:: BYTESSLICE: bytes [ int64 : int64 ] -> bytes

    Bytes slicing.

    Examples:

    .. code-block:: edgeql-repl

        db> SELECT b'\x01\x02\x03\x04 world!'[1:-1];
        {b'\x02\x03\x04 world'}
        db> SELECT b'some bytes'[2:-3];
        {b'me by'}


---------


.. eql:operator:: BYTEPLUS: bytes ++ bytes -> bytes

    :optype A: bytes
    :optype B: bytes
    :resulttype: bytes

    Bytes concatenation.

    .. code-block:: edgeql-repl

        db> SELECT b'\x01\x02' ++ b'\x03\x04';
        {b'\x01\x02\x03\x04'}


{'fraction_non_alphanumeric': 0.20609756097560974, 'fraction_numerical': 0.041463414634146344, 'mean_word_length': 2.091708542713568, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 22, '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': '1336230', 'n_tokens_mistral': 1096, 'n_tokens_neox': 982, 'n_words': 168}