1 Reply Latest reply on Aug 30, 2018 3:42 PM by Patrick Van Der Hyde

    char string converted to unicode string in extract API java

    Prathamesh Gade

      I running the sample code shared by tableau in Extract API example.


      Following columns are created in the example:

                      schema.addColumn( "Purchased",       Type.DATETIME );

                      schema.addColumn( "Product",         Type.CHAR_STRING );

                      schema.addColumn( "uProduct",        Type.UNICODE_STRING );

                      schema.addColumn( "Price",           Type.DOUBLE );

                      schema.addColumn( "Quantity",        Type.INTEGER );

                      schema.addColumn( "Taxed",           Type.BOOLEAN );

                      schema.addColumn( "Expiration Date", Type.DATE );

                      schema.addColumnWithCollation( "Produkt", Type.CHAR_STRING, Collation.DE );

                      if ( useSpatial ) {

                          schema.addColumn( "Destination", Type.SPATIAL );



      After successful execution of this code once, when we try to read the data types of the columns, the CHAR_STRING columns are returned as UNICODE_STRING.


      Code to print types of columns:

      table = extract.openTable("Extract");

                  TableDefinition schema = table.getTableDefinition();

                  for(int i=0; i<schema.getColumnCount(); i++) {

                  System.out.println(schema.getColumnName(i) + " - " + schema.getColumnType(i).name());




      Purchased - DATETIME

      Product - UNICODE_STRING

      uProduct - UNICODE_STRING

      Price - DOUBLE

      Quantity - INTEGER

      Taxed - BOOLEAN

      Expiration Date - DATE

      Produkt - UNICODE_STRING

      Destination - SPATIAL



      Can someone suggest how can I retain CHAR_STRING columns in my Extract.


      This conversion of Data type by the API is causing my APPEND operation to fail as I am checking the column names and their types before starting the operation.

      I can add a check such that char_string and unicode_string are considered same by the code but this doesn't seem right.