2 Replies Latest reply on Oct 24, 2018 11:00 PM by Fima Leshinsky

    CountD Broken?

    Benjamin Cole

      Hi Ya'll,

       

      What I'm Using:

      I'm connecting live to AWS via Tableau 2018.2.3 and using the most recent Redshift ODBC Driver.

       

      {"ts":"2018-10-24T17:22:16.681","pid":7093,"tid":"ef45fe","sev":"info","req":"-","sess":"-","site":"-","user":"-","k":"protocol-logsession","v":{"Class":"redshift","Driver Name":"Amazon Redshift ODBC Driver","Driver ODBC Version":"03.80","Driver Version":"1.4.2.1010","ODBC Driver Manager Version":"03.52.0000","Protocol":"ODBCProtocol","Server Version":"8.0.2"},"ctx":{"client-type":"desktop","procid":"6886","tid":"15679669","version":"20182.18.1009.2120"}}

       

      Problem:

      I'm trying to do a CountD(companies) and the result is a count NOT distinct.

       

      Here is what the query should look like.

      SELECT COUNT(DISTINCT "companies"."company_slug") AS "ctd:company_slug:ok"

      FROM "public"."companies" "companies"

        INNER JOIN "public"."product_deployments" "product_deployments" ON ("companies"."company_slug" = "product_deployments"."company_slug")

      HAVING (COUNT(1) > 0)

       

      Here is the broken query.

      SELECT SUM(1) AS "ctd:company_slug:ok"

      FROM "public"."companies" "companies"

        INNER JOIN "public"."product_deployments" "product_deployments" ON ("companies"."company_slug" = "product_deployments"."company_slug")

      HAVING (COUNT(1) > 0)

       

      Any thoughts?

       

      Thanks!

       

      PS. I attached the performance workbook.

        • 1. Re: CountD Broken?
          Fima Leshinsky

          Ben and I are working together on this issue. Here's some more detail on what we're seeing:

           

          In tabprotosrv.txt:

          {"ts":"2018-10-24T17:50:32.410","pid":17288,"tid":"f02401","sev":"info","req":"-","sess":"-","site":"-","user":"-","k":"begin-query","v":{"is-command":false,"protocol-id":7,"query":"SELECT SUM(1) AS \"ctd:company_slug:ok\"\nFROM \"public\".\"companies\" \"companies\"\nHAVING (COUNT(1) > 0)","query-category":"Data","query-hash":3080625086},"ctx":{"client-type":"desktop","procid":"10641","tid":"15700459","version":"20182.18.1009.2120"}}
          {"ts":"2018-10-24T17:50:32.729","pid":17288,"tid":"f02401","sev":"info","req":"-","sess":"-","site":"-","user":"-","k":"resolve-preferred-import-binding","v":{"field":"ctd:company_slug:ok","msg":"Forced to new wire data type and octet length.","original-width":20,"original-wire-datatype":"SQL_C_SBIGINT","original-wire-datatype-enum":4294967271,"sql-datatype":"SQL_BIGINT","sql-datatype-enum":4294967291,"width":8,"wire-datatype":"SQL_C_SBIGINT","wire-datatype-enum":4294967271},"ctx":{"client-type":"desktop","procid":"10641","tid":"15700459","version":"20182.18.1009.2120"}}
          {"ts":"2018-10-24T17:50:32.729","pid":17288,"tid":"f0245e","sev":"info","req":"-","sess":"-","site":"-","user":"-","k":"binding-info","v":{"info":"ODBCRowsetSource::BindColumn: Binding column.","name":"ctd:company_slug:ok","octet-length":8,"ordinal":1,"precision":19,"scale":-1,"width":-1,"wire-type-enum":-25,"wire-type-name":"SQL_C_SBIGINT"},"ctx":{"client-type":"desktop","procid":"10641","tid":"15700459","version":"20182.18.1009.2120"}}
          {"ts":"2018-10-24T17:50:32.729","pid":17288,"tid":"f0245e","sev":"info","req":"-","sess":"-","site":"-","user":"-","k":"msg","v":"BindColumns: column binding complete","ctx":{"client-type":"desktop","procid":"10641","tid":"15700459","version":"20182.18.1009.2120"}}
          {"ts":"2018-10-24T17:50:32.808","pid":17288,"tid":"f02460","sev":"info","req":"-","sess":"-","site":"-","user":"-","k":"end-query","v":{"cols":1,"elapsed":0.398,"is-command":false,"protocol-class":"redshift","protocol-id":7,"query-category":"Data","query-hash":3080625086,"query-trunc":"SELECT SUM(1) AS \"ctd:company_slug:ok\"\nFROM \"public\".\"companies\" \"companies\"\nHAVING (COUNT(1) > 0)","rows":1},"ctx":{"client-type":"desktop","procid":"10641","tid":"15700459","version":"20182.18.1009.2120"}}
          

           

          Is the ODBC driver binding this column to a BIGINT?

           

          Anyone have any idea what's happening here?

           

          For some reason Tableau is translating a "SUM of CTD(Company Slug)" to SQL which sums all rows in the table!

           

          SELECT SUM(1) AS "ctd:company_slug:ok" FROM "public"."companies" "companies" HAVING (COUNT(1) > 0)
          
          • 2. Re: CountD Broken?
            Fima Leshinsky

            This has magically resolved itself