code: def logistic_regression_gwas(
      genotypes: Union[Column, str],
      phenotypes: Union[Column, str],
      covariates: Union[Column, str],
      test: str,
      offset: Union[Column, str] = None,
  ) -> Column:
      """
      Performs a logistic regression association test optimized for performance in a GWAS setting. See :ref:`logistic-regression` for more details.
  
      Added in version 0.3.0.
  
      Examples:
          >>> from pyspark.ml.linalg import DenseMatrix
          >>> phenotypes = [1, 0, 0, 1, 1]
          >>> genotypes = [0, 0, 1, 2, 2]
          >>> covariates = DenseMatrix(numRows=5, numCols=1, values=[1, 1, 1, 1, 1])
          >>> offset = [1, 0, 1, 0, 1]
          >>> df = spark.createDataFrame([Row(genotypes=genotypes, phenotypes=phenotypes, covariates=covariates, offset=offset)])
          >>> df.select(glow.expand_struct(glow.logistic_regression_gwas('genotypes', 'phenotypes', 'covariates', 'Firth'))).collect()
          [Row(beta=0.7418937644793101, oddsRatio=2.09990848346903, waldConfidenceInterval=[0.2509874689201784, 17.569066925598555], pValue=0.3952193664793294)]
          >>> df.select(glow.expand_struct(glow.logistic_regression_gwas('genotypes', 'phenotypes', 'covariates', 'LRT'))).collect()
          [Row(beta=1.1658962684583645, oddsRatio=3.208797538802116, waldConfidenceInterval=[0.29709600522888285, 34.65674887513274], pValue=0.2943946848756769)]
          >>> df.select(glow.expand_struct(glow.logistic_regression_gwas('genotypes', 'phenotypes', 'covariates', 'Firth', 'offset'))).collect()
          [Row(beta=0.8024832156793392, oddsRatio=2.231074294047771, waldConfidenceInterval=[0.2540891981649045, 19.590334974925725], pValue=0.3754070658316332)]
          >>> df.select(glow.expand_struct(glow.logistic_regression_gwas('genotypes', 'phenotypes', 'covariates', 'LRT', 'offset'))).collect()
          [Row(beta=1.1996041727573317, oddsRatio=3.3188029900720117, waldConfidenceInterval=[0.3071189078535928, 35.863807161497334], pValue=0.2857137988674153)]
  
      Args:
          genotypes : An numeric array of genotypes
          phenotypes : A double array of phenotype values
          covariates : A ``spark.ml`` ``Matrix`` of covariates
          test : Which logistic regression test to use. Can be ``LRT`` or ``Firth``
          offset : An optional double array of offset values. The offset vector is added with coefficient 1 to the linear predictor term X*b.
  
      Returns:
          A struct containing ``beta``, ``oddsRatio``, ``waldConfidenceInterval``, and ``pValue`` fields. See :ref:`logistic-regression`.
      """
      assert check_argument_types()
      if offset is None:
          output = Column(
              sc()._jvm.io.projectglow.functions.logistic_regression_gwas(
                  _to_java_column(genotypes),
                  _to_java_column(phenotypes),
                  _to_java_column(covariates),
                  test,
              )
          )
      else:
          output = Column(
              sc()._jvm.io.projectglow.functions.logistic_regression_gwas(
                  _to_java_column(genotypes),
                  _to_java_column(phenotypes),
                  _to_java_column(covariates),
                  test,
                  _to_java_column(offset),
              )
          )
      assert check_return_type(output)
      return output
  
imports: from pyspark import SparkContext
  from pyspark.sql.column import Column, _to_java_column, _to_seq
  from typeguard import check_argument_types, check_return_type
  from typing import Union
label_desc: Use image node_id 22 for calling a global function with example usage: logistic_regression_gwas(genotypes, phenotypes, covariates, test, offset) and returns: output