title: Error writing dataframe in redshift using pyspark with boolean columns
body: <p>In my script the <code>write</code> method of <code>PySpark</code> takes a data frame and writes it a <code>Redshift</code>, however in some dataframes there are boolean columns that return error stating that <code>Redshift</code> does not accept bit data type.</p>
  <p>My question is because it says that what should be boolean is bit.</p>
  <p>The code:</p>
  <pre><code>spark = (
      SparkSession.builder.appName(&quot;data_quality&quot;)
      .config(&quot;fs.s3a.aws.credentials.provider&quot;, &quot;org.apache.hadoop.fs.s3a.TemporaryAWSCredentialsProvider&quot;)
      .config(&quot;spark.jars&quot;, &quot;redshift-jdbc42-2.1.0.3.jar&quot;)
      .config(&quot;spark.hadoop.fs.s3a.access.key&quot;, &quot;key&quot;)
      .config(&quot;spark.hadoop.fs.s3a.secret.key&quot;, &quot;secret_key&quot; )
      .config(&quot;spark.hadoop.fs.s3a.session.token&quot;,&quot;tokiem&quot;)
      .config(&quot;spark.hadoop.fs.s3a.impl&quot;, &quot;org.apache.hadoop.fs.s3a.S3AFileSystem&quot;)
      .getOrCreate()
  )
  
  df = spark.createDataFrame(
      [
          (1, False),  # create your data here, be consistent in the types.
          (2, True),
      ],
      [&quot;id&quot;, 'column_type_bool']  # add your column names here
  )
  df.show()
  df.dtypes
  
  df.write \
    .format(&quot;jdbc&quot;) \
    .option(&quot;url&quot;, f&quot;jdbc:redshift://{url_db}:5439/{db_name}&quot;) \
    .option(&quot;driver&quot;, &quot;com.amazon.redshift.jdbc42.Driver&quot;) \
    .option(&quot;dbtable&quot;, f&quot;{schema}.{tab}&quot;) \
    .option(&quot;user&quot;, user_db) \
    .option(&quot;password&quot;, pw) \
    .option(&quot;tempdir&quot;, &quot;s3a://path&quot;) \
    .mode(&quot;overwrite&quot;) \
    .save()
  </code></pre>
  <p>The Table:</p>
  <p>root
  |-- namecolumn: boolean (nullable = true)</p>
  <p>The error:</p>
  <pre><code>Py4JJavaError: An error occurred while calling o113.save.
  : com.amazon.redshift.util.RedshiftException: ERROR: Column &quot;nametable.namecolumn&quot; has unsupported type &quot;bit&quot;.
      at com.amazon.redshift.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2601)
      at com.amazon.redshift.core.v3.QueryExecutorImpl.processResultsOnThread(QueryExecutorImpl.java:2269)
      at com.amazon.redshift.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1880)
      at com.amazon.redshift.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1872)
      at com.amazon.redshift.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:368)
      at com.amazon.redshift.jdbc.RedshiftStatementImpl.executeInternal(RedshiftStatementImpl.java:514)
      at com.amazon.redshift.jdbc.RedshiftStatementImpl.execute(RedshiftStatementImpl.java:435)
      at com.amazon.redshift.jdbc.RedshiftStatementImpl.executeWithFlags(RedshiftStatementImpl.java:376)
      at com.amazon.redshift.jdbc.RedshiftStatementImpl.executeCachedSql(RedshiftStatementImpl.java:362)
      at com.amazon.redshift.jdbc.RedshiftStatementImpl.executeWithFlags(RedshiftStatementImpl.java:339)
      at com.amazon.redshift.jdbc.RedshiftStatementImpl.executeUpdate(RedshiftStatementImpl.java:297)
      at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$.executeStatement(JdbcUtils.scala:1026)
      at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$.createTable(JdbcUtils.scala:912)
      at org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:80)
  </code></pre>