Taewoo Kim has uploaded a new change for review.
https://asterix-gerrit.ics.uci.edu/1422
Change subject: Full-text implementation step 4
......................................................................
Full-text implementation step 4
- Follows the new error handling proposal.
- Introduces Full-TextTypeComputer.
Change-Id: Ib909882c43a3fc1401eceec1e1ddd981f40b6dee
---
M
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
M
asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-basic/fulltext-contains-without-option.aql
M
asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-basic/fulltext-contains.aql
M
asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-04/fulltext-index-04.1.ddl.aql
R
asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-04/fulltext-index-04.2.query.aql
D
asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-04/fulltext-index-04.2.update.aql
M
asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-05/fulltext-index-05.1.ddl.aql
R
asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-05/fulltext-index-05.2.query.aql
D
asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-05/fulltext-index-05.2.update.aql
M
asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-06/fulltext-index-06.1.ddl.aql
R
asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-06/fulltext-index-06.2.query.aql
D
asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-06/fulltext-index-06.2.update.aql
R
asterixdb/asterix-app/src/test/resources/runtimets/results/fulltext/fulltext-04/fulltext-04.2.adm
R
asterixdb/asterix-app/src/test/resources/runtimets/results/fulltext/fulltext-05/fulltext-05.2.adm
R
asterixdb/asterix-app/src/test/resources/runtimets/results/fulltext/fulltext-06/fulltext-06.2.adm
M
asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
M asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
M
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
A
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/FullTextContainsResultTypeComputer.java
M
hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
M
hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
M
hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/IOManager.java
M
hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/AbstractTOccurrenceSearcher.java
23 files changed, 87 insertions(+), 85 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/22/1422/1
diff --git
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
index 2e6518b..40124ca 100644
---
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
+++
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
@@ -28,6 +28,8 @@
import org.apache.asterix.common.config.DatasetConfig.DatasetType;
import org.apache.asterix.common.config.DatasetConfig.IndexType;
import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.exceptions.CompilationException;
+import org.apache.asterix.common.exceptions.ErrorCode;
import org.apache.asterix.external.indexing.IndexingConstants;
import org.apache.asterix.lang.common.util.FunctionUtil;
import org.apache.asterix.metadata.declared.DataSourceId;
@@ -204,7 +206,8 @@
argValue = ConstantExpressionUtil.getStringConstant(element);
checkAndGenerateFTSearchExceptionForStringPhrase(argValue);
} else {
- throw new AlgebricksException("Each element in the list should
be a string in the Full-text search.");
+ throw new
CompilationException(ErrorCode.ERROR_COMPILATION_TYPE_UNSUPPORTED,
+ BuiltinFunctions.FULLTEXT_CONTAINS.getName(),
element.getType().getTypeTag());
}
}
}
@@ -230,8 +233,8 @@
checkEachElementInFTSearchListPredicate(oListCursor);
break;
default:
- throw new AlgebricksException(
- "A full-text Search predicate should be a string or an
(un)ordered list.");
+ throw new
CompilationException(ErrorCode.ERROR_COMPILATION_TYPE_UNSUPPORTED,
+ BuiltinFunctions.FULLTEXT_CONTAINS.getName(),
objectFromExpr.getType().getTypeTag());
}
}
@@ -240,9 +243,7 @@
public static void checkAndGenerateFTSearchExceptionForStringPhrase(String
value) throws AlgebricksException {
for (int j = 0; j < value.length(); j++) {
if
(DelimitedUTF8StringBinaryTokenizer.isSeparator(value.charAt(j))) {
- throw new AlgebricksException(
- "Phrase search in Full-text is not yet supported. Only
one keyword per expression is permitted."
- + value.charAt(j));
+ throw new
CompilationException(ErrorCode.COMPILATION_FULLTEXT_PHRASE_FOUND);
}
}
}
diff --git
a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-basic/fulltext-contains-without-option.aql
b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-basic/fulltext-contains-without-option.aql
index eee411c..3c924f9 100644
---
a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-basic/fulltext-contains-without-option.aql
+++
b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-basic/fulltext-contains-without-option.aql
@@ -47,8 +47,6 @@
create index fulltext_index_title on MyData(title) type fulltext;
-write output to
asterix_nc1:"rttest/inverted-index-basic_fulltext-contains-without-option.adm";
-
for $o in dataset MyData
where ftcontains($o.title, "database")
order by $o.id
diff --git
a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-basic/fulltext-contains.aql
b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-basic/fulltext-contains.aql
index bc697df..3ef8cd8 100644
---
a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-basic/fulltext-contains.aql
+++
b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-basic/fulltext-contains.aql
@@ -47,8 +47,6 @@
create index fulltext_index_title on MyData(title) type fulltext;
-write output to
asterix_nc1:"rttest/inverted-index-basic_fulltext-contains.adm";
-
for $o in dataset MyData
where ftcontains($o.title, "database", {"mode":"any"})
order by $o.id
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-04/fulltext-index-04.1.ddl.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-04/fulltext-index-04.1.ddl.aql
index 5664ee9..7d62aeb 100644
---
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-04/fulltext-index-04.1.ddl.aql
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-04/fulltext-index-04.1.ddl.aql
@@ -20,7 +20,7 @@
/*
* Description : Full-text search index test
* : This test is intended to verify that the full-text
search DOES NOT work as expected.
- * : query #3 - a string phrase is provided as a query
predicate.
+ * : query #2 - a string phrase is provided as a query
predicate.
* : this should throw an exception since we don't
support a phrase search yet.
* Expected Result : Exception
*
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-04/fulltext-index-04.3.query.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-04/fulltext-index-04.2.query.aql
similarity index 100%
rename from
asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-04/fulltext-index-04.3.query.aql
rename to
asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-04/fulltext-index-04.2.query.aql
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-04/fulltext-index-04.2.update.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-04/fulltext-index-04.2.update.aql
deleted file mode 100644
index bd244d0..0000000
---
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-04/fulltext-index-04.2.update.aql
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-05/fulltext-index-05.1.ddl.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-05/fulltext-index-05.1.ddl.aql
index 07ebb6c..d34bae3 100644
---
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-05/fulltext-index-05.1.ddl.aql
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-05/fulltext-index-05.1.ddl.aql
@@ -20,7 +20,7 @@
/*
* Description : Full-text search index test
* : This test is intended to verify that the full-text
search DOES NOT work as expected.
- * : query #3 - a string phrase in an ordered list is
provided as a query predicate.
+ * : query #2 - a string phrase in an ordered list is
provided as a query predicate.
* : this should throw an exception since we don't
support a phrase search yet.
* Expected Result : Exception
*
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-05/fulltext-index-05.3.query.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-05/fulltext-index-05.2.query.aql
similarity index 100%
rename from
asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-05/fulltext-index-05.3.query.aql
rename to
asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-05/fulltext-index-05.2.query.aql
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-05/fulltext-index-05.2.update.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-05/fulltext-index-05.2.update.aql
deleted file mode 100644
index bd244d0..0000000
---
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-05/fulltext-index-05.2.update.aql
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-06/fulltext-index-06.1.ddl.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-06/fulltext-index-06.1.ddl.aql
index 7295edf..f45d679 100644
---
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-06/fulltext-index-06.1.ddl.aql
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-06/fulltext-index-06.1.ddl.aql
@@ -20,7 +20,7 @@
/*
* Description : Full-text search index test
* : This test is intended to verify that the full-text
search DOES NOT work as expected.
- * : query #3 - a string phrase in an unordered list is
provided as a query predicate.
+ * : query #2 - a string phrase in an unordered list is
provided as a query predicate.
* : this should throw an exception since we don't
support a phrase search yet.
* Expected Result : Exception
*
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-06/fulltext-index-06.3.query.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-06/fulltext-index-06.2.query.aql
similarity index 100%
rename from
asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-06/fulltext-index-06.3.query.aql
rename to
asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-06/fulltext-index-06.2.query.aql
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-06/fulltext-index-06.2.update.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-06/fulltext-index-06.2.update.aql
deleted file mode 100644
index bd244d0..0000000
---
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/fulltext/fulltext-index-06/fulltext-index-06.2.update.aql
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/results/fulltext/fulltext-04/fulltext-04.3.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/fulltext/fulltext-04/fulltext-04.2.adm
similarity index 100%
rename from
asterixdb/asterix-app/src/test/resources/runtimets/results/fulltext/fulltext-04/fulltext-04.3.adm
rename to
asterixdb/asterix-app/src/test/resources/runtimets/results/fulltext/fulltext-04/fulltext-04.2.adm
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/results/fulltext/fulltext-05/fulltext-05.3.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/fulltext/fulltext-05/fulltext-05.2.adm
similarity index 100%
rename from
asterixdb/asterix-app/src/test/resources/runtimets/results/fulltext/fulltext-05/fulltext-05.3.adm
rename to
asterixdb/asterix-app/src/test/resources/runtimets/results/fulltext/fulltext-05/fulltext-05.2.adm
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/results/fulltext/fulltext-06/fulltext-06.3.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/fulltext/fulltext-06/fulltext-06.2.adm
similarity index 100%
rename from
asterixdb/asterix-app/src/test/resources/runtimets/results/fulltext/fulltext-06/fulltext-06.3.adm
rename to
asterixdb/asterix-app/src/test/resources/runtimets/results/fulltext/fulltext-06/fulltext-06.2.adm
diff --git
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
index 2e7c69b..9bbc1c9 100644
---
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
+++
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
@@ -63,6 +63,7 @@
public static final int ERROR_COMPILATION_INVALID_EXPRESSION = 1007;
public static final int ERROR_COMPILATION_INVALID_PARAMETER_NUMBER = 1008;
public static final int ERROR_COMPILATION_INVALID_RETURNING_EXPRESSION =
1009;
+ public static final int COMPILATION_FULLTEXT_PHRASE_FOUND = 1010;
// Loads the map that maps error codes to error message templates.
private static Map<Integer, String> errorMessageMap = null;
diff --git
a/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
b/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
index 85fa1d1..a3a5d41 100644
--- a/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
+++ b/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
@@ -48,3 +48,4 @@
# Compile-time check errors
1007=Invalid expression: function %1$s expects its %2$s input parameter to be
a %3$s expression, but the actual expression is %4$s
1008=Invalid parameter number: function %1$s cannot take %2$s parameters
+1010=Phrase search in Full-text is not yet supported. Only one keyword per
expression is permitted
\ No newline at end of file
diff --git
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
index 3f3a5bd..6eaf4ae 100644
---
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
+++
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
@@ -64,6 +64,7 @@
import org.apache.asterix.om.typecomputer.impl.FieldAccessByIndexResultType;
import org.apache.asterix.om.typecomputer.impl.FieldAccessByNameResultType;
import org.apache.asterix.om.typecomputer.impl.FieldAccessNestedResultType;
+import
org.apache.asterix.om.typecomputer.impl.FullTextContainsResultTypeComputer;
import
org.apache.asterix.om.typecomputer.impl.GetOverlappingInvervalTypeComputer;
import org.apache.asterix.om.typecomputer.impl.InjectFailureTypeComputer;
import org.apache.asterix.om.typecomputer.impl.LocalAvgTypeComputer;
@@ -1035,8 +1036,8 @@
addPrivateFunction(SIMILARITY_JACCARD_PREFIX_CHECK,
OrderedListOfAnyTypeComputer.INSTANCE, true);
// Full-text function
- addFunction(FULLTEXT_CONTAINS, ABooleanTypeComputer.INSTANCE, true);
- addFunction(FULLTEXT_CONTAINS_WO_OPTION,
ABooleanTypeComputer.INSTANCE, true);
+ addFunction(FULLTEXT_CONTAINS,
FullTextContainsResultTypeComputer.INSTANCE, true);
+ addFunction(FULLTEXT_CONTAINS_WO_OPTION,
FullTextContainsResultTypeComputer.INSTANCE, true);
// Spatial functions
addFunction(SPATIAL_AREA, ADoubleTypeComputer.INSTANCE, true);
diff --git
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/FullTextContainsResultTypeComputer.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/FullTextContainsResultTypeComputer.java
new file mode 100644
index 0000000..f2398e1
--- /dev/null
+++
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/FullTextContainsResultTypeComputer.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.om.typecomputer.impl;
+
+import org.apache.asterix.om.exceptions.TypeMismatchException;
+import org.apache.asterix.om.typecomputer.base.AbstractResultTypeComputer;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.IAType;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
+
+public class FullTextContainsResultTypeComputer extends
AbstractResultTypeComputer {
+
+ public static final FullTextContainsResultTypeComputer INSTANCE = new
FullTextContainsResultTypeComputer();
+
+ private FullTextContainsResultTypeComputer() {
+ }
+
+ @Override
+ protected void checkArgType(String funcName, int argIndex, IAType type)
throws AlgebricksException {
+ ATypeTag actualTypeTag = type.getTypeTag();
+ // Expression1 should be a string.
+ if (argIndex == 0 && actualTypeTag != ATypeTag.STRING && actualTypeTag
!= ATypeTag.ANY) {
+ throw new TypeMismatchException(funcName, argIndex, actualTypeTag,
ATypeTag.STRING);
+ }
+ // Expression2 should be a string, or an (un)ordered list.
+ if (argIndex == 1 && (actualTypeTag != ATypeTag.STRING &&
actualTypeTag != ATypeTag.UNORDEREDLIST
+ && actualTypeTag != ATypeTag.ORDEREDLIST && actualTypeTag !=
ATypeTag.ANY)) {
+ throw new TypeMismatchException(funcName, argIndex, actualTypeTag,
ATypeTag.STRING, ATypeTag.UNORDEREDLIST,
+ ATypeTag.ORDEREDLIST);
+ }
+ // Each option name should be a string if it is already processed by
FullTextContainsParameterCheckRule.
+ // Before, the third argument should be a record if exists.
+ // The structure is: arg2 = optionName1, arg3 = optionValue1, arg4 =
optionName1, arg5 = optionValue2, ...
+ if (argIndex > 1 && argIndex % 2 == 0 && (actualTypeTag !=
ATypeTag.STRING && actualTypeTag != ATypeTag.RECORD
+ && actualTypeTag != ATypeTag.ANY)) {
+ throw new TypeMismatchException(funcName, argIndex, actualTypeTag,
ATypeTag.STRING, ATypeTag.RECORD);
+ }
+ }
+
+ @Override
+ protected IAType getResultType(ILogicalExpression expr, IAType...
strippedInputTypes) throws AlgebricksException {
+ return BuiltinType.ABOOLEAN;
+ }
+
+}
diff --git
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
index 95f2e8e..888f82a 100644
---
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
+++
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
@@ -34,6 +34,8 @@
public static final int INVALID_OPERATOR_OPERATION = 1;
public static final int ERROR_PROCESSING_TUPLE = 2;
public static final int FAILURE_ON_NODE = 3;
+ public static final int
RUNTIME_FILE_WITH_ABSOULTE_PATH_NOT_WITHIN_ANY_IO_DEVICE = 4;
+ public static final int RUNTIME_FULLTEXT_PHRASE_FOUND = 5;
// Loads the map that maps error codes to error message templates.
private static Map<Integer, String> errorMessageMap = null;
diff --git
a/hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
b/hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
index 890021b..8ebafef 100644
---
a/hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
+++
b/hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
@@ -19,3 +19,5 @@
1=Unsupported operation %1$s in %2$s operator
2=Error in processing tuple %1$s in a frame
+4=The file with absolute path %1$s is not within any of the current IO devices
+5=Phrase search in Full-text is not supported. An expression should include
only one word
\ No newline at end of file
diff --git
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/IOManager.java
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/IOManager.java
index 352f912..cb38076 100644
---
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/IOManager.java
+++
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/IOManager.java
@@ -28,6 +28,7 @@
import java.util.List;
import java.util.concurrent.Executor;
+import org.apache.hyracks.api.exceptions.ErrorCode;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.api.io.FileReference;
import org.apache.hyracks.api.io.IFileDeviceComputer;
@@ -338,17 +339,11 @@
return new FileReference(deviceComputer.compute(path), path);
}
- // Temp:
@Override
public FileReference resolveAbsolutePath(String path) throws
HyracksDataException {
IODeviceHandle devHandle = getDevice(path);
if (devHandle == null) {
- String errorMessage = "The file with absolute path: " + path
- + " is outside all IO devices. IO devices in this node are
\n";
- for (IODeviceHandle d : ioDevices) {
- errorMessage = errorMessage.concat(d.toString() + '\n');
- }
- throw new HyracksDataException(errorMessage);
+ throw
HyracksDataException.create(ErrorCode.RUNTIME_FILE_WITH_ABSOULTE_PATH_NOT_WITHIN_ANY_IO_DEVICE,
path);
}
String relativePath = devHandle.getRelativePath(path);
return new FileReference(devHandle, relativePath);
diff --git
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/AbstractTOccurrenceSearcher.java
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/AbstractTOccurrenceSearcher.java
index cfc9fc6..9e6afa7 100644
---
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/AbstractTOccurrenceSearcher.java
+++
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/AbstractTOccurrenceSearcher.java
@@ -29,6 +29,7 @@
import org.apache.hyracks.api.context.IHyracksCommonContext;
import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
import org.apache.hyracks.api.dataflow.value.RecordDescriptor;
+import org.apache.hyracks.api.exceptions.ErrorCode;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.data.std.primitive.IntegerPointable;
import org.apache.hyracks.dataflow.common.comm.io.ArrayTupleBuilder;
@@ -121,16 +122,12 @@
// If it's a list, it can have multiple keywords in it. But,
each keyword should not be a phrase.
if (isFullTextSearchQuery) {
if (queryTokenizerType == TokenizerType.STRING &&
tokenCountInOneField > 1) {
- throw new HyracksDataException(
- "Phrase search in Full-text is not supported. "
- + "An expression should include only
one word.");
+ throw
HyracksDataException.create(ErrorCode.RUNTIME_FULLTEXT_PHRASE_FOUND);
} else if (queryTokenizerType == TokenizerType.LIST) {
for (int j = 1; j < token.getTokenLength(); j++) {
if (DelimitedUTF8StringBinaryTokenizer
.isSeparator((char)
token.getData()[token.getStartOffset() + j])) {
- throw new HyracksDataException(
- "Phrase search in Full-text is not
supported. "
- + "An expression should
include only one word.");
+ throw
HyracksDataException.create(ErrorCode.RUNTIME_FULLTEXT_PHRASE_FOUND);
}
}
}
--
To view, visit https://asterix-gerrit.ics.uci.edu/1422
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib909882c43a3fc1401eceec1e1ddd981f40b6dee
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Taewoo Kim <[email protected]>