Skip to content

Commit

Permalink
Skip unsupported types when pushing down in Cassandra
Browse files Browse the repository at this point in the history
  • Loading branch information
ebyhr authored and highker committed Sep 18, 2020
1 parent ad2a1c7 commit 9ae10f0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ private static List<Set<Object>> getPartitionKeysList(CassandraTable table, Tupl
Object value = range.getSingleValue();

CassandraType valueType = columnHandle.getCassandraType();
columnValues.add(valueType.validatePartitionKey(value));
if (valueType.isSupportedPartitionKey()) {
columnValues.add(value);
}
}
return columnValues.build();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ public Object getJavaValue(Object nativeValue)
}
}

public Object validatePartitionKey(Object value)
public boolean isSupportedPartitionKey()
{
switch (this) {
case ASCII:
Expand All @@ -461,7 +461,7 @@ public Object validatePartitionKey(Object value)
case TIMESTAMP:
case UUID:
case TIMEUUID:
return value;
return true;
case COUNTER:
case BLOB:
case CUSTOM:
Expand All @@ -470,8 +470,7 @@ public Object validatePartitionKey(Object value)
case LIST:
case MAP:
default:
// todo should we just skip partition pruning instead of throwing an exception?
throw new PrestoException(NOT_SUPPORTED, "Unsupport partition key type: " + this);
return false;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,23 +197,23 @@ public static void createTableAllTypesPartitionKey(CassandraSession session, Sch
" typeinteger, " +
" typelong, " +
// TODO: NOT YET SUPPORTED AS A PARTITION KEY
// " typebytes, " +
" typebytes, " +
" typetimestamp, " +
" typeansi, " +
" typeboolean, " +
// TODO: PRECISION LOST. IMPLEMENT IT AS STRING
// " typedecimal, " +
" typedecimal, " +
" typedouble, " +
" typefloat, " +
" typeinet, " +
" typevarchar, " +
// TODO: NOT YET SUPPORTED AS A PARTITION KEY
// " typevarint, " +
" typetimeuuid " +
" typevarint, " +
" typetimeuuid, " +
// TODO: NOT YET SUPPORTED AS A PARTITION KEY
// " typelist, " +
// " typemap, " +
// " typeset" +
" typelist, " +
" typemap, " +
" typeset" +
" ))" +
")");

Expand Down

0 comments on commit 9ae10f0

Please sign in to comment.