You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is because Presto allows 0 length varchar but hive doesn't. When we materialize this CTE it fails but without materialization, it succeeds.
@Test
public void testCteWithZeroLengthVarchar()
{
String testQuery = "WITH temp AS (" +
" SELECT * FROM (VALUES " +
" (CAST('' AS VARCHAR(0)), 9)" +
" ) AS t (text_column, number_column)" +
") SELECT * FROM temp";
QueryRunner queryRunner = getQueryRunner();
compareResults(queryRunner.execute(getMaterializedSession(),
testQuery),
queryRunner.execute(getSession(),
testQuery));
}
Stack Trace
Caused by: java.lang.RuntimeException: Varchar length 0 out of allowed range [1, 65535]
at org.apache.hadoop.hive.serde2.typeinfo.BaseCharUtils.validateVarcharParameter(BaseCharUtils.java:32)
at org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeInfo.(VarcharTypeInfo.java:33)
at org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.createPrimitiveTypeInfo(TypeInfoFactory.java:159)
at org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.getPrimitiveTypeInfo(TypeInfoFactory.java:117)
at org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.getVarcharTypeInfo(TypeInfoFactory.java:183)
at com.facebook.presto.hive.HiveTypeTranslator.translate(HiveTypeTranslator.java:98)
at com.facebook.presto.hive.HiveType.toHiveType(HiveType.java:218)
at com.facebook.presto.hive.HiveMetadata.getColumnHandles(HiveMetadata.java:3584)
at com.facebook.presto.hive.HiveMetadata.createTemporaryTable(HiveMetadata.java:1107)
So we might need this check for the 0 length Varchar due to , because write with 0 length varchar fails.
See reference - While Presto supports Varchar of length 0 (as discussed in trinodb/trino#1136
jaystarshot
changed the title
CTE materialization internal error: CTE Materialization fails with 0 length varchar
CTAS Write and CTE materialization internal error: Fails with 0 length varchar
Jan 25, 2024
jaystarshot
changed the title
CTAS Write and CTE materialization internal error: Fails with 0 length varchar
CTE materialization internal error: Fails with 0 length varchar
Feb 2, 2024
This is because Presto allows 0 length varchar but hive doesn't. When we materialize this CTE it fails but without materialization, it succeeds.
Stack Trace
Caused by: java.lang.RuntimeException: Varchar length 0 out of allowed range [1, 65535]
at org.apache.hadoop.hive.serde2.typeinfo.BaseCharUtils.validateVarcharParameter(BaseCharUtils.java:32)
at org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeInfo.(VarcharTypeInfo.java:33)
at org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.createPrimitiveTypeInfo(TypeInfoFactory.java:159)
at org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.getPrimitiveTypeInfo(TypeInfoFactory.java:117)
at org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.getVarcharTypeInfo(TypeInfoFactory.java:183)
at com.facebook.presto.hive.HiveTypeTranslator.translate(HiveTypeTranslator.java:98)
at com.facebook.presto.hive.HiveType.toHiveType(HiveType.java:218)
at com.facebook.presto.hive.HiveMetadata.getColumnHandles(HiveMetadata.java:3584)
at com.facebook.presto.hive.HiveMetadata.createTemporaryTable(HiveMetadata.java:1107)
So we might need this check for the 0 length Varchar due to , because write with 0 length varchar fails.
See reference - While Presto supports Varchar of length 0 (as discussed in trinodb/trino#1136
Your Environment
Expected Behavior
Current Behavior
Possible Solution
Steps to Reproduce
Screenshots (if appropriate)
Context
The text was updated successfully, but these errors were encountered: