treasure-data / prestogres

PostgreSQL protocol gateway for Presto distributed SQL query engine
Other
292 stars 61 forks source link

Unknown type: TEXT when using CONTAINS in Tableau's calculated field #54

Closed teamsoo closed 8 years ago

teamsoo commented 8 years ago

\ Using Presto version 0.141t and my prestogres would be 3.4.0 (latest)

I'm using CONTAINS function inside a calculated field as follow

capture2

And the error is as follow

capture1

I got raw sql from pgpool-II

SELECT (CASE WHEN (STRPOS(CAST("product_master_2016"."product" AS TEXT),CAST('Fresh' AS TEXT)) > 0) THEN 'Test' ELSE NULL END) AS "Calculation_250231285777633280", "product_master_2016"."product" AS "product" FROM "default"."product_master_2016" "product_master_2016" GROUP BY 1, 2

Direct query from command line "psql -h 127.0.0.1 -p 5439 -U presto hive" also show error like this

screen shot 2559-06-30 at 4 43 17 pm

I understand that PostgreSQL supports data type TEXT but Presto doesn't have TEXT (according to Presto Doc). So how would I make this function CONTAINS works? Is there any way that I can set VARCHAR as a default data type for string??

teamsoo commented 8 years ago

Problem also occurs when changing column type from INT to TEXT in Tableau.