[NO ISSUE][OTH] Redact field name
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
Change-Id: I360681ff4e1460561eb5b614ce16f7d6519096b2
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/16023
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Ali Alsuliman <ali.al.solaiman@gmail.com>
Reviewed-by: Michael Blow <mblow@apache.org>
(cherry picked from commit a81d38112c3c8c114432c5039c0b752a1954dbdd)
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17243
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
Tested-by: Ali Alsuliman <ali.al.solaiman@gmail.com>
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ConstantFoldingRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ConstantFoldingRule.java
index 6f359c5..e04581b 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ConstantFoldingRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ConstantFoldingRule.java
@@ -31,7 +31,6 @@
import org.apache.asterix.common.exceptions.ErrorCode;
import org.apache.asterix.common.exceptions.NoOpWarningCollector;
import org.apache.asterix.common.exceptions.WarningCollector;
-import org.apache.asterix.common.exceptions.WarningUtil;
import org.apache.asterix.dataflow.data.common.ExpressionTypeComputer;
import org.apache.asterix.dataflow.data.nontagged.MissingWriterFactory;
import org.apache.asterix.formats.nontagged.ADMPrinterFactoryProvider;
@@ -91,9 +90,11 @@
import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.api.exceptions.IWarningCollector;
+import org.apache.hyracks.api.exceptions.Warning;
import org.apache.hyracks.data.std.api.IPointable;
import org.apache.hyracks.data.std.primitive.VoidPointable;
import org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream;
+import org.apache.hyracks.util.LogRedactionUtil;
import com.google.common.collect.ImmutableMap;
@@ -326,8 +327,8 @@
if (isDuplicate) {
IWarningCollector warningCollector = optContext.getWarningCollector();
if (warningCollector.shouldWarn()) {
- warningCollector.warn(WarningUtil.forAsterix(fieldNameExpr.second.getSourceLocation(),
- ErrorCode.COMPILATION_DUPLICATE_FIELD_NAME, fieldName));
+ warningCollector.warn(Warning.of(fieldNameExpr.second.getSourceLocation(),
+ ErrorCode.COMPILATION_DUPLICATE_FIELD_NAME, LogRedactionUtil.userData(fieldName)));
}
iterator.remove();
iterator.next();
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveDuplicateFieldsRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveDuplicateFieldsRule.java
index 0a3b9c4..e924a4c 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveDuplicateFieldsRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveDuplicateFieldsRule.java
@@ -26,7 +26,6 @@
import org.apache.asterix.builders.RecordBuilder;
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.common.exceptions.ErrorCode;
-import org.apache.asterix.common.exceptions.WarningUtil;
import org.apache.asterix.om.functions.BuiltinFunctions;
import org.apache.asterix.om.typecomputer.impl.ClosedRecordConstructorResultType;
import org.apache.asterix.om.typecomputer.impl.OpenRecordConstructorResultType;
@@ -41,6 +40,8 @@
import org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
import org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
import org.apache.hyracks.api.exceptions.IWarningCollector;
+import org.apache.hyracks.api.exceptions.Warning;
+import org.apache.hyracks.util.LogRedactionUtil;
/**
* <pre>
@@ -115,8 +116,8 @@
if (fieldName != null && !fieldNames.add(fieldName)) {
IWarningCollector warningCollector = context.getWarningCollector();
if (warningCollector.shouldWarn()) {
- warningCollector.warn(WarningUtil.forAsterix(fieldNameExpr.getSourceLocation(),
- ErrorCode.COMPILATION_DUPLICATE_FIELD_NAME, fieldName));
+ warningCollector.warn(Warning.of(fieldNameExpr.getSourceLocation(),
+ ErrorCode.COMPILATION_DUPLICATE_FIELD_NAME, LogRedactionUtil.userData(fieldName)));
}
iterator.remove();
iterator.next();
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
index 2cd402f..17de313 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
@@ -132,6 +132,7 @@
import org.apache.hyracks.algebricks.core.algebra.plan.ALogicalPlanImpl;
import org.apache.hyracks.algebricks.core.algebra.util.OperatorManipulationUtil;
import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.util.LogRedactionUtil;
/**
* Each visit returns a pair of an operator and a variable. The variable
@@ -888,7 +889,8 @@
private FieldBinding generateFieldBinding(String fieldName, Expression fieldValueExpr, Set<String> outFieldNames,
SourceLocation sourceLoc) throws CompilationException {
if (!outFieldNames.add(fieldName)) {
- throw new CompilationException(ErrorCode.DUPLICATE_FIELD_NAME, sourceLoc, fieldName);
+ throw new CompilationException(ErrorCode.DUPLICATE_FIELD_NAME, sourceLoc,
+ LogRedactionUtil.userData(fieldName));
}
return new FieldBinding(new LiteralExpr(new StringLiteral(fieldName)), fieldValueExpr);
}
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
index ffb1dd5..62a2b44 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
@@ -33,6 +33,7 @@
import org.apache.asterix.om.utils.RecordUtil;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.util.LogRedactionUtil;
/**
* A util that can verify if a filter field, a list of partitioning expressions,
@@ -62,7 +63,7 @@
IAType fieldType = recordType.getSubFieldType(filterField);
if (fieldType == null) {
throw new CompilationException(ErrorCode.COMPILATION_FIELD_NOT_FOUND, sourceLoc,
- RecordUtil.toFullyQualifiedName(filterField));
+ LogRedactionUtil.userData(RecordUtil.toFullyQualifiedName(filterField)));
}
switch (fieldType.getTypeTag()) {
case TINYINT:
@@ -82,7 +83,7 @@
break;
case UNION:
throw new CompilationException(ErrorCode.COMPILATION_FILTER_CANNOT_BE_NULLABLE,
- RecordUtil.toFullyQualifiedName(filterField));
+ LogRedactionUtil.userData(RecordUtil.toFullyQualifiedName(filterField)));
default:
throw new CompilationException(ErrorCode.COMPILATION_ILLEGAL_FILTER_TYPE,
fieldType.getTypeTag().name());
@@ -124,7 +125,8 @@
IAType fieldType = recType.getSubFieldType(fieldName);
if (fieldType == null) {
String unTypeField = fieldName.get(0) == null ? "" : fieldName.get(0);
- throw new CompilationException(ErrorCode.COMPILATION_FIELD_NOT_FOUND, sourceLoc, unTypeField);
+ throw new CompilationException(ErrorCode.COMPILATION_FIELD_NOT_FOUND, sourceLoc,
+ LogRedactionUtil.userData(unTypeField));
}
partitioningExprTypes.add(fieldType);
ATypeTag pkTypeTag = fieldType.getTypeTag();
@@ -140,14 +142,14 @@
IAType fieldType = partitioningExprTypes.get(i);
if (fieldType == null) {
throw new CompilationException(ErrorCode.COMPILATION_FIELD_NOT_FOUND, sourceLoc,
- RecordUtil.toFullyQualifiedName(partitioningExpr));
+ LogRedactionUtil.userData(RecordUtil.toFullyQualifiedName(partitioningExpr)));
}
boolean nullable = KeyFieldTypeUtil.chooseSource(keySourceIndicators, i, recType, metaRecType)
.isSubFieldNullable(partitioningExpr);
if (nullable) {
// key field is nullable
throw new CompilationException(ErrorCode.COMPILATION_PRIMARY_KEY_CANNOT_BE_NULLABLE, sourceLoc,
- RecordUtil.toFullyQualifiedName(partitioningExpr));
+ LogRedactionUtil.userData(RecordUtil.toFullyQualifiedName(partitioningExpr)));
}
switch (fieldType.getTypeTag()) {
case TINYINT:
@@ -167,7 +169,7 @@
break;
case UNION:
throw new CompilationException(ErrorCode.COMPILATION_PRIMARY_KEY_CANNOT_BE_NULLABLE, sourceLoc,
- RecordUtil.toFullyQualifiedName(partitioningExpr));
+ LogRedactionUtil.userData(RecordUtil.toFullyQualifiedName(partitioningExpr)));
default:
throw new CompilationException(ErrorCode.COMPILATION_ILLEGAL_PRIMARY_KEY_TYPE, sourceLoc,
fieldType.getTypeTag());
@@ -181,18 +183,18 @@
* Validates the key fields that will be used as keys of an index.
*
* @param recType
- * the record type
+ * the record type
* @param keyFieldNames
- * a map of key fields that will be validated
+ * a map of key fields that will be validated
* @param keyFieldTypes
- * a map of key types (if provided) that will be validated
+ * a map of key types (if provided) that will be validated
* @param indexType
- * the type of the index that its key fields is being validated
+ * the type of the index that its key fields is being validated
* @throws AlgebricksException
*/
public static void validateKeyFields(ARecordType recType, ARecordType metaRecType, List<List<String>> keyFieldNames,
- List<Integer> keySourceIndicators, List<IAType> keyFieldTypes, IndexType indexType)
- throws AlgebricksException {
+ List<Integer> keySourceIndicators, List<IAType> keyFieldTypes, IndexType indexType,
+ SourceLocation sourceLoc) throws AlgebricksException {
List<IAType> fieldTypes =
KeyFieldTypeUtil.getKeyTypes(recType, metaRecType, keyFieldNames, keySourceIndicators);
int pos = 0;
@@ -202,16 +204,21 @@
if (fieldType == null) {
fieldType = keyFieldTypes.get(pos);
if (keyFieldTypes.get(pos) == BuiltinType.AMISSING) {
- throw new AsterixException("A field with this name \"" + fieldName + "\" could not be found.");
+ throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
+ "A field with this name \""
+ + LogRedactionUtil.userData(RecordUtil.toFullyQualifiedName(fieldName))
+ + "\" could not be found.");
}
} else if (openFieldCompositeIdx) {
- throw new AsterixException("A closed field \"" + fieldName
- + "\" could be only in a prefix part of the composite index, containing opened field.");
+ throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
+ "A closed field \"" + LogRedactionUtil.userData(RecordUtil.toFullyQualifiedName(fieldName))
+ + "\" could be only in a prefix part of the composite index, containing opened field.");
}
if (keyFieldTypes.get(pos) != BuiltinType.AMISSING
&& fieldType.getTypeTag() != keyFieldTypes.get(pos).getTypeTag()) {
- throw new AsterixException(
- "A field \"" + fieldName + "\" is already defined with the type \"" + fieldType + "\"");
+ throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
+ "A field \"" + LogRedactionUtil.userData(RecordUtil.toFullyQualifiedName(fieldName)) + "\" is "
+ + "already defined with the type \"" + fieldType + "\"");
}
switch (indexType) {
case BTREE:
@@ -233,8 +240,11 @@
case DAYTIMEDURATION:
break;
default:
- throw new AsterixException("The field \"" + fieldName + "\" which is of type "
- + fieldType.getTypeTag() + " cannot be indexed using the BTree index.");
+ throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
+ "The field '"
+ + LogRedactionUtil.userData(RecordUtil.toFullyQualifiedName(fieldName))
+ + "' which is of type " + fieldType.getTypeTag()
+ + " cannot be indexed using the BTree index.");
}
break;
case RTREE:
@@ -247,8 +257,11 @@
case UNION:
break;
default:
- throw new AsterixException("The field \"" + fieldName + "\" which is of type "
- + fieldType.getTypeTag() + " cannot be indexed using the RTree index.");
+ throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
+ "The field '"
+ + LogRedactionUtil.userData(RecordUtil.toFullyQualifiedName(fieldName))
+ + "' which is of type " + fieldType.getTypeTag()
+ + " cannot be indexed using the RTree index.");
}
break;
case LENGTH_PARTITIONED_NGRAM_INVIX:
@@ -257,8 +270,10 @@
case UNION:
break;
default:
- throw new AsterixException(
- "The field \"" + fieldName + "\" which is of type " + fieldType.getTypeTag()
+ throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
+ "The field '"
+ + LogRedactionUtil.userData(RecordUtil.toFullyQualifiedName(fieldName))
+ + "' which is of type " + fieldType.getTypeTag()
+ " cannot be indexed using the Length Partitioned N-Gram index.");
}
break;
@@ -270,8 +285,10 @@
case UNION:
break;
default:
- throw new AsterixException(
- "The field \"" + fieldName + "\" which is of type " + fieldType.getTypeTag()
+ throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
+ "The field '"
+ + LogRedactionUtil.userData(RecordUtil.toFullyQualifiedName(fieldName))
+ + "' which is of type " + fieldType.getTypeTag()
+ " cannot be indexed using the Length Partitioned Keyword index.");
}
break;
@@ -281,8 +298,11 @@
case UNION:
break;
default:
- throw new AsterixException("The field \"" + fieldName + "\" which is of type "
- + fieldType.getTypeTag() + " cannot be indexed using the N-Gram index.");
+ throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
+ "The field '"
+ + LogRedactionUtil.userData(RecordUtil.toFullyQualifiedName(fieldName))
+ + "' which is of type " + fieldType.getTypeTag()
+ + " cannot be indexed using the N-Gram index.");
}
break;
case SINGLE_PARTITION_WORD_INVIX:
@@ -293,8 +313,11 @@
case UNION:
break;
default:
- throw new AsterixException("The field \"" + fieldName + "\" which is of type "
- + fieldType.getTypeTag() + " cannot be indexed using the Keyword index.");
+ throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
+ "The field '"
+ + LogRedactionUtil.userData(RecordUtil.toFullyQualifiedName(fieldName))
+ + "' which is of type " + fieldType.getTypeTag()
+ + " cannot be indexed using the Keyword index.");
}
break;
default:
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
index 1befe29..dbd75f7 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
@@ -37,6 +37,7 @@
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ExecutorService;
+import java.util.stream.Collectors;
import org.apache.asterix.active.ActivityState;
import org.apache.asterix.active.EntityId;
@@ -163,6 +164,7 @@
import org.apache.asterix.om.types.ATypeTag;
import org.apache.asterix.om.types.IAType;
import org.apache.asterix.om.types.TypeSignature;
+import org.apache.asterix.om.utils.RecordUtil;
import org.apache.asterix.transaction.management.service.transaction.DatasetIdFactory;
import org.apache.asterix.translator.AbstractLangTranslator;
import org.apache.asterix.translator.ClientRequest;
@@ -212,6 +214,7 @@
import org.apache.hyracks.control.cc.ClusterControllerService;
import org.apache.hyracks.control.common.controllers.CCConfig;
import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory;
+import org.apache.hyracks.util.LogRedactionUtil;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -1005,7 +1008,7 @@
}
if (stmtCreateIndex.isEnforced() && !fieldExpr.second.isUnknownable()) {
throw new AsterixException(ErrorCode.INDEX_ILLEGAL_ENFORCED_NON_OPTIONAL, sourceLoc,
- String.valueOf(fieldExpr.first));
+ LogRedactionUtil.userData(String.valueOf(fieldExpr.first)));
}
// don't allow creating an enforced index on a closed-type field, fields that
// are part of schema.
@@ -1013,11 +1016,13 @@
if (stmtCreateIndex.isEnforced()
&& subType.getSubFieldType(fieldExpr.first.subList(i, fieldExpr.first.size())) != null) {
throw new AsterixException(ErrorCode.INDEX_ILLEGAL_ENFORCED_ON_CLOSED_FIELD, sourceLoc,
- String.valueOf(fieldExpr.first));
+ LogRedactionUtil.userData(String.valueOf(fieldExpr.first)));
}
if (!isOpen) {
- throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc, "Typed index on \""
- + fieldExpr.first + "\" field could be created only for open datatype");
+ throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
+ "Typed index on '"
+ + LogRedactionUtil.userData(RecordUtil.toFullyQualifiedName(fieldExpr.first))
+ + "' " + "field could be created only for open datatype");
}
if (stmtCreateIndex.hasMetaField()) {
throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
@@ -1030,8 +1035,9 @@
overridesFieldTypes = true;
}
if (fieldType == null) {
- throw new CompilationException(ErrorCode.UNKNOWN_TYPE, sourceLoc, fieldExpr.second == null
- ? String.valueOf(fieldExpr.first) : String.valueOf(fieldExpr.second));
+ throw new CompilationException(ErrorCode.UNKNOWN_TYPE, sourceLoc,
+ fieldExpr.second == null ? LogRedactionUtil.userData(String.valueOf(fieldExpr.first))
+ : String.valueOf(fieldExpr.second));
}
// try to add the key & its source to the set of keys, if key couldn't be added,
@@ -1039,7 +1045,7 @@
if (!indexKeysSet
.add(new Pair<>(fieldExpr.first, stmtCreateIndex.getFieldSourceIndicators().get(keyIndex)))) {
throw new AsterixException(ErrorCode.INDEX_ILLEGAL_REPETITIVE_FIELD, sourceLoc,
- String.valueOf(fieldExpr.first));
+ LogRedactionUtil.userData(String.valueOf(fieldExpr.first)));
}
indexFields.add(fieldExpr.first);
@@ -1166,10 +1172,13 @@
if (existingIndex.getKeyFieldNames().equals(index.getKeyFieldNames())
&& !existingIndex.getKeyFieldTypes().equals(index.getKeyFieldTypes())
&& existingIndex.isEnforced()) {
- throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc, "Cannot create index "
- + index.getIndexName() + " , enforced index " + existingIndex.getIndexName()
- + " on field \"" + StringUtils.join(index.getKeyFieldNames(), ',')
- + "\" is already defined with type \"" + existingIndex.getKeyFieldTypes() + "\"");
+ String fieldNames = index.getKeyFieldNames().stream().map(RecordUtil::toFullyQualifiedName)
+ .collect(Collectors.joining(","));
+ throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
+ "Cannot create index " + index.getIndexName() + " , enforced index "
+ + existingIndex.getIndexName() + " on field(s) '"
+ + LogRedactionUtil.userData(fieldNames) + "' is already defined with type(s) '"
+ + StringUtils.join(existingIndex.getKeyFieldTypes(), ',') + "'");
}
}
}
@@ -1340,7 +1349,7 @@
ARecordType aRecordType, ARecordType metaRecordType, List<List<String>> indexFields,
List<IAType> indexFieldTypes) throws AlgebricksException {
ValidateUtil.validateKeyFields(aRecordType, metaRecordType, indexFields, keySourceIndicators, indexFieldTypes,
- stmtCreateIndex.getIndexType());
+ stmtCreateIndex.getIndexType(), stmtCreateIndex.getSourceLocation());
}
protected void handleCreateTypeStatement(MetadataProvider metadataProvider, Statement stmt) throws Exception {
diff --git a/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml b/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
index db10dcb..77e8afa 100644
--- a/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
+++ b/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
@@ -434,37 +434,37 @@
<test-case FilePath="exception">
<compilation-unit name="issue_384_create_index_error_1">
<output-dir compare="Text">none</output-dir>
- <expected-error>The field "[loc]" which is of type point cannot be indexed using the BTree index.</expected-error>
+ <expected-error>ASX1079: Compilation error: The field 'loc' which is of type point cannot be indexed using the BTree index.</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="exception">
<compilation-unit name="issue_384_create_index_error_2">
<output-dir compare="Text">none</output-dir>
- <expected-error>The field "[age]" which is of type integer cannot be indexed using the RTree index.</expected-error>
+ <expected-error>ASX1079: Compilation error: The field 'age' which is of type integer cannot be indexed using the RTree index.</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="exception">
<compilation-unit name="issue_384_create_index_error_3">
<output-dir compare="Text">none</output-dir>
- <expected-error>The field "[loc]" which is of type point cannot be indexed using the Length Partitioned Keyword index.</expected-error>
+ <expected-error>ASX1079: Compilation error: The field 'loc' which is of type point cannot be indexed using the Length Partitioned Keyword index.</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="exception">
<compilation-unit name="issue_384_create_index_error_4">
<output-dir compare="Text">none</output-dir>
- <expected-error>The field "[loc]" which is of type point cannot be indexed using the Length Partitioned Keyword index.</expected-error>
+ <expected-error>ASX1079: Compilation error: The field 'loc' which is of type point cannot be indexed using the Length Partitioned Keyword index.</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="exception">
<compilation-unit name="issue_384_create_index_error_5">
<output-dir compare="Text">none</output-dir>
- <expected-error>The field "[loc]" which is of type point cannot be indexed using the Length Partitioned N-Gram index.</expected-error>
+ <expected-error>ASX1079: Compilation error: The field 'loc' which is of type point cannot be indexed using the Length Partitioned N-Gram index.</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="exception">
<compilation-unit name="issue_384_create_index_error_6">
<output-dir compare="Text">none</output-dir>
- <expected-error>The field "[loc]" which is of type point cannot be indexed using the Length Partitioned N-Gram index.</expected-error>
+ <expected-error>ASX1079: Compilation error: The field 'loc' which is of type point cannot be indexed using the Length Partitioned N-Gram index.</expected-error>
</compilation-unit>
</test-case>
</test-group>
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
index cfb2e5d..964d807 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -827,19 +827,19 @@
<test-case FilePath="open-index-enforced/error-checking">
<compilation-unit name="index-on-closed-type">
<output-dir compare="Text">index-on-closed-type</output-dir>
- <expected-error>Typed index on "[value]" field could be created only for open datatype</expected-error>
+ <expected-error>Compilation error: Typed index on 'value' field could be created only for open datatype</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="open-index-enforced/error-checking">
<compilation-unit name="index-type-collision">
<output-dir compare="Text">index-type-collision</output-dir>
- <expected-error>Cannot create index testIdx2 , enforced index testIdx1 on field "[value]" is already defined with type "[integer]"</expected-error>
+ <expected-error>Compilation error: Cannot create index testIdx2 , enforced index testIdx1 on field(s) 'value' is already defined with type(s) 'integer'</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="open-index-enforced/error-checking">
<compilation-unit name="index-type-promotion-collision">
<output-dir compare="Text">index-type-promotion-collision</output-dir>
- <expected-error>Cannot create index testIdx2 , enforced index testIdx1 on field "[value]" is already defined with type "[bigint]"</expected-error>
+ <expected-error>Compilation error: Cannot create index testIdx2 , enforced index testIdx1 on field(s) 'value' is already defined with type(s) 'bigint'</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="open-index-enforced/error-checking">
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index 600dde8..44f64ba 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -6541,7 +6541,7 @@
<test-case FilePath="open-index-enforced/error-checking">
<compilation-unit name="index-on-closed-type">
<output-dir compare="Text">index-on-closed-type</output-dir>
- <expected-error>Typed index on "[value]" field could be created only for open datatype</expected-error>
+ <expected-error>Typed index on 'value' field could be created only for open datatype</expected-error>
</compilation-unit>
</test-case>
</test-group>
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/base/JRecord.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/base/JRecord.java
index 205e228..ed41f7c 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/base/JRecord.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/base/JRecord.java
@@ -37,6 +37,7 @@
import org.apache.asterix.om.types.IAType;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.util.LogRedactionUtil;
public final class JRecord implements IJObject {
@@ -80,7 +81,8 @@
// check open part
IJObject fieldValue = openFields.get(fieldName);
if (fieldValue == null) {
- throw new RuntimeDataException(ErrorCode.LIBRARY_JAVA_JOBJECTS_UNKNOWN_FIELD, fieldName);
+ throw new RuntimeDataException(ErrorCode.LIBRARY_JAVA_JOBJECTS_UNKNOWN_FIELD,
+ LogRedactionUtil.userData(fieldName));
}
return fieldValue;
}
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/ADMDataParser.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/ADMDataParser.java
index 4a46717..d75b84d 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/ADMDataParser.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/ADMDataParser.java
@@ -55,6 +55,7 @@
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.data.std.api.IMutableValueStorage;
import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.util.LogRedactionUtil;
/**
* Parser for ADM formatted data.
@@ -472,7 +473,7 @@
fieldId = recBuilder.getFieldId(fldName);
if ((fieldId < 0) && !recType.isOpen()) {
throw new ParseException(ErrorCode.PARSER_ADM_DATA_PARSER_EXTRA_FIELD_IN_CLOSED_RECORD,
- fldName);
+ LogRedactionUtil.userData(fldName));
} else if ((fieldId < 0) && recType.isOpen()) {
parseString(tmpTokenImage.getBuffer(), tmpTokenImage.getBegin() + 1,
tmpTokenImage.getLength() - 2, fieldNameBuffer.getDataOutput());
@@ -527,7 +528,7 @@
final int nullableFieldId = checkOptionalConstraints(recType, nulls);
if (nullableFieldId != -1) {
throw new ParseException(ErrorCode.PARSER_ADM_DATA_PARSER_FIELD_NOT_NULL,
- recType.getFieldNames()[nullableFieldId]);
+ LogRedactionUtil.userData(recType.getFieldNames()[nullableFieldId]));
}
}
recBuilder.write(out, true);
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/AbstractNestedDataParser.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/AbstractNestedDataParser.java
index c6f605d..67996a5 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/AbstractNestedDataParser.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/AbstractNestedDataParser.java
@@ -35,6 +35,7 @@
import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
import org.apache.asterix.om.utils.RecordUtil;
import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.util.LogRedactionUtil;
/**
* Abstract class for nested formats (ADM, JSON, XML ... etc)
@@ -117,7 +118,7 @@
for (int i = 0; i < recordType.getFieldTypes().length; i++) {
if (!nullBitmap.get(i) && !isMissableType(recordType.getFieldTypes()[i])) {
throw new RuntimeDataException(ErrorCode.PARSER_TWEET_PARSER_CLOSED_FIELD_NULL,
- recordType.getFieldNames()[i]);
+ LogRedactionUtil.userData(recordType.getFieldNames()[i]));
}
}
}
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/DelimitedDataParser.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/DelimitedDataParser.java
index 60e6e77..94d640b 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/DelimitedDataParser.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/DelimitedDataParser.java
@@ -52,6 +52,7 @@
import org.apache.hyracks.dataflow.common.data.parsers.IValueParser;
import org.apache.hyracks.dataflow.common.data.parsers.IValueParserFactory;
import org.apache.hyracks.dataflow.std.file.FieldCursorForDelimitedDataParser;
+import org.apache.hyracks.util.LogRedactionUtil;
public class DelimitedDataParser extends AbstractDataParser implements IStreamDataParser, IRecordDataParser<char[]> {
@@ -108,7 +109,8 @@
fldIds[i] = recBuilder.getFieldId(name);
if (fldIds[i] < 0) {
if (!recordType.isOpen()) {
- throw new RuntimeDataException(ErrorCode.PARSER_DELIMITED_ILLEGAL_FIELD, name, recordType);
+ throw new RuntimeDataException(ErrorCode.PARSER_DELIMITED_ILLEGAL_FIELD,
+ LogRedactionUtil.userData(name), recordType);
} else {
nameBuffers[i] = new ArrayBackedValueStorage();
str.setValue(name);
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/JSONDataParser.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/JSONDataParser.java
index b2036c0..3fd3b1f 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/JSONDataParser.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/JSONDataParser.java
@@ -50,6 +50,7 @@
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.api.util.ExceptionUtils;
import org.apache.hyracks.data.std.api.IMutableValueStorage;
+import org.apache.hyracks.util.LogRedactionUtil;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParseException;
@@ -259,7 +260,7 @@
if (!recordType.isOpen() && fieldIndex < 0) {
throw new RuntimeDataException(ErrorCode.PARSER_ADM_DATA_PARSER_EXTRA_FIELD_IN_CLOSED_RECORD,
- fieldName);
+ LogRedactionUtil.userData(fieldName));
}
valueBuffer.reset();
nextToken();
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/TweetParser.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/TweetParser.java
index 4726a50..1ac25bb 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/TweetParser.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/TweetParser.java
@@ -43,6 +43,7 @@
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.data.std.api.IMutableValueStorage;
import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.util.LogRedactionUtil;
import org.apache.hyracks.util.string.UTF8StringWriter;
import com.fasterxml.jackson.databind.JsonNode;
@@ -200,7 +201,7 @@
if (obj.get(curFNames[iter1]).isNull() && !(curTypes[iter1] instanceof AUnionType)) {
if (curRecType.isClosedField(curFNames[iter1])) {
throw new RuntimeDataException(ErrorCode.PARSER_TWEET_PARSER_CLOSED_FIELD_NULL,
- curFNames[iter1]);
+ LogRedactionUtil.userData(curFNames[iter1]));
} else {
continue;
}
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/RTreeResourceFactoryProvider.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/RTreeResourceFactoryProvider.java
index 2108a4c..9cebdc2 100644
--- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/RTreeResourceFactoryProvider.java
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/RTreeResourceFactoryProvider.java
@@ -37,7 +37,7 @@
import org.apache.asterix.om.types.ATypeTag;
import org.apache.asterix.om.types.IAType;
import org.apache.asterix.om.utils.NonTaggedFormatUtil;
-import org.apache.commons.lang3.StringUtils;
+import org.apache.asterix.om.utils.RecordUtil;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.common.utils.Pair;
import org.apache.hyracks.algebricks.data.IBinaryComparatorFactoryProvider;
@@ -57,6 +57,7 @@
import org.apache.hyracks.storage.am.rtree.frames.RTreePolicyType;
import org.apache.hyracks.storage.common.IResourceFactory;
import org.apache.hyracks.storage.common.IStorageManager;
+import org.apache.hyracks.util.LogRedactionUtil;
public class RTreeResourceFactoryProvider implements IResourceFactoryProvider {
@@ -79,7 +80,7 @@
index.getKeyFieldNames().get(0), recordType).first;
if (spatialType == null) {
throw new CompilationException(ErrorCode.COMPILATION_FIELD_NOT_FOUND,
- StringUtils.join(index.getKeyFieldNames().get(0), '.'));
+ LogRedactionUtil.userData(RecordUtil.toFullyQualifiedName(index.getKeyFieldNames().get(0))));
}
List<List<String>> primaryKeyFields = dataset.getPrimaryKeys();
int numPrimaryKeys = primaryKeyFields.size();
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java
index 4c3ad73..9e9b11c 100644
--- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java
@@ -36,6 +36,7 @@
import org.apache.commons.lang3.ArrayUtils;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.common.utils.Pair;
+import org.apache.hyracks.util.LogRedactionUtil;
/**
* Provider utility methods for data types
@@ -124,8 +125,9 @@
if (enforcedFieldType != null && !ATypeHierarchy.canPromote(enforcedFieldType.getTypeTag(),
index.getKeyFieldTypes().get(i).getTypeTag())) {
throw new AsterixException(ErrorCode.COMPILATION_ERROR,
- "Cannot enforce field \"" + String.join(".", index.getKeyFieldNames().get(i))
- + "\" to have type " + index.getKeyFieldTypes().get(i));
+ "Cannot enforce field '"
+ + LogRedactionUtil.userData(String.join(".", index.getKeyFieldNames().get(i)))
+ + "' to have type " + index.getKeyFieldTypes().get(i));
}
if (enforcedFieldType == null) {
recordNameTypesMap.put(splits.get(splits.size() - 1),
@@ -208,8 +210,8 @@
IAType actualType = TypeComputeUtils.getActualType(nestedRecordType);
if (actualType.getTypeTag() != ATypeTag.OBJECT) {
String fName = String.join(".", fieldName);
- throw new AsterixException(ErrorCode.COMPILATION_ERROR,
- "Field accessor is not defined for \"" + fName + "\" of type " + actualType.getTypeTag());
+ throw new AsterixException(ErrorCode.COMPILATION_ERROR, "Field accessor is not defined for '"
+ + LogRedactionUtil.userData(fName) + "' of type " + actualType.getTypeTag());
}
}
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/ClosedRecordConstructorResultType.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/ClosedRecordConstructorResultType.java
index 077e9b3..d3cb2d7 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/ClosedRecordConstructorResultType.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/ClosedRecordConstructorResultType.java
@@ -38,6 +38,7 @@
import org.apache.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
import org.apache.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
import org.apache.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
+import org.apache.hyracks.util.LogRedactionUtil;
public class ClosedRecordConstructorResultType implements IResultTypeComputer {
@@ -76,7 +77,8 @@
}
for (int j = 0; j < i; j++) {
if (fieldName.equals(fieldNames[j])) {
- throw new CompilationException(ErrorCode.DUPLICATE_FIELD_NAME, f.getSourceLocation(), fieldName);
+ throw new CompilationException(ErrorCode.DUPLICATE_FIELD_NAME, f.getSourceLocation(),
+ LogRedactionUtil.userData(fieldName));
}
}
fieldTypes[i] = e2Type;
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/OpenRecordConstructorResultType.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/OpenRecordConstructorResultType.java
index 6deb17c..fb01764 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/OpenRecordConstructorResultType.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/OpenRecordConstructorResultType.java
@@ -41,6 +41,7 @@
import org.apache.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
import org.apache.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
import org.apache.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
+import org.apache.hyracks.util.LogRedactionUtil;
public class OpenRecordConstructorResultType implements IResultTypeComputer {
@@ -75,7 +76,8 @@
String fieldName = ConstantExpressionUtil.getStringConstant(e1);
if (fieldName != null && t2 != null && TypeHelper.isClosed(t2)) {
if (namesList.contains(fieldName)) {
- throw new CompilationException(ErrorCode.DUPLICATE_FIELD_NAME, f.getSourceLocation(), fieldName);
+ throw new CompilationException(ErrorCode.DUPLICATE_FIELD_NAME, f.getSourceLocation(),
+ LogRedactionUtil.userData(fieldName));
}
namesList.add(fieldName);
if (t2.getTypeTag() == ATypeTag.UNION) {
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/RecordMergeTypeComputer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/RecordMergeTypeComputer.java
index b1e4021..9985a4c 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/RecordMergeTypeComputer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/RecordMergeTypeComputer.java
@@ -40,6 +40,7 @@
import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
import org.apache.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.util.LogRedactionUtil;
public class RecordMergeTypeComputer implements IResultTypeComputer {
@@ -111,7 +112,7 @@
// If the ignore duplicates flag is not set, we throw a duplicate field exception
else {
throw new CompilationException(ErrorCode.COMPILATION_DUPLICATE_FIELD_NAME,
- f.getSourceLocation(), fieldNames[i]);
+ f.getSourceLocation(), LogRedactionUtil.userData(fieldNames[i]));
}
}
@@ -144,7 +145,8 @@
private IAType mergedNestedType(String fieldName, IAType fieldType1, IAType fieldType0, SourceLocation sourceLoc)
throws AlgebricksException {
if (fieldType1.getTypeTag() != ATypeTag.OBJECT || fieldType0.getTypeTag() != ATypeTag.OBJECT) {
- throw new CompilationException(ErrorCode.COMPILATION_DUPLICATE_FIELD_NAME, sourceLoc, fieldName);
+ throw new CompilationException(ErrorCode.COMPILATION_DUPLICATE_FIELD_NAME, sourceLoc,
+ LogRedactionUtil.userData(fieldName));
}
ARecordType resultType = (ARecordType) fieldType0;
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/runtime/RuntimeRecordTypeInfo.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/runtime/RuntimeRecordTypeInfo.java
index ccdfa0e..9d53ab3 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/runtime/RuntimeRecordTypeInfo.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/runtime/RuntimeRecordTypeInfo.java
@@ -32,6 +32,7 @@
import org.apache.hyracks.data.std.accessors.UTF8StringBinaryComparatorFactory;
import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
+import org.apache.hyracks.util.LogRedactionUtil;
import org.apache.hyracks.util.string.UTF8StringUtil;
import org.apache.hyracks.util.string.UTF8StringWriter;
@@ -100,7 +101,8 @@
int j = getFieldIndex(baaos.getByteArray(), serializedFieldNameOffsets[i],
UTF8StringUtil.getStringLength(baaos.getByteArray(), serializedFieldNameOffsets[i]));
if (j != i) {
- throw new RuntimeDataException(ErrorCode.DUPLICATE_FIELD_NAME, fieldNames[i]);
+ throw new RuntimeDataException(ErrorCode.DUPLICATE_FIELD_NAME,
+ LogRedactionUtil.userData(fieldNames[i]));
}
}
} catch (IOException e) {