Minor optimization, added comments, and fixed typos.
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/AqlTranslator.java b/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/AqlTranslator.java
index b54ea38..c78aa8e 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/AqlTranslator.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/AqlTranslator.java
@@ -407,7 +407,7 @@
List<String> partitioningExprs = ((InternalDetailsDecl) dd.getDatasetDetailsDecl())
.getPartitioningExprs();
ARecordType aRecordType = (ARecordType) itemType;
- aRecordType.validateParitioningExpression(partitioningExprs);
+ aRecordType.validatePartitioningExpressions(partitioningExprs);
String ngName = ((InternalDetailsDecl) dd.getDatasetDetailsDecl()).getNodegroupName().getValue();
datasetDetails = new InternalDatasetDetails(InternalDatasetDetails.FileStructure.BTREE,
InternalDatasetDetails.PartitioningStrategy.HASH, partitioningExprs, partitioningExprs,
@@ -428,7 +428,7 @@
List<String> partitioningExprs = ((FeedDetailsDecl) dd.getDatasetDetailsDecl())
.getPartitioningExprs();
ARecordType aRecordType = (ARecordType) itemType;
- aRecordType.validateParitioningExpression(partitioningExprs);
+ aRecordType.validatePartitioningExpressions(partitioningExprs);
String ngName = ((FeedDetailsDecl) dd.getDatasetDetailsDecl()).getNodegroupName().getValue();
String adapter = ((FeedDetailsDecl) dd.getDatasetDetailsDecl()).getAdapterFactoryClassname();
Map<String, String> configuration = ((FeedDetailsDecl) dd.getDatasetDetailsDecl())
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java
index a63764f..788010b 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java
@@ -233,17 +233,25 @@
* the name of the field to check
* @return true if fieldName is a closed field, otherwise false
* @throws IOException
- * if an error occurs while serializing fieldName
*/
public boolean isClosedField(String fieldName) throws IOException {
return findFieldPosition(fieldName) != -1;
}
- public void validateParitioningExpression(List<String> partitioningExprs) throws AlgebricksException, IOException {
+ /**
+ * Validates the partitioning expression that will be used to partition a dataset.
+ *
+ * @param partitioningExprs
+ * a list of partitioning expressions that will be validated
+ * @throws AlgebricksException
+ * (if the validation failed), IOException
+ */
+ public void validatePartitioningExpressions(List<String> partitioningExprs) throws AlgebricksException, IOException {
for (String fieldName : partitioningExprs) {
- if (getFieldType(fieldName) == null) {
+ IAType fieldType = getFieldType(fieldName);
+ if (fieldType == null) {
throw new AlgebricksException("A field with this name \"" + fieldName + "\" could not be found.");
- } else if (getFieldType(fieldName).getTypeTag() == ATypeTag.RECORD) {
+ } else if (fieldType.getTypeTag() == ATypeTag.RECORD) {
throw new AlgebricksException("The partitioning key \"" + fieldName + "\" cannot be of type "
+ ATypeTag.RECORD + ".");
}