my create table statement are:
CREATE TABLE `address`(
`x` int,
`y` int);
and when I query use :
select * from address where x = '1'
I got an exception like
com.facebook.presto.sql.analyzer.SemanticException: line 1:8: Cannot cast integer to char(1)
at com.facebook.presto.sql.analyzer.ExpressionAnalyzer$Visitor.visitCast(ExpressionAnalyzer.java:944)
at com.facebook.presto.sql.analyzer.ExpressionAnalyzer$Visitor.visitCast(ExpressionAnalyzer.java:288)
at com.facebook.presto.sql.tree.Cast.accept(Cast.java:98)
but. hive support this implicit conversion.
does presto want to do this ? if not , why?
thx !
@xingnailu just curious, what Presto version is this? Mine says line 1:31: '=' cannot be applied to integer, varchar(1) ('a' is currently considered a varchar(1) rather than char(1)).
If there was the implicit conversion integer -> varchar, the end result wouldn't be that nice anyway. Note that operations, including comparisons, on varchars are slower than on numbers.
Of course, this doesn't mean such a coercion should not exist. The SQL standard governs that, but I didn't check it
@findepi I am glad to receive you replication. And my presto version is 0.192. Can I consider the reason that presto don't implicit conversion integer to varchar is efficiency. I think I will do this implicit conversion by myself.
thx
Can I consider the reason that presto don't implicit conversion integer to varchar is efficiency.
No, it's not.
I was just saying that, in case of your query, such an implicit conversion would be detrimental to performance.
May be all the Hive users want this features. @findepi . It take huge cost changes for rewrite Hive scripts. Hive‘s market is so huge(ETL). Why not consider fully supporting Hive? This is more conducive to the development of Presto. Presto can increase the indication that opening this feature will reduce performance.
我也遇到了相同的问题,希望各位大佬给出解决的方案,非常感谢
Most helpful comment
May be all the Hive users want this features. @findepi . It take huge cost changes for rewrite Hive scripts. Hive‘s market is so huge(ETL). Why not consider fully supporting Hive? This is more conducive to the development of Presto. Presto can increase the indication that opening this feature will reduce performance.