code: def _resolve_lightning_path_queries(
      path: LightningPathInput, dataset: fo.Dataset, info: Info
  ) -> t.Tuple[
      AsyncIOMotorCollection,
      t.Union[DistinctQuery, t.List[t.Dict]],
      t.Callable,
  ]:
      field_path = path.path
      field = dataset.get_field(field_path)
      collection = dataset._sample_collection_name
      is_frame_field = bool(dataset._is_frame_field(field_path))
      if is_frame_field:
          field_path = field_path[len(dataset._FRAMES_PREFIX) :]
          collection = dataset._frame_collection_name
  
      collection = info.context.db[collection]
  
      while isinstance(field, fof.ListField):
          field = field.field
  
      if not isinstance(field, fof.StringField) and (
          path.exclude or path.search
      ):
          raise ValueError(
              "'excluded' and 'search' are not valid for f{fof.StringField}"
          )
  
      if meets_type(field, fof.BooleanField):
          queries = [
              _match(field_path, False),
              _match(field_path, True),
          ]
  
          def _resolve_bool(results):
              false, true = results
              return BooleanLightningResult(
                  path=path.path, false=bool(false), true=bool(true)
              )
  
          return collection, queries, _resolve_bool
  
      if meets_type(
          field, (fof.DateField, fof.DateTimeField, fof.IntField)
      ):
          queries = [
              _first(field_path, dataset, 1, is_frame_field),
              _first(field_path, dataset, -1, is_frame_field),
          ]
  
          def _resolve_int(results):
              min, max = results
              return INT_CLS[field.__class__](
                  path=path.path,
                  max=_parse_result(max),
                  min=_parse_result(min),
              )
  
          return collection, queries, _resolve_int
  
      if meets_type(field, fof.FloatField):
          queries = [
              _first(field_path, dataset, 1, is_frame_field),
              _first(field_path, dataset, -1, is_frame_field),
          ] + [
              _match(field_path, v)
              for v in (float("-inf"), float("inf"), float("nan"))
          ]
  
          def _resolve_float(results):
              min, max, ninf, inf, nan = results
  
              inf = bool(inf)
              nan = bool(nan)
              ninf = bool(ninf)
  
              has_bounds = not inf and not ninf
  
              return FloatLightningResult(
                  path=path.path,
                  max=_parse_result(max, has_bounds),
                  min=_parse_result(min, has_bounds),
                  ninf=ninf,
                  inf=inf,
                  nan=nan,
              )
  
          return collection, queries, _resolve_float
  
      if meets_type(field, fof.StringField):
  
          def _resolve_string(results):
              return StringLightningResult(
                  path=path.path, values=results[0]
              )
  
          d = asdict(path)
          d["path"] = field_path
          d["has_list"] = _has_list(dataset, field_path, is_frame_field)
          return (
              collection,
              [DistinctQuery(**d)],
              _resolve_string,
          )
  
      raise ValueError(
          f"cannot resolve {path.path}: {field} is not supported"
      )
  
imports: from dataclasses import asdict, dataclass
  from datetime import date, datetime
  import math
  import typing
  import asyncio
  from bson.regex import Regex
  from motor.motor_asyncio import AsyncIOMotorCollection
  import strawberry
  import fiftyone
  import fiftyone.core.fields
  import fiftyone.server.constants
  from fiftyone.server.data import Info
  from fiftyone.server.utils import meets_type
label_desc: Use image node_id 1 for calling a global function with example usage: _resolve_lightning_path_queries(path, dataset, info) and returns: collection,  queries,  _resolve_bool, collection,  queries,  _resolve_int, collection,  queries,  _resolve_float, collection,  list,  _resolve_string, BooleanLightningResult, INT_CLS, FloatLightningResult, StringLightningResult