{
  "$schema": "/products/haybarn/functions/api/v1/function.schema.json",
  "schemaVersion": 1,
  "name": "bit_and",
  "schema": "main",
  "slug": "bit_and",
  "description": "Returns the bitwise AND of all bits in a given expression.",
  "category": "aggregate",
  "kinds": [
    "aggregate"
  ],
  "aliasOf": [],
  "snapshot": {
    "schemaVersion": 1,
    "id": "duckdb-1.5.6",
    "engine": "duckdb",
    "label": "DuckDB 1.5.6",
    "engineVersion": "v1.5.6",
    "sourceId": "069cc9f9b5",
    "source": "https://github.com/duckdb/duckdb/releases/tag/v1.5.6",
    "binarySha256": "2c75d4758c9d74cb0f4642f4e8d3c1a13e8a888a1e475fffd90934ad5ae3dd17",
    "capturedAt": "2026-10-15T15:04:49.978Z",
    "requestedExtensions": [
      "core_functions",
      "icu",
      "json",
      "parquet"
    ],
    "loadedExtensions": [
      {
        "extension_name": "autocomplete",
        "extension_version": "v1.5.6",
        "installed_from": ""
      },
      {
        "extension_name": "core_functions",
        "extension_version": "v1.5.6",
        "installed_from": "core"
      },
      {
        "extension_name": "icu",
        "extension_version": "v1.5.6",
        "installed_from": "core"
      },
      {
        "extension_name": "json",
        "extension_version": "v1.5.6",
        "installed_from": "core"
      },
      {
        "extension_name": "parquet",
        "extension_version": "v1.5.6",
        "installed_from": "core"
      },
      {
        "extension_name": "shell",
        "extension_version": "v1.5.6",
        "installed_from": ""
      }
    ],
    "scope": "Built-in functions in the main schema, with the requested extensions loaded. Catalog visibility is not a guarantee of browser support."
  },
  "links": {
    "html": "/products/haybarn/functions/releases/duckdb-1.5.6/bit_and/",
    "markdown": "/products/haybarn/functions/releases/duckdb-1.5.6/bit_and/index.md",
    "json": "/products/haybarn/functions/api/v1/duckdb-1.5.6/functions/bit_and.json"
  },
  "interpretation": [
    "Choose a snapshot matching the target engine and build. The default is captured from the published Haybarn WASM package used by the browser playground. Historical native snapshots are also available.",
    "Availability is an observation in the recorded build and extension profile, not a guarantee of support in every installation or in WASM.",
    "Types and descriptions are declarations from duckdb_functions(). Binding can specialize result types. Null means not supplied by the catalog; do not invent defaults, optionality, argument mode, or table output columns.",
    "Raw parameter arrays preserve catalog order for scalar/aggregate/macro functions. Raw table arguments are alphabetical. Use callingConvention for engine-confirmed positional order and named arguments; null modes are unrecorded. Named does not mean optional. Macro defaults and special named variadic behavior are not supplied by duckdb_functions().",
    "Catalog examples are source material and may require data or extensions. runnableExamples contains separately verified SQL for the pinned WASM package; sample-data adaptations and guide examples are labeled separately.",
    "Guide annotations and recipes are separate editorial content. The browser runner always uses Haybarn WASM 1.5.6-rc6, independently of the documentation snapshot.",
    "All URLs beginning with / are relative to the origin hosting this document. Exports require no JavaScript, cookies, API key, or browser engine."
  ],
  "overloads": [
    {
      "id": "overload-54911995486aa0a8",
      "url": "/products/haybarn/functions/releases/duckdb-1.5.6/bit_and/#overload-54911995486aa0a8",
      "signature": "bit_and(arg: BIGINT) → BIGINT",
      "parameterOrder": "catalog-order",
      "callingConvention": {
        "source": null,
        "parameters": [
          {
            "name": "arg",
            "type": "BIGINT",
            "mode": null,
            "position": null
          }
        ],
        "positional": null,
        "named": null,
        "variadic": null,
        "evidence": null
      },
      "syntax": {
        "kind": "function",
        "operator": null
      },
      "catalog": {
        "schema_name": "main",
        "function_name": "bit_and",
        "function_type": "aggregate",
        "description": "Returns the bitwise AND of all bits in a given expression.",
        "comment": null,
        "return_type": "BIGINT",
        "parameters": [
          "arg"
        ],
        "parameter_types": [
          "BIGINT"
        ],
        "varargs": null,
        "macro_definition": null,
        "has_side_effects": false,
        "internal": true,
        "examples": [
          "bit_and(A)"
        ],
        "stability": "CONSISTENT",
        "categories": [],
        "alias_of": null
      }
    },
    {
      "id": "overload-403e8536a9d4af90",
      "url": "/products/haybarn/functions/releases/duckdb-1.5.6/bit_and/#overload-403e8536a9d4af90",
      "signature": "bit_and(arg: BIT) → BIT",
      "parameterOrder": "catalog-order",
      "callingConvention": {
        "source": null,
        "parameters": [
          {
            "name": "arg",
            "type": "BIT",
            "mode": null,
            "position": null
          }
        ],
        "positional": null,
        "named": null,
        "variadic": null,
        "evidence": null
      },
      "syntax": {
        "kind": "function",
        "operator": null
      },
      "catalog": {
        "schema_name": "main",
        "function_name": "bit_and",
        "function_type": "aggregate",
        "description": "Returns the bitwise AND of all bits in a given expression.",
        "comment": null,
        "return_type": "BIT",
        "parameters": [
          "arg"
        ],
        "parameter_types": [
          "BIT"
        ],
        "varargs": null,
        "macro_definition": null,
        "has_side_effects": false,
        "internal": true,
        "examples": [
          "bit_and(A)"
        ],
        "stability": "CONSISTENT",
        "categories": [],
        "alias_of": null
      }
    },
    {
      "id": "overload-579ac3ba9bdd1c67",
      "url": "/products/haybarn/functions/releases/duckdb-1.5.6/bit_and/#overload-579ac3ba9bdd1c67",
      "signature": "bit_and(arg: HUGEINT) → HUGEINT",
      "parameterOrder": "catalog-order",
      "callingConvention": {
        "source": null,
        "parameters": [
          {
            "name": "arg",
            "type": "HUGEINT",
            "mode": null,
            "position": null
          }
        ],
        "positional": null,
        "named": null,
        "variadic": null,
        "evidence": null
      },
      "syntax": {
        "kind": "function",
        "operator": null
      },
      "catalog": {
        "schema_name": "main",
        "function_name": "bit_and",
        "function_type": "aggregate",
        "description": "Returns the bitwise AND of all bits in a given expression.",
        "comment": null,
        "return_type": "HUGEINT",
        "parameters": [
          "arg"
        ],
        "parameter_types": [
          "HUGEINT"
        ],
        "varargs": null,
        "macro_definition": null,
        "has_side_effects": false,
        "internal": true,
        "examples": [
          "bit_and(A)"
        ],
        "stability": "CONSISTENT",
        "categories": [],
        "alias_of": null
      }
    },
    {
      "id": "overload-ec3c3ab5495b0770",
      "url": "/products/haybarn/functions/releases/duckdb-1.5.6/bit_and/#overload-ec3c3ab5495b0770",
      "signature": "bit_and(arg: INTEGER) → INTEGER",
      "parameterOrder": "catalog-order",
      "callingConvention": {
        "source": null,
        "parameters": [
          {
            "name": "arg",
            "type": "INTEGER",
            "mode": null,
            "position": null
          }
        ],
        "positional": null,
        "named": null,
        "variadic": null,
        "evidence": null
      },
      "syntax": {
        "kind": "function",
        "operator": null
      },
      "catalog": {
        "schema_name": "main",
        "function_name": "bit_and",
        "function_type": "aggregate",
        "description": "Returns the bitwise AND of all bits in a given expression.",
        "comment": null,
        "return_type": "INTEGER",
        "parameters": [
          "arg"
        ],
        "parameter_types": [
          "INTEGER"
        ],
        "varargs": null,
        "macro_definition": null,
        "has_side_effects": false,
        "internal": true,
        "examples": [
          "bit_and(A)"
        ],
        "stability": "CONSISTENT",
        "categories": [],
        "alias_of": null
      }
    },
    {
      "id": "overload-cb5fb6690b581f3f",
      "url": "/products/haybarn/functions/releases/duckdb-1.5.6/bit_and/#overload-cb5fb6690b581f3f",
      "signature": "bit_and(arg: SMALLINT) → SMALLINT",
      "parameterOrder": "catalog-order",
      "callingConvention": {
        "source": null,
        "parameters": [
          {
            "name": "arg",
            "type": "SMALLINT",
            "mode": null,
            "position": null
          }
        ],
        "positional": null,
        "named": null,
        "variadic": null,
        "evidence": null
      },
      "syntax": {
        "kind": "function",
        "operator": null
      },
      "catalog": {
        "schema_name": "main",
        "function_name": "bit_and",
        "function_type": "aggregate",
        "description": "Returns the bitwise AND of all bits in a given expression.",
        "comment": null,
        "return_type": "SMALLINT",
        "parameters": [
          "arg"
        ],
        "parameter_types": [
          "SMALLINT"
        ],
        "varargs": null,
        "macro_definition": null,
        "has_side_effects": false,
        "internal": true,
        "examples": [
          "bit_and(A)"
        ],
        "stability": "CONSISTENT",
        "categories": [],
        "alias_of": null
      }
    },
    {
      "id": "overload-903da97a7bec29af",
      "url": "/products/haybarn/functions/releases/duckdb-1.5.6/bit_and/#overload-903da97a7bec29af",
      "signature": "bit_and(arg: TINYINT) → TINYINT",
      "parameterOrder": "catalog-order",
      "callingConvention": {
        "source": null,
        "parameters": [
          {
            "name": "arg",
            "type": "TINYINT",
            "mode": null,
            "position": null
          }
        ],
        "positional": null,
        "named": null,
        "variadic": null,
        "evidence": null
      },
      "syntax": {
        "kind": "function",
        "operator": null
      },
      "catalog": {
        "schema_name": "main",
        "function_name": "bit_and",
        "function_type": "aggregate",
        "description": "Returns the bitwise AND of all bits in a given expression.",
        "comment": null,
        "return_type": "TINYINT",
        "parameters": [
          "arg"
        ],
        "parameter_types": [
          "TINYINT"
        ],
        "varargs": null,
        "macro_definition": null,
        "has_side_effects": false,
        "internal": true,
        "examples": [
          "bit_and(A)"
        ],
        "stability": "CONSISTENT",
        "categories": [],
        "alias_of": null
      }
    },
    {
      "id": "overload-05efeb2c0896d6dc",
      "url": "/products/haybarn/functions/releases/duckdb-1.5.6/bit_and/#overload-05efeb2c0896d6dc",
      "signature": "bit_and(arg: UBIGINT) → UBIGINT",
      "parameterOrder": "catalog-order",
      "callingConvention": {
        "source": null,
        "parameters": [
          {
            "name": "arg",
            "type": "UBIGINT",
            "mode": null,
            "position": null
          }
        ],
        "positional": null,
        "named": null,
        "variadic": null,
        "evidence": null
      },
      "syntax": {
        "kind": "function",
        "operator": null
      },
      "catalog": {
        "schema_name": "main",
        "function_name": "bit_and",
        "function_type": "aggregate",
        "description": "Returns the bitwise AND of all bits in a given expression.",
        "comment": null,
        "return_type": "UBIGINT",
        "parameters": [
          "arg"
        ],
        "parameter_types": [
          "UBIGINT"
        ],
        "varargs": null,
        "macro_definition": null,
        "has_side_effects": false,
        "internal": true,
        "examples": [
          "bit_and(A)"
        ],
        "stability": "CONSISTENT",
        "categories": [],
        "alias_of": null
      }
    },
    {
      "id": "overload-ef96bf86973e2336",
      "url": "/products/haybarn/functions/releases/duckdb-1.5.6/bit_and/#overload-ef96bf86973e2336",
      "signature": "bit_and(arg: UHUGEINT) → UHUGEINT",
      "parameterOrder": "catalog-order",
      "callingConvention": {
        "source": null,
        "parameters": [
          {
            "name": "arg",
            "type": "UHUGEINT",
            "mode": null,
            "position": null
          }
        ],
        "positional": null,
        "named": null,
        "variadic": null,
        "evidence": null
      },
      "syntax": {
        "kind": "function",
        "operator": null
      },
      "catalog": {
        "schema_name": "main",
        "function_name": "bit_and",
        "function_type": "aggregate",
        "description": "Returns the bitwise AND of all bits in a given expression.",
        "comment": null,
        "return_type": "UHUGEINT",
        "parameters": [
          "arg"
        ],
        "parameter_types": [
          "UHUGEINT"
        ],
        "varargs": null,
        "macro_definition": null,
        "has_side_effects": false,
        "internal": true,
        "examples": [
          "bit_and(A)"
        ],
        "stability": "CONSISTENT",
        "categories": [],
        "alias_of": null
      }
    },
    {
      "id": "overload-045d293faf78f78b",
      "url": "/products/haybarn/functions/releases/duckdb-1.5.6/bit_and/#overload-045d293faf78f78b",
      "signature": "bit_and(arg: UINTEGER) → UINTEGER",
      "parameterOrder": "catalog-order",
      "callingConvention": {
        "source": null,
        "parameters": [
          {
            "name": "arg",
            "type": "UINTEGER",
            "mode": null,
            "position": null
          }
        ],
        "positional": null,
        "named": null,
        "variadic": null,
        "evidence": null
      },
      "syntax": {
        "kind": "function",
        "operator": null
      },
      "catalog": {
        "schema_name": "main",
        "function_name": "bit_and",
        "function_type": "aggregate",
        "description": "Returns the bitwise AND of all bits in a given expression.",
        "comment": null,
        "return_type": "UINTEGER",
        "parameters": [
          "arg"
        ],
        "parameter_types": [
          "UINTEGER"
        ],
        "varargs": null,
        "macro_definition": null,
        "has_side_effects": false,
        "internal": true,
        "examples": [
          "bit_and(A)"
        ],
        "stability": "CONSISTENT",
        "categories": [],
        "alias_of": null
      }
    },
    {
      "id": "overload-e6df21512255dd3c",
      "url": "/products/haybarn/functions/releases/duckdb-1.5.6/bit_and/#overload-e6df21512255dd3c",
      "signature": "bit_and(arg: USMALLINT) → USMALLINT",
      "parameterOrder": "catalog-order",
      "callingConvention": {
        "source": null,
        "parameters": [
          {
            "name": "arg",
            "type": "USMALLINT",
            "mode": null,
            "position": null
          }
        ],
        "positional": null,
        "named": null,
        "variadic": null,
        "evidence": null
      },
      "syntax": {
        "kind": "function",
        "operator": null
      },
      "catalog": {
        "schema_name": "main",
        "function_name": "bit_and",
        "function_type": "aggregate",
        "description": "Returns the bitwise AND of all bits in a given expression.",
        "comment": null,
        "return_type": "USMALLINT",
        "parameters": [
          "arg"
        ],
        "parameter_types": [
          "USMALLINT"
        ],
        "varargs": null,
        "macro_definition": null,
        "has_side_effects": false,
        "internal": true,
        "examples": [
          "bit_and(A)"
        ],
        "stability": "CONSISTENT",
        "categories": [],
        "alias_of": null
      }
    },
    {
      "id": "overload-f4c7bc686ff0c842",
      "url": "/products/haybarn/functions/releases/duckdb-1.5.6/bit_and/#overload-f4c7bc686ff0c842",
      "signature": "bit_and(arg: UTINYINT) → UTINYINT",
      "parameterOrder": "catalog-order",
      "callingConvention": {
        "source": null,
        "parameters": [
          {
            "name": "arg",
            "type": "UTINYINT",
            "mode": null,
            "position": null
          }
        ],
        "positional": null,
        "named": null,
        "variadic": null,
        "evidence": null
      },
      "syntax": {
        "kind": "function",
        "operator": null
      },
      "catalog": {
        "schema_name": "main",
        "function_name": "bit_and",
        "function_type": "aggregate",
        "description": "Returns the bitwise AND of all bits in a given expression.",
        "comment": null,
        "return_type": "UTINYINT",
        "parameters": [
          "arg"
        ],
        "parameter_types": [
          "UTINYINT"
        ],
        "varargs": null,
        "macro_definition": null,
        "has_side_effects": false,
        "internal": true,
        "examples": [
          "bit_and(A)"
        ],
        "stability": "CONSISTENT",
        "categories": [],
        "alias_of": null
      }
    }
  ],
  "editorial": {
    "argumentNotes": [],
    "recipes": []
  },
  "examples": [
    {
      "original": "bit_and(A)",
      "sql": "SELECT bit_and(A);",
      "overloadIds": [
        "overload-54911995486aa0a8",
        "overload-403e8536a9d4af90",
        "overload-579ac3ba9bdd1c67",
        "overload-ec3c3ab5495b0770",
        "overload-cb5fb6690b581f3f",
        "overload-903da97a7bec29af",
        "overload-05efeb2c0896d6dc",
        "overload-ef96bf86973e2336",
        "overload-045d293faf78f78b",
        "overload-e6df21512255dd3c",
        "overload-f4c7bc686ff0c842"
      ],
      "source": "engine-catalog",
      "verification": null
    }
  ],
  "translations": [
    {
      "function": "bit_and",
      "scope": "",
      "relation": "direct",
      "source": {
        "engine": "BigQuery",
        "dialect": "bigquery",
        "name": "bit_and",
        "names": [
          "bit_and"
        ],
        "sql": "BIT_AND(x)"
      },
      "target": {
        "dialect": "duckdb",
        "name": "bit_and",
        "sql": "BIT_AND(x)"
      },
      "formatTokens": [],
      "executionVerified": false,
      "provenance": {
        "name": "SQLGlot",
        "commit": "3086608e6fd4c41c02dfba47171608d2b193fce2",
        "url": "https://github.com/tobymao/sqlglot/blob/3086608e6fd4c41c02dfba47171608d2b193fce2/tests/dialects/test_bigquery.py#L3957"
      }
    },
    {
      "function": "bit_and",
      "scope": "",
      "relation": "direct",
      "source": {
        "engine": "Snowflake",
        "dialect": "snowflake",
        "name": "bitand_agg",
        "names": [
          "bitand_agg"
        ],
        "sql": "SELECT BITAND_AGG(int_value) FROM t"
      },
      "target": {
        "dialect": "duckdb",
        "name": "bit_and",
        "sql": "SELECT BIT_AND(int_value) FROM t"
      },
      "formatTokens": [],
      "executionVerified": false,
      "provenance": {
        "name": "SQLGlot",
        "commit": "3086608e6fd4c41c02dfba47171608d2b193fce2",
        "url": "https://github.com/tobymao/sqlglot/blob/3086608e6fd4c41c02dfba47171608d2b193fce2/tests/dialects/test_duckdb.py#L2745"
      }
    }
  ],
  "runnableExamples": [
    {
      "function": "bit_and",
      "original": "bit_and(A)",
      "sql": "SELECT bit_and(A)\nFROM (VALUES\n  (10),\n  (20),\n  (NULL)\n) AS sample(\"A\");",
      "source": "catalog-with-sample-data",
      "verification": {
        "engine": "haybarn-wasm",
        "packageVersion": "1.5.6-rc6",
        "sourceId": "5b8b06dfbc",
        "binarySha256": "13bf09c19dd0f6b8748c0d3d5f0e0627679bae8b16befa728d8a1058ff0c85c9",
        "rowCount": 1
      }
    }
  ],
  "additionalDocumentation": [
    {
      "title": "Aggregate Functions",
      "url": "https://duckdb.org/docs/current/sql/functions/aggregates#bit_andarg"
    },
    {
      "title": "Bitstring Functions",
      "url": "https://duckdb.org/docs/current/sql/functions/bitstring#bit_andarg"
    }
  ],
  "availability": [
    {
      "snapshot": "haybarn-1.5.6-rc6",
      "observed": true,
      "overloadCount": 11,
      "matchingOverloadIds": [
        "overload-54911995486aa0a8",
        "overload-403e8536a9d4af90",
        "overload-579ac3ba9bdd1c67",
        "overload-ec3c3ab5495b0770",
        "overload-cb5fb6690b581f3f",
        "overload-903da97a7bec29af",
        "overload-05efeb2c0896d6dc",
        "overload-ef96bf86973e2336",
        "overload-045d293faf78f78b",
        "overload-e6df21512255dd3c",
        "overload-f4c7bc686ff0c842"
      ],
      "json": "/products/haybarn/functions/api/v1/haybarn-1.5.6-rc6/functions/bit_and.json"
    },
    {
      "snapshot": "haybarn-1.5.5-rc3",
      "observed": true,
      "overloadCount": 11,
      "matchingOverloadIds": [
        "overload-54911995486aa0a8",
        "overload-403e8536a9d4af90",
        "overload-579ac3ba9bdd1c67",
        "overload-ec3c3ab5495b0770",
        "overload-cb5fb6690b581f3f",
        "overload-903da97a7bec29af",
        "overload-05efeb2c0896d6dc",
        "overload-ef96bf86973e2336",
        "overload-045d293faf78f78b",
        "overload-e6df21512255dd3c",
        "overload-f4c7bc686ff0c842"
      ],
      "json": "/products/haybarn/functions/api/v1/haybarn-1.5.5-rc3/functions/bit_and.json"
    },
    {
      "snapshot": "duckdb-1.5.6",
      "observed": true,
      "overloadCount": 11,
      "matchingOverloadIds": [
        "overload-54911995486aa0a8",
        "overload-403e8536a9d4af90",
        "overload-579ac3ba9bdd1c67",
        "overload-ec3c3ab5495b0770",
        "overload-cb5fb6690b581f3f",
        "overload-903da97a7bec29af",
        "overload-05efeb2c0896d6dc",
        "overload-ef96bf86973e2336",
        "overload-045d293faf78f78b",
        "overload-e6df21512255dd3c",
        "overload-f4c7bc686ff0c842"
      ],
      "json": "/products/haybarn/functions/api/v1/duckdb-1.5.6/functions/bit_and.json"
    },
    {
      "snapshot": "duckdb-1.5.5",
      "observed": true,
      "overloadCount": 11,
      "matchingOverloadIds": [
        "overload-54911995486aa0a8",
        "overload-403e8536a9d4af90",
        "overload-579ac3ba9bdd1c67",
        "overload-ec3c3ab5495b0770",
        "overload-cb5fb6690b581f3f",
        "overload-903da97a7bec29af",
        "overload-05efeb2c0896d6dc",
        "overload-ef96bf86973e2336",
        "overload-045d293faf78f78b",
        "overload-e6df21512255dd3c",
        "overload-f4c7bc686ff0c842"
      ],
      "json": "/products/haybarn/functions/api/v1/duckdb-1.5.5/functions/bit_and.json"
    },
    {
      "snapshot": "duckdb-1.4.4",
      "observed": true,
      "overloadCount": 11,
      "matchingOverloadIds": [
        "overload-54911995486aa0a8",
        "overload-403e8536a9d4af90",
        "overload-579ac3ba9bdd1c67",
        "overload-ec3c3ab5495b0770",
        "overload-cb5fb6690b581f3f",
        "overload-903da97a7bec29af",
        "overload-05efeb2c0896d6dc",
        "overload-ef96bf86973e2336",
        "overload-045d293faf78f78b",
        "overload-e6df21512255dd3c",
        "overload-f4c7bc686ff0c842"
      ],
      "json": "/products/haybarn/functions/api/v1/duckdb-1.4.4/functions/bit_and.json"
    },
    {
      "snapshot": "duckdb-1.3.2",
      "observed": true,
      "overloadCount": 11,
      "matchingOverloadIds": [
        "overload-54911995486aa0a8",
        "overload-403e8536a9d4af90",
        "overload-579ac3ba9bdd1c67",
        "overload-ec3c3ab5495b0770",
        "overload-cb5fb6690b581f3f",
        "overload-903da97a7bec29af",
        "overload-05efeb2c0896d6dc",
        "overload-ef96bf86973e2336",
        "overload-045d293faf78f78b",
        "overload-e6df21512255dd3c",
        "overload-f4c7bc686ff0c842"
      ],
      "json": "/products/haybarn/functions/api/v1/duckdb-1.3.2/functions/bit_and.json"
    }
  ]
}
