public static List<IAType> validatePartitioningExpressions(ARecordType recType,ARecordType metaRecType,List<List<String>> partitioningExprs,List<Integer> keySourceIndicators,boolean autogenerated) throws AsterixException {
  List<IAType> partitioningExprTypes=new ArrayList<IAType>(partitioningExprs.size());
  if (autogenerated) {
    if (partitioningExprs.size() > 1) {
      throw new AsterixException("Cannot autogenerate a composite primary key");
    }
    List<String> fieldName=partitioningExprs.get(0);
    IAType fieldType=recType.getSubFieldType(fieldName);
    partitioningExprTypes.add(fieldType);
    ATypeTag pkTypeTag=fieldType.getTypeTag();
    if (pkTypeTag != ATypeTag.UUID) {
      throw new AsterixException("Cannot autogenerate a primary key for type " + pkTypeTag + ". Autogenerated primary keys must be of type "+ ATypeTag.UUID+ ".");
    }
  }
 else {
    partitioningExprTypes=KeyFieldTypeUtils.getKeyTypes(recType,metaRecType,partitioningExprs,keySourceIndicators);
    for (int fidx=0; fidx < partitioningExprTypes.size(); ++fidx) {
      IAType fieldType=partitioningExprTypes.get(fidx);
      if (fieldType == null) {
        throw new AsterixException("Type not found for partitioning key " + partitioningExprs.get(fidx));
      }
switch (fieldType.getTypeTag()) {
case INT8:
case INT16:
case INT32:
case INT64:
case FLOAT:
case DOUBLE:
case STRING:
case BINARY:
case DATE:
case TIME:
case UUID:
case DATETIME:
case YEARMONTHDURATION:
case DAYTIMEDURATION:
        break;
case UNION:
      throw new AsterixException("The partitioning key " + partitioningExprs.get(fidx) + " cannot be nullable");
default :
    throw new AsterixException("The partitioning key " + partitioningExprs.get(fidx) + " cannot be of type "+ fieldType.getTypeTag()+ ".");
}
}
}
return partitioningExprTypes;
}

public static List < IAType > validatePartitioningExpressions ( ARecordType recType , ARecordType metaRecType , List < List < String > > partitioningExprs , List < Integer > keySourceIndicators , boolean autogenerated ) throws AsterixException { List < IAType > partitioningExprTypes = new ArrayList < IAType > ( partitioningExprs . size ( ) ) ; if ( autogenerated ) { if ( partitioningExprs . size ( ) > 1 ) { throw new AsterixException ( "Cannot autogenerate a composite primary key" ) ; } List < String > fieldName = partitioningExprs . get ( 0 ) ; IAType fieldType = recType . getSubFieldType ( fieldName ) ; partitioningExprTypes . add ( fieldType ) ; ATypeTag pkTypeTag = fieldType . getTypeTag ( ) ; if ( pkTypeTag != ATypeTag . UUID ) { throw new AsterixException ( "Cannot autogenerate a primary key for type " + pkTypeTag + ". Autogenerated primary keys must be of type " + ATypeTag . UUID + "." ) ; } } else { partitioningExprTypes = KeyFieldTypeUtils . getKeyTypes ( recType , metaRecType , partitioningExprs , keySourceIndicators ) ; for ( int fidx = 0 ; fidx < partitioningExprTypes . size ( ) ; ++ fidx ) { IAType fieldType = partitioningExprTypes . get ( fidx ) ; if ( fieldType == null ) { throw new AsterixException ( "Type not found for partitioning key " + partitioningExprs . get ( fidx ) ) ; } switch ( fieldType . getTypeTag ( ) ) { case INT8 : case INT16 : case INT32 : case INT64 : case FLOAT : case DOUBLE : case STRING : case BINARY : case DATE : case TIME : case UUID : case DATETIME : case YEARMONTHDURATION : case DAYTIMEDURATION : break ; case UNION : throw new AsterixException ( "The partitioning key " + partitioningExprs . get ( fidx ) + " cannot be nullable" ) ; default : throw new AsterixException ( "The partitioning key " + partitioningExprs . get ( fidx ) + " cannot be of type " + fieldType . getTypeTag ( ) + "." ) ; } } } return partitioningExprTypes ; }
validates the partitioning expression that will be used to partition a dataset and returns expression type .
