Merge branch 'gerrit/cheshire-cat'
Change-Id: If9b2e4f8b46d2f3b03917b74b08f98694fba4ece
diff --git a/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/ActiveManager.java b/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/ActiveManager.java
index 458008b..ba04967 100644
--- a/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/ActiveManager.java
+++ b/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/ActiveManager.java
@@ -179,7 +179,7 @@
try {
stopIfRunning(runtime, content.getTimeout(), content.getUnit());
} catch (Throwable th) {
- LOGGER.warn("Failed to stop runtime: {}", runtimeId, th);
+ LOGGER.fatal("Failed to stop runtime: {}", runtimeId, th);
ExitUtil.halt(ExitUtil.EC_UNCAUGHT_THROWABLE);
}
});
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetAsterixMemoryRequirementsRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetAsterixMemoryRequirementsRule.java
index abe4b71..8de1fb5 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetAsterixMemoryRequirementsRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetAsterixMemoryRequirementsRule.java
@@ -52,6 +52,9 @@
}
private boolean forceMinMemoryBudget(AsterixOptimizationContext context) {
+ if (!context.getPhysicalOptimizationConfig().getMinMemoryAllocation()) {
+ return false;
+ }
Int2ObjectMap<Set<DataSource>> dataSourceMap = context.getDataSourceMap();
if (dataSourceMap.isEmpty()) {
return false;
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java
index baf083d..9088db6 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java
@@ -135,7 +135,8 @@
CompilerProperties.COMPILER_SORT_PARALLEL_KEY, CompilerProperties.COMPILER_SORT_SAMPLES_KEY,
CompilerProperties.COMPILER_INDEXONLY_KEY, CompilerProperties.COMPILER_INTERNAL_SANITYCHECK_KEY,
CompilerProperties.COMPILER_EXTERNAL_FIELD_PUSHDOWN_KEY, CompilerProperties.COMPILER_SUBPLAN_MERGE_KEY,
- CompilerProperties.COMPILER_SUBPLAN_NESTEDPUSHDOWN_KEY, FunctionUtil.IMPORT_PRIVATE_FUNCTIONS,
+ CompilerProperties.COMPILER_SUBPLAN_NESTEDPUSHDOWN_KEY,
+ CompilerProperties.COMPILER_MIN_MEMORY_ALLOCATION_KEY, FunctionUtil.IMPORT_PRIVATE_FUNCTIONS,
FuzzyUtils.SIM_FUNCTION_PROP_NAME, FuzzyUtils.SIM_THRESHOLD_PROP_NAME,
StartFeedStatement.WAIT_FOR_COMPLETION, FeedActivityDetails.FEED_POLICY_NAME,
FeedActivityDetails.COLLECT_LOCATIONS, SqlppQueryRewriter.INLINE_WITH_OPTION,
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/NCQueryServiceServlet.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/NCQueryServiceServlet.java
index 99b6be1..0b0f262 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/NCQueryServiceServlet.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/NCQueryServiceServlet.java
@@ -68,7 +68,7 @@
}
@Override
- protected void executeStatement(IRequestReference requestReference, String statementsText,
+ protected void executeStatement(IServletRequest request, IRequestReference requestReference, String statementsText,
SessionOutput sessionOutput, ResultProperties resultProperties,
IStatementExecutor.StatementProperties statementProperties, IStatementExecutor.Stats stats,
QueryServiceRequestParameters param, RequestExecutionState executionState,
@@ -85,7 +85,7 @@
long timeout = param.getTimeout();
int stmtCategoryRestrictionMask = org.apache.asterix.app.translator.RequestParameters
.getStatementCategoryRestrictionMask(param.isReadOnly());
- ExecuteStatementRequestMessage requestMsg = createRequestMessage(requestReference, statementsText,
+ ExecuteStatementRequestMessage requestMsg = createRequestMessage(request, requestReference, statementsText,
sessionOutput, resultProperties, param, optionalParameters, statementParameters, ncCtx,
responseFuture, queryLanguage, handleUrl, stmtCategoryRestrictionMask, false);
executionState.start();
@@ -129,12 +129,12 @@
buildResponseResults(responsePrinter, sessionOutput, responseMsg.getExecutionPlans(), warnings);
}
- protected ExecuteStatementRequestMessage createRequestMessage(IRequestReference requestReference,
- String statementsText, SessionOutput sessionOutput, ResultProperties resultProperties,
- QueryServiceRequestParameters param, Map<String, String> optionalParameters,
- Map<String, byte[]> statementParameters, INCServiceContext ncCtx, MessageFuture responseFuture,
- ILangExtension.Language queryLanguage, String handleUrl, int stmtCategoryRestrictionMask,
- boolean forceDropDataset) {
+ protected ExecuteStatementRequestMessage createRequestMessage(IServletRequest request,
+ IRequestReference requestReference, String statementsText, SessionOutput sessionOutput,
+ ResultProperties resultProperties, QueryServiceRequestParameters param,
+ Map<String, String> optionalParameters, Map<String, byte[]> statementParameters, INCServiceContext ncCtx,
+ MessageFuture responseFuture, ILangExtension.Language queryLanguage, String handleUrl,
+ int stmtCategoryRestrictionMask, boolean forceDropDataset) {
return new ExecuteStatementRequestMessage(ncCtx.getNodeId(), responseFuture.getFutureId(), queryLanguage,
statementsText, sessionOutput.config(), resultProperties.getNcToCcResultProperties(),
param.getClientContextID(), handleUrl, optionalParameters, statementParameters,
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryServiceServlet.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryServiceServlet.java
index dea46f2..f394794 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryServiceServlet.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryServiceServlet.java
@@ -301,9 +301,9 @@
IStatementExecutor.StatementProperties statementProperties =
new IStatementExecutor.StatementProperties();
response.setStatus(HttpResponseStatus.OK);
- executeStatement(requestRef, statementsText, sessionOutput, resultProperties, statementProperties,
- stats, param, executionState, param.getOptionalParams(), statementParams, responsePrinter,
- warnings);
+ executeStatement(request, requestRef, statementsText, sessionOutput, resultProperties,
+ statementProperties, stats, param, executionState, param.getOptionalParams(), statementParams,
+ responsePrinter, warnings);
executionState.setStatus(ResultStatus.SUCCESS, HttpResponseStatus.OK);
}
errorCount = 0;
@@ -386,7 +386,7 @@
return new ResultUtil.ParseOnlyResult(extVars);
}
- protected void executeStatement(IRequestReference requestReference, String statementsText,
+ protected void executeStatement(IServletRequest request, IRequestReference requestReference, String statementsText,
SessionOutput sessionOutput, ResultProperties resultProperties,
IStatementExecutor.StatementProperties statementProperties, Stats stats,
QueryServiceRequestParameters param, RequestExecutionState executionState,
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/message/ExecuteStatementRequestMessage.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/message/ExecuteStatementRequestMessage.java
index 66a6dde..d3345fb 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/message/ExecuteStatementRequestMessage.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/message/ExecuteStatementRequestMessage.java
@@ -72,8 +72,8 @@
public static final long DEFAULT_NC_TIMEOUT_MILLIS = TimeUnit.MILLISECONDS.toMillis(Long.MAX_VALUE);
//TODO: Make configurable: https://issues.apache.org/jira/browse/ASTERIXDB-2063
public static final long DEFAULT_QUERY_CANCELLATION_WAIT_MILLIS = TimeUnit.MINUTES.toMillis(1);
- private final String requestNodeId;
- private final long requestMessageId;
+ protected final String requestNodeId;
+ protected final long requestMessageId;
private final ILangExtension.Language lang;
private final String statementsText;
private final SessionConfig sessionConfig;
@@ -178,6 +178,11 @@
}
}
+ protected CCMessageBroker getMessageBroker(ICcApplicationContext ccAppCtx) {
+ ICCServiceContext ccSrvContext = ccAppCtx.getServiceContext();
+ return (CCMessageBroker) ccSrvContext.getMessageBroker();
+ }
+
static RuntimeDataException getRejectionReason(ClusterControllerService ccSrv, String requestNodeId) {
if (ccSrv.getNodeManager().getNodeControllerState(requestNodeId) == null) {
return new RuntimeDataException(ErrorCode.REJECT_NODE_UNREGISTERED);
@@ -191,7 +196,7 @@
return null;
}
- static void sendRejection(RuntimeDataException reason, CCMessageBroker messageBroker, long requestMessageId,
+ protected static void sendRejection(Exception reason, CCMessageBroker messageBroker, long requestMessageId,
String requestNodeId) {
ExecuteStatementResponseMessage responseMsg = new ExecuteStatementResponseMessage(requestMessageId);
responseMsg.setError(reason);
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/NcLifecycleCoordinator.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/NcLifecycleCoordinator.java
index 7576e0d..d22e9fc 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/NcLifecycleCoordinator.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/NcLifecycleCoordinator.java
@@ -18,6 +18,9 @@
*/
package org.apache.asterix.app.replication;
+import static org.apache.hyracks.api.exceptions.ErrorCode.NODE_FAILED;
+
+import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -49,6 +52,7 @@
import org.apache.asterix.common.replication.INcLifecycleCoordinator;
import org.apache.asterix.common.transactions.IRecoveryManager.SystemState;
import org.apache.asterix.metadata.MetadataManager;
+import org.apache.asterix.replication.messaging.ReplicaFailedMessage;
import org.apache.hyracks.api.application.ICCServiceContext;
import org.apache.hyracks.api.client.NodeStatus;
import org.apache.hyracks.api.control.IGatekeeper;
@@ -80,12 +84,15 @@
}
@Override
- public void notifyNodeFailure(String nodeId) throws HyracksDataException {
+ public void notifyNodeFailure(String nodeId, InetSocketAddress replicaAddress) throws HyracksDataException {
pendingStartupCompletionNodes.remove(nodeId);
clusterManager.updateNodeState(nodeId, false, null);
if (nodeId.equals(metadataNodeId)) {
clusterManager.updateMetadataNode(metadataNodeId, false);
}
+ if (replicaAddress != null) {
+ notifyFailedReplica(clusterManager, nodeId, replicaAddress);
+ }
clusterManager.refreshState();
}
@@ -229,4 +236,19 @@
throw HyracksDataException.create(e);
}
}
+
+ private void notifyFailedReplica(IClusterStateManager clusterManager, String nodeID,
+ InetSocketAddress replicaAddress) {
+ LOGGER.info("notify replica failure of nodeId {} at {}", nodeID, replicaAddress);
+ Set<String> ncs = clusterManager.getParticipantNodes(true);
+ ReplicaFailedMessage message =
+ new ReplicaFailedMessage(replicaAddress, HyracksDataException.create(NODE_FAILED, nodeID));
+ for (String nodeId : ncs) {
+ try {
+ messageBroker.sendApplicationMessageToNC(message, nodeId);
+ } catch (Exception e) {
+ LOGGER.info("failed to notify replica failure to node {}", nodeID);
+ }
+ }
+ }
}
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
index e202ddf..44038cc 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
@@ -42,6 +42,8 @@
import java.net.URISyntaxException;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.text.MessageFormat;
import java.util.ArrayDeque;
import java.util.ArrayList;
@@ -161,6 +163,7 @@
private static final Pattern HANDLE_VARIABLE_PATTERN = Pattern.compile("handlevariable=(\\w+)");
private static final Pattern RESULT_VARIABLE_PATTERN = Pattern.compile("resultvariable=(\\w+)");
private static final Pattern COMPARE_UNORDERED_ARRAY_PATTERN = Pattern.compile("compareunorderedarray=(\\w+)");
+ private static final Pattern BODY_REF_PATTERN = Pattern.compile("bodyref=(.*)", Pattern.MULTILINE);
private static final Pattern MACRO_PARAM_PATTERN =
Pattern.compile("macro (?<name>[\\w-$]+)=(?<value>.*)", Pattern.MULTILINE);
@@ -1329,12 +1332,16 @@
final String trimmedPathAndQuery = stripAllComments(statement).trim();
final String variablesReplaced = replaceVarRef(trimmedPathAndQuery, variableCtx);
final List<Parameter> params = extractParameters(statement);
- final Optional<String> body = extractBody(statement);
+ Optional<String> body = extractBody(statement);
final Predicate<Integer> statusCodePredicate = extractStatusCodePredicate(statement);
final boolean extracResult = isExtracResult(statement);
final boolean extractStatus = isExtractStatus(statement);
final String mimeReqType = extractHttpRequestType(statement);
+ final String saveResponseVar = getResultVariable(statement);
ContentType contentType = mimeReqType != null ? ContentType.create(mimeReqType, UTF_8) : TEXT_PLAIN_UTF8;
+ if (!body.isPresent()) {
+ body = getBodyFromReference(statement, variableCtx);
+ }
InputStream resultStream;
if ("http".equals(extension)) {
resultStream = executeHttp(reqType, variablesReplaced, fmt, params, statusCodePredicate, body, contentType);
@@ -1356,6 +1363,8 @@
} else {
throw new Exception("no handle for test " + testFile.toString());
}
+ } else if (saveResponseVar != null) {
+ variableCtx.put(saveResponseVar, IOUtils.toString(resultStream, UTF_8));
} else {
if (expectedResultFile == null) {
if (testFile.getName().startsWith(DIAGNOSE)) {
@@ -1689,6 +1698,27 @@
return resultVariableMatcher.find() ? resultVariableMatcher.group(1) : null;
}
+ protected static Optional<String> getBodyFromReference(String statement, Map<String, Object> varMap)
+ throws IOException {
+ Optional<String> bodyRef = findPattern(statement, BODY_REF_PATTERN);
+ if (!bodyRef.isPresent()) {
+ return Optional.empty();
+ }
+ String bodyReference = bodyRef.get();
+ String body = (String) varMap.get(bodyReference);
+ if (body != null) {
+ return Optional.of(body);
+ }
+ try (Stream<String> stream = Files.lines(Paths.get(bodyReference), UTF_8)) {
+ return Optional.of(stream.collect(Collectors.joining()));
+ }
+ }
+
+ protected static Optional<String> findPattern(String statement, Pattern pattern) {
+ final Matcher matcher = pattern.matcher(statement);
+ return matcher.find() ? Optional.of(matcher.group(1)) : Optional.empty();
+ }
+
protected static boolean getCompareUnorderedArray(String statement) {
final Matcher matcher = COMPARE_UNORDERED_ARRAY_PATTERN.matcher(statement);
return matcher.find() && Boolean.parseBoolean(matcher.group(1));
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/txn/LogManagerTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/txn/LogManagerTest.java
index 495a967..685d983 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/txn/LogManagerTest.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/txn/LogManagerTest.java
@@ -201,7 +201,7 @@
return txnCtx;
}
- private static void prepareNextLogFile(LogManager logManager) throws Exception {
+ public static void prepareNextLogFile(LogManager logManager) throws Exception {
Method ensureLastPageFlushed;
Method prepareNextLogFile;
String targetMethod = null;
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/txn/RecoveryManagerTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/txn/RecoveryManagerTest.java
index 59d7fae..4f8df3d 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/txn/RecoveryManagerTest.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/txn/RecoveryManagerTest.java
@@ -22,7 +22,9 @@
import org.apache.asterix.api.common.AsterixHyracksIntegrationUtil;
import org.apache.asterix.common.TestDataUtil;
+import org.apache.asterix.common.api.INcApplicationContext;
import org.apache.asterix.metadata.bootstrap.MetadataBuiltinEntities;
+import org.apache.asterix.transaction.management.service.logging.LogManager;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -102,4 +104,20 @@
final long countAfterRecovery = TestDataUtil.getDatasetCount(datasetName);
Assert.assertEquals(countBeforeRecovery, countAfterRecovery);
}
+
+ @Test
+ public void recoveryWithEmptyLogFile() throws Exception {
+ String datasetName = "ds";
+ TestDataUtil.createIdOnlyDataset(datasetName);
+ TestDataUtil.upsertData(datasetName, 10);
+ final INcApplicationContext ncAppCtx = (INcApplicationContext) integrationUtil.ncs[0].getApplicationContext();
+ final LogManager logManager = (LogManager) ncAppCtx.getTransactionSubsystem().getLogManager();
+ // do ungraceful shutdown to enforce recovery
+ integrationUtil.deinit(false);
+ // create empty txn log file
+ LogManagerTest.prepareNextLogFile(logManager);
+ // ensure recovery completes
+ integrationUtil.init(false, TEST_CONFIG_FILE_PATH);
+ TestDataUtil.upsertData(datasetName, 10);
+ }
}
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join-noeqjoin/ngram-edit-distance-inline.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join-noeqjoin/ngram-edit-distance-inline.sqlpp
index c29de43..7c71c3e 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join-noeqjoin/ngram-edit-distance-inline.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join-noeqjoin/ngram-edit-distance-inline.sqlpp
@@ -44,6 +44,8 @@
create index ngram_index on DBLP (authors) type ngram (3);
write output to asterix_nc1:"rttest/inverted-index-join-noeqjoin_ngram-edit-distance-inline.adm";
+set `compiler.internal.sanitycheck` "false";
+
select element {'aauthors':a.authors,'bauthors':b.authors,'ed':ed}
from DBLP as a,
DBLP as b
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join-noeqjoin/ngram-fuzzyeq-edit-distance.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join-noeqjoin/ngram-fuzzyeq-edit-distance.sqlpp
index 1234824..30ea450 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join-noeqjoin/ngram-fuzzyeq-edit-distance.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join-noeqjoin/ngram-fuzzyeq-edit-distance.sqlpp
@@ -55,8 +55,8 @@
write output to asterix_nc1:"rttest/inverted-index-join-noeqjoin_ngram-fuzzyeq-edit-distance.adm";
set `simfunction` `edit-distance`;
-
set `simthreshold` `3`;
+set `compiler.internal.sanitycheck` "false";
select element {'aauthors':a.authors,'bauthors':b.authors}
from DBLP as a,
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join-noeqjoin/olist-edit-distance-inline.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join-noeqjoin/olist-edit-distance-inline.sqlpp
index 40c8c5f..0638b0c 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join-noeqjoin/olist-edit-distance-inline.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join-noeqjoin/olist-edit-distance-inline.sqlpp
@@ -56,6 +56,8 @@
create index interests_index on Customers (interests) type keyword;
write output to asterix_nc1:"rttest/inverted-index-join-noeqjoin_olist-edit-distance-inline.adm";
+set `compiler.internal.sanitycheck` "false";
+
select element {'ainterests':a.interests,'binterests':b.interests,'ed':ed}
from Customers as a,
Customers as b
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.sqlpp
index 8c2869f..157d4e4 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.sqlpp
@@ -66,6 +66,8 @@
create index topicKeywordIx on TweetMessages (`referred-topics`) type keyword;
write output to asterix_nc1:"rttest/inverted-index-join_leftouterjoin-probe-pidx-with-join-edit-distance-check_idx_01.adm";
+set `compiler.internal.sanitycheck` "false";
+
select element {'tweet':{'id':t1.tweetid,'topics':t1.`message-text`},'similar-tweets':(
select element {'id':t2.tweetid,'topics':t2.`message-text`}
from TweetMessages as t2
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01_ps.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01_ps.sqlpp
index 2c5ac71..691bcca 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01_ps.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01_ps.sqlpp
@@ -28,7 +28,6 @@
use test;
-
create type test.TwitterUserType as
closed {
`screen-name` : string,
@@ -67,6 +66,7 @@
write output to asterix_nc1:"rttest/inverted-index-join_leftouterjoin-probe-pidx-with-join-edit-distance-check_idx_01.adm";
set `compiler.sort.parallel` "true";
+set `compiler.internal.sanitycheck` "false";
select element {'tweet':{'id':t1.tweetid,'topics':t1.`message-text`},'similar-tweets':(
select element {'id':t2.tweetid,'topics':t2.`message-text`}
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance-check_02.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance-check_02.sqlpp
index a6ade32..6549c0f 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance-check_02.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance-check_02.sqlpp
@@ -53,6 +53,8 @@
create index ngram_index on CSX (authors) type ngram (3);
write output to asterix_nc1:"rttest/inverted-index-join_ngram-edit-distance-check_02.adm";
+set `compiler.internal.sanitycheck` "false";
+
select element {'arec':a,'brec':b}
from DBLP as a,
CSX as b
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance-check_03.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance-check_03.sqlpp
index ed8d6b6..274a4c0 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance-check_03.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance-check_03.sqlpp
@@ -42,6 +42,8 @@
create index ngram_index on DBLP (authors) type ngram (3);
write output to asterix_nc1:"rttest/inverted-index-join_ngram-edit-distance-check_03.adm";
+set `compiler.internal.sanitycheck` "false";
+
select element {'arec':a,'brec':b}
from DBLP as a,
DBLP as b
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance-check_04.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance-check_04.sqlpp
index 7a24772..2e7e6da 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance-check_04.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance-check_04.sqlpp
@@ -43,6 +43,8 @@
create index ngram_index on DBLP (authors) type ngram (3);
write output to asterix_nc1:"rttest/inverted-index-join_ngram-edit-distance-check_04.adm";
+set `compiler.internal.sanitycheck` "false";
+
select element {'arec':a,'brec':b,'ed':ed[1]}
from DBLP as a,
DBLP as b
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance_02.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance_02.sqlpp
index 950a058..246d50e 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance_02.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance_02.sqlpp
@@ -53,6 +53,8 @@
create index ngram_index on CSX (authors) type ngram (3);
write output to asterix_nc1:"rttest/inverted-index-join_ngram-edit-distance_02.adm";
+set `compiler.internal.sanitycheck` "false";
+
select element {'arec':a,'brec':b}
from DBLP as a,
CSX as b
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance_03.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance_03.sqlpp
index dc8ca3c..a12ab9a 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance_03.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance_03.sqlpp
@@ -42,6 +42,8 @@
create index ngram_index on DBLP (authors) type ngram (3);
write output to asterix_nc1:"rttest/inverted-index-join_ngram-edit-distance_03.adm";
+set `compiler.internal.sanitycheck` "false";
+
select element {'arec':a,'brec':b}
from DBLP as a,
DBLP as b
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance_04.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance_04.sqlpp
index 0284ff4..fe2cde2 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance_04.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-edit-distance_04.sqlpp
@@ -43,6 +43,8 @@
create index ngram_index on DBLP (authors) type ngram (3);
write output to asterix_nc1:"rttest/inverted-index-join_ngram-edit-distance_03.adm";
+set `compiler.internal.sanitycheck` "false";
+
select element {'arec':a,'brec':b,'ed':ed}
from DBLP as a,
DBLP as b
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-fuzzyeq-edit-distance_01.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-fuzzyeq-edit-distance_01.sqlpp
index 2021605..522a4f8 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-fuzzyeq-edit-distance_01.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-fuzzyeq-edit-distance_01.sqlpp
@@ -54,8 +54,8 @@
write output to asterix_nc1:"rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm";
set `simfunction` `edit-distance`;
-
set `simthreshold` `3`;
+set `compiler.internal.sanitycheck` "false";
select element {'arec':a,'brec':b}
from DBLP as a,
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-fuzzyeq-edit-distance_03.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-fuzzyeq-edit-distance_03.sqlpp
index d900a72..c3a34b3 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-fuzzyeq-edit-distance_03.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-fuzzyeq-edit-distance_03.sqlpp
@@ -43,8 +43,8 @@
write output to asterix_nc1:"rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_03.adm";
set `simfunction` `edit-distance`;
-
set `simthreshold` `3`;
+set `compiler.internal.sanitycheck` "false";
select element {'arec':a,'brec':b}
from DBLP as a,
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance-check_02.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance-check_02.sqlpp
index f7e6047..1a9cd82 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance-check_02.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance-check_02.sqlpp
@@ -56,6 +56,8 @@
create index interests_index on Customers2 (interests) type keyword;
write output to asterix_nc1:"rttest/inverted-index-join_olist-edit-distance-check_02.adm";
+set `compiler.internal.sanitycheck` "false";
+
select element {'arec':a,'brec':b}
from Customers as a,
Customers2 as b
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance-check_03.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance-check_03.sqlpp
index 6435990..78645c7 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance-check_03.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance-check_03.sqlpp
@@ -54,6 +54,8 @@
create index interests_index on Customers (interests) type keyword;
write output to asterix_nc1:"rttest/inverted-index-join_olist-edit-distance-check_03.adm";
+set `compiler.internal.sanitycheck` "false";
+
select element {'arec':a,'brec':b}
from Customers as a,
Customers as b
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance-check_04.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance-check_04.sqlpp
index 9f14368..cffc18b 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance-check_04.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance-check_04.sqlpp
@@ -55,6 +55,8 @@
create index interests_index on Customers (interests) type keyword;
write output to asterix_nc1:"rttest/inverted-index-join_olist-edit-distance-check_04.adm";
+set `compiler.internal.sanitycheck` "false";
+
select element {'arec':a,'brec':b,'ed':ed[1]}
from Customers as a,
Customers as b
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance_02.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance_02.sqlpp
index 5ebb518..d66efdf 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance_02.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance_02.sqlpp
@@ -56,6 +56,8 @@
create index interests_index on Customers2 (interests) type keyword;
write output to asterix_nc1:"rttest/inverted-index-join_olist-edit-distance_02.adm";
+set `compiler.internal.sanitycheck` "false";
+
select element {'arec':a,'brec':b}
from Customers as a,
Customers2 as b
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance_03.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance_03.sqlpp
index ac7e6ba..f8cd85b 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance_03.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance_03.sqlpp
@@ -54,6 +54,8 @@
create index interests_index on Customers (interests) type keyword;
write output to asterix_nc1:"rttest/inverted-index-join_olist-edit-distance_03.adm";
+set `compiler.internal.sanitycheck` "false";
+
select element {'arec':a,'brec':b}
from Customers as a,
Customers as b
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance_04.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance_04.sqlpp
index 0655746..4a78cee 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance_04.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-edit-distance_04.sqlpp
@@ -55,6 +55,8 @@
create index interests_index on Customers (interests) type keyword;
write output to asterix_nc1:"rttest/inverted-index-join_olist-edit-distance_04.adm";
+set `compiler.internal.sanitycheck` "false";
+
select element {'arec':a,'brec':b,'ed':ed}
from Customers as a,
Customers as b
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-fuzzyeq-edit-distance_02.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-fuzzyeq-edit-distance_02.sqlpp
index cd3d74f..3fe35d6 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-fuzzyeq-edit-distance_02.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-fuzzyeq-edit-distance_02.sqlpp
@@ -57,8 +57,8 @@
write output to asterix_nc1:"rttest/inverted-index-join_olist-fuzzyeq-jaccard_02.adm";
set `simfunction` `edit-distance`;
-
set `simthreshold` `3`;
+set `compiler.internal.sanitycheck` "false";
select element {'arec':a,'brec':b}
from Customers as a,
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-fuzzyeq-edit-distance_03.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-fuzzyeq-edit-distance_03.sqlpp
index a184602..8db10eeb 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-fuzzyeq-edit-distance_03.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-fuzzyeq-edit-distance_03.sqlpp
@@ -55,8 +55,8 @@
write output to asterix_nc1:"rttest/inverted-index-join_olist-fuzzyeq-jaccard_03.adm";
set `simfunction` `edit-distance`;
-
set `simthreshold` `3`;
+set `compiler.internal.sanitycheck` "false";
select element {'arec':a,'brec':b}
from Customers as a,
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01_ps.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01_ps.sqlpp
index bfd2bf4..e61386b 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01_ps.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01_ps.sqlpp
@@ -62,6 +62,7 @@
write output to asterix_nc1:"rttest/inverted-index-join_leftouterjoin-probe-pidx-with-join-edit-distance-check_idx_01.adm";
set `compiler.sort.parallel` "true";
+set `compiler.internal.sanitycheck` "false";
select element {'tweet':{'id':t1.nested.tweetid,'topics':t1.nested.`message-text`},'similar-tweets':(
select element {'id':t2.nested.tweetid,'topics':t2.nested.`message-text`}
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01_ps.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01_ps.sqlpp
index 0a55178..3a5e14f 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01_ps.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01_ps.sqlpp
@@ -61,6 +61,7 @@
write output to asterix_nc1:"rttest/inverted-index-join_leftouterjoin-probe-pidx-with-join-edit-distance-check_idx_01.adm";
set `compiler.sort.parallel` "true";
+set `compiler.internal.sanitycheck` "false";
select element {'tweet':{'id':t1.nested.tweetid,'topics':t1.nested.`message-text`},'similar-tweets':(
select element {'id':t2.nested.tweetid,'topics':t2.nested.`message-text`}
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01_ps.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01_ps.sqlpp
index 2d9b15b..d81fcd9 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01_ps.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01_ps.sqlpp
@@ -56,6 +56,7 @@
write output to asterix_nc1:"rttest/inverted-index-join_leftouterjoin-probe-pidx-with-join-edit-distance-check_idx_01.adm";
set `compiler.sort.parallel` "true";
+set `compiler.internal.sanitycheck` "false";
select element {'tweet':{'id':t1.tweetid,'topics':t1.`message-text`},'similar-tweets':(
select element {'id':t2.tweetid,'topics':t2.`message-text`}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/s3/non-s3-region/external_dataset.000.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/s3/non-s3-region/external_dataset.000.ddl.sqlpp
new file mode 100644
index 0000000..3b22f11
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/s3/non-s3-region/external_dataset.000.ddl.sqlpp
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+/*
+ * Creating an external dataset should not fail when non-s3-region is used (some-new-region)
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use test;
+
+drop type test if exists;
+create type test as open {
+};
+
+drop dataset test if exists;
+create external dataset test(test) using S3 (
+ ("accessKeyId"="dummyAccessKey"),
+ ("secretAccessKey"="dummySecretKey"),
+ ("region"="some-new-region"),
+ ("serviceEndpoint"="http://localhost:8001"),
+ ("container"="playground"),
+ ("definition"="json-data/reviews/single-line/json"),
+ ("format"="json")
+);
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/s3/non-s3-region/external_dataset.099.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/s3/non-s3-region/external_dataset.099.ddl.sqlpp
new file mode 100644
index 0000000..548e632
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-dataset/s3/non-s3-region/external_dataset.099.ddl.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+drop dataverse test if exists;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/grouping-sets-1/grouping-sets-1.16.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/grouping-sets-1/grouping-sets-1.16.query.sqlpp
new file mode 100644
index 0000000..eb3ffc3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/grouping-sets-1/grouping-sets-1.16.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+use test;
+
+select two, four, array_sum((select value gi.tenk.ten from g as gi)) as agg_sum
+from tenk
+group by rollup(two,four) group as g
+order by two, four;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/grouping-sets-1/grouping-sets-1.17.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/grouping-sets-1/grouping-sets-1.17.query.sqlpp
new file mode 100644
index 0000000..388a9f5
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/grouping-sets-1/grouping-sets-1.17.query.sqlpp
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+use test;
+
+select two, four, sum(ten) as agg_sum
+from (
+ select two, four, ten
+ from tenk
+ where hundred < 20
+
+ union all
+
+ select two, four, ten
+ from tenk
+ where hundred >= 80
+) x
+group by rollup(two,four) group as g
+order by two, four;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/grouping-sets-1/grouping-sets-1.18.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/grouping-sets-1/grouping-sets-1.18.query.sqlpp
new file mode 100644
index 0000000..4ffb15d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/grouping-sets-1/grouping-sets-1.18.query.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+use test;
+
+select two, two + four as two_plus_four,
+ grouping(two) as grp_two, grouping(two + four) as grp_two_plus_four,
+ sum(ten) as agg_sum
+from tenk
+group by rollup(two, two + four)
+order by two, two_plus_four;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/grouping-sets-1/grouping-sets-1.19.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/grouping-sets-1/grouping-sets-1.19.query.sqlpp
new file mode 100644
index 0000000..3792030
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/grouping-sets-1/grouping-sets-1.19.query.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+use test;
+
+with total_sum as (
+ select value sum(ten) from tenk
+)[0]
+
+select two, four, sum(ten) as agg_sum, total_sum
+from tenk
+group by rollup(two, four)
+order by two, four;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.query.sqlpp
index 6503f24..e58d44c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.query.sqlpp
@@ -25,6 +25,7 @@
use test;
+set `compiler.internal.sanitycheck` "false";
select element {'tweet':{'id':t1.tweetid,'topics':t1.`message-text`},'similar-tweets':(
select element {'id':t2.tweetid,'topics':t2.`message-text`}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/metadata_only_01/metadata_only_01.2.plans.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/metadata_only_01/metadata_only_01.2.plans.sqlpp
new file mode 100644
index 0000000..0b6fdbf
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/metadata_only_01/metadata_only_01.2.plans.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+/* Test that a metadata-only query gets a normal memory budget instead of the compiler-allocated memory */
+
+-- param job:string=true
+
+SET `compiler.parallelism` "1";
+SET `compiler.min.memory.allocation` "false";
+SET `compiler.sortmemory` "320KB";
+SET `compiler.groupmemory` "160KB";
+SET `compiler.joinmemory` "256KB";
+SET `compiler.textsearchmemory` "160KB";
+
+from Metadata.`Dataset` ds
+join Metadata.`Index` idx
+on ds.DataverseName = idx.DataverseName and ds.DatasetName = idx.DatasetName
+where contains(ds.DataverseName, "Metadata")
+ and ds.DatasetName in ["Dataverse", "Dataset", "Index"]
+ and idx.IsPrimary
+group by ds.DataverseName
+select value count(*);
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.query.sqlpp
index a98f152..2a5f1c7 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.query.sqlpp
@@ -25,6 +25,7 @@
use test;
+set `compiler.internal.sanitycheck` "false";
select element {'tweet':{'id':t1.nested.tweetid,'topics':t1.nested.`message-text`},'similar-tweets':(
select element {'id':t2.nested.tweetid,'topics':t2.nested.`message-text`}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.query.sqlpp
index e5d44e8..0a214d7 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.query.sqlpp
@@ -25,6 +25,7 @@
use test;
+set `compiler.internal.sanitycheck` "false";
select element {'tweet':{'id':t1.tweetid,'topics':t1.`message-text`},'similar-tweets':(
select element {'id':t2.nested.tweetid,'topics':t2.nested.`message-text`}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.query.sqlpp
index f441956..b249bfd 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.query.sqlpp
@@ -25,6 +25,7 @@
use test;
+set `compiler.internal.sanitycheck` "false";
select element {'tweet':{'id':t1.tweetid,'topics':t1.`message-text`},'similar-tweets':(
select element {'id':t2.tweetid,'topics':t2.`message-text`}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q05/q05.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q05/q05.1.ddl.sqlpp
new file mode 100644
index 0000000..f02107b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q05/q05.1.ddl.sqlpp
@@ -0,0 +1,337 @@
+/*
+ * 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.
+ */
+
+drop dataverse tpcds if exists;
+create dataverse tpcds;
+
+use tpcds;
+
+create type tpcds.store_type as
+ closed {
+ s_store_sk : bigint,
+ s_store_id : string,
+ s_rec_start_date : string?,
+ s_rec_end_date : string?,
+ s_closed_date_sk : bigint?,
+ s_store_name : string?,
+ s_number_employees : bigint?,
+ s_floor_space : bigint?,
+ s_hours : string?,
+ s_manager : string?,
+ s_market_id : bigint?,
+ s_geography_class : string?,
+ s_market_desc : string?,
+ s_market_manager : string?,
+ s_division_id : bigint?,
+ s_division_name : string?,
+ s_company_id : bigint?,
+ s_company_name : string?,
+ s_street_number : string?,
+ s_street_name : string?,
+ s_street_type : string?,
+ s_suite_number : string?,
+ s_city : string?,
+ s_county : string?,
+ s_state : string?,
+ s_zip : string?,
+ s_country : string?,
+ s_gmt_offset : double?,
+ s_tax_precentage : double?
+};
+
+create type tpcds.store_sales_type as
+ closed {
+ ss_sold_date_sk: bigint?,
+ ss_sold_time_sk: bigint?,
+ ss_item_sk: bigint,
+ ss_customer_sk: bigint?,
+ ss_cdemo_sk: bigint?,
+ ss_hdemo_sk: bigint?,
+ ss_addr_sk: bigint?,
+ ss_store_sk: bigint?,
+ ss_promo_sk: bigint?,
+ ss_ticket_number: bigint,
+ ss_quantity: bigint?,
+ ss_wholesale_cost: double?,
+ ss_list_price: double?,
+ ss_sales_price: double?,
+ ss_ext_discount_amt: double?,
+ ss_ext_sales_price: double?,
+ ss_ext_wholesale_cost: double?,
+ ss_ext_list_price: double?,
+ ss_ext_tax: double?,
+ ss_coupon_amt: double?,
+ ss_net_paid: double?,
+ ss_net_paid_inc_tax: double?,
+ ss_net_profit: double?
+};
+
+create type tpcds.store_returns_type as
+ closed {
+ sr_returned_date_sk : int64?,
+ sr_return_time_sk : int64?,
+ sr_item_sk : int64,
+ sr_customer_sk : int64?,
+ sr_cdemo_sk : int64?,
+ sr_hdemo_sk : int64?,
+ sr_addr_sk : int64?,
+ sr_store_sk : int64?,
+ sr_reason_sk : int64?,
+ sr_ticket_number : int64,
+ sr_return_quantity : int64?,
+ sr_return_amt : double,
+ sr_return_tax : double?,
+ sr_return_amt_inc_tax : double?,
+ sr_fee : double?,
+ sr_return_ship_cost : double?,
+ sr_refunded_cash : double?,
+ sr_reversed_charge : double?,
+ sr_store_credit : double?,
+ sr_net_loss : double?
+};
+
+create type tpcds.catalog_page_type as
+ closed {
+ cp_catalog_page_sk: bigint,
+ cp_catalog_page_id: string,
+ cp_start_date_sk: bigint?,
+ cp_end_date_sk: bigint?,
+ cp_department: string?,
+ cp_catalog_number: bigint?,
+ cp_catalog_page_number: bigint?,
+ cp_description: string?,
+ cp_type: string?
+};
+
+create type tpcds.catalog_sales_type as
+ closed {
+ cs_sold_date_sk: bigint?,
+ cs_sold_time_sk: bigint?,
+ cs_ship_date_sk: bigint?,
+ cs_bill_customer_sk: bigint?,
+ cs_bill_cdemo_sk: bigint?,
+ cs_bill_hdemo_sk: bigint?,
+ cs_bill_addr_sk: bigint?,
+ cs_ship_customer_sk: bigint?,
+ cs_ship_cdemo_sk: bigint?,
+ cs_ship_hdemo_sk: bigint?,
+ cs_ship_addr_sk: bigint?,
+ cs_call_center_sk: bigint?,
+ cs_catalog_page_sk: bigint?,
+ cs_ship_mode_sk: bigint?,
+ cs_warehouse_sk: bigint?,
+ cs_item_sk: bigint,
+ cs_promo_sk: bigint?,
+ cs_order_number: bigint,
+ cs_quantity: bigint?,
+ cs_wholesale_cost: double?,
+ cs_list_price: double?,
+ cs_sales_price: double?,
+ cs_ext_discount_amt: double?,
+ cs_ext_sales_price: double?,
+ cs_ext_wholesale_cost: double?,
+ cs_ext_list_price: double?,
+ cs_ext_tax: double?,
+ cs_coupon_amt: double?,
+ cs_ext_ship_cost: double?,
+ cs_net_paid: double?,
+ cs_net_paid_inc_tax: double?,
+ cs_net_paid_inc_ship: double?,
+ cs_net_paid_inc_ship_tax: double?,
+ cs_net_profit: double?
+};
+
+create type tpcds.catalog_returns_type as
+ closed {
+ cr_returned_date_sk : bigint?,
+ cr_returned_time_sk : bigint?,
+ cr_item_sk : bigint,
+ cr_refunded_customer_sk : bigint?,
+ cr_refunded_cdemo_sk : bigint?,
+ cr_refunded_hdemo_sk : bigint?,
+ cr_refunded_addr_sk : bigint?,
+ cr_returning_customer_sk : bigint?,
+ cr_returning_cdemo_sk : bigint?,
+ cr_returning_hdemo_sk : bigint?,
+ cr_returning_addr_sk : bigint?,
+ cr_call_center_sk : bigint?,
+ cr_catalog_page_sk : bigint?,
+ cr_ship_mode_sk : bigint?,
+ cr_warehouse_sk : bigint?,
+ cr_reason_sk : bigint?,
+ cr_order_number : bigint,
+ cr_return_quantity : bigint?,
+ cr_return_amount : double?,
+ cr_return_tax : double?,
+ cr_return_amt_inc_tax : double?,
+ cr_fee : double?,
+ cr_return_ship_cost : double?,
+ cr_refunded_cash : double?,
+ cr_reversed_charge : double?,
+ cr_store_credit : double?,
+ cr_net_loss : double?
+};
+
+create type tpcds.web_site_type as
+ closed {
+ web_site_sk: bigint,
+ web_site_id: string,
+ web_rec_start_date: string?,
+ web_rec_end_date: string?,
+ web_name: string?,
+ web_open_date_sk: bigint?,
+ web_close_date_sk: bigint?,
+ web_class: string?,
+ web_manager: string?,
+ web_mkt_id: bigint?,
+ web_mkt_class: string?,
+ web_mkt_desc: string?,
+ web_market_manager: string?,
+ web_company_id: bigint?,
+ web_company_name: string?,
+ web_street_number: string?,
+ web_street_name: string?,
+ web_street_type: string?,
+ web_suite_number: string?,
+ web_city: string?,
+ web_county: string?,
+ web_state: string?,
+ web_zip: string?,
+ web_country: string?,
+ web_gmt_offset: double?,
+ web_tax_percentage: double?
+};
+
+create type tpcds.web_sales_type as
+ closed {
+ ws_sold_date_sk : int64?,
+ ws_sold_time_sk : int64?,
+ ws_ship_date_sk : int64?,
+ ws_item_sk : int64,
+ ws_bill_customer_sk : int64?,
+ ws_bill_cdemo_sk : int64?,
+ ws_bill_hdemo_sk : int64?,
+ ws_bill_addr_sk : int64?,
+ ws_ship_customer_sk : int64?,
+ ws_ship_cdemo_sk : int64?,
+ ws_ship_hdemo_sk : int64?,
+ ws_ship_addr_sk : int64?,
+ ws_web_page_sk : int64?,
+ ws_web_site_sk : int64?,
+ ws_ship_mode_sk : int64?,
+ ws_warehouse_sk : int64?,
+ ws_promo_sk : int64?,
+ ws_order_number : int64,
+ ws_quantity : int64?,
+ ws_wholesale_cost : double?,
+ ws_list_price : double?,
+ ws_sales_price : double?,
+ ws_ext_discount_amt : double?,
+ ws_ext_sales_price : double?,
+ ws_ext_wholesale_cost : double?,
+ ws_ext_list_price : double?,
+ ws_ext_tax : double?,
+ ws_coupon_amt : double?,
+ ws_ext_ship_cost : double?,
+ ws_net_paid : double?,
+ ws_net_paid_inc_tax : double?,
+ ws_net_paid_inc_ship : double?,
+ ws_net_paid_inc_ship_tax : double?,
+ ws_net_profit : double?
+};
+
+create type tpcds.web_returns_type as
+ closed {
+ wr_returned_date_sk : bigint?,
+ wr_returned_time_sk : bigint?,
+ wr_item_sk : bigint,
+ wr_refunded_customer_sk : bigint?,
+ wr_refunded_cdemo_sk : bigint?,
+ wr_refunded_hdemo_sk : bigint?,
+ wr_refunded_addr_sk : bigint?,
+ wr_returning_customer_sk : bigint?,
+ wr_returning_cdemo_sk : bigint?,
+ wr_returning_hdemo_sk : bigint?,
+ wr_returning_addr_sk : bigint?,
+ wr_web_page_sk : bigint?,
+ wr_reason_sk : bigint?,
+ wr_order_number : bigint,
+ wr_return_quantity : bigint?,
+ wr_return_amt : double?,
+ wr_return_tax : double?,
+ wr_return_amt_inc_tax : double?,
+ wr_fee : double?,
+ wr_return_ship_cost: double?,
+ wr_refunded_cash: double?,
+ wr_reversed_charge: double?,
+ wr_account_credit: double?,
+ wr_net_loss: double?
+};
+
+create type tpcds.date_dim_type as
+ closed {
+ d_date_sk : bigint,
+ d_date_id : string,
+ d_date : string?,
+ d_month_seq : bigint?,
+ d_week_seq : bigint?,
+ d_quarter_seq : bigint?,
+ d_year : bigint? ,
+ d_dow : bigint? ,
+ d_moy : bigint?,
+ d_dom : bigint?,
+ d_qoy : bigint?,
+ d_fy_year : bigint?,
+ d_fy_quarter_seq : bigint?,
+ d_fy_week_seq : bigint?,
+ d_day_name : string?,
+ d_quarter_name : string?,
+ d_holiday : string?,
+ d_weekend : string?,
+ d_following_holiday : string?,
+ d_first_dom : bigint?,
+ d_last_dom : bigint?,
+ d_same_day_ly : bigint?,
+ d_same_day_lq : bigint?,
+ d_current_day : string?,
+ d_current_week : string?,
+ d_current_month : string?,
+ d_current_quarter : string?,
+ d_current_year : string?
+};
+
+create dataset store (store_type) primary key s_store_sk;
+
+create dataset store_sales (store_sales_type) primary key ss_item_sk, ss_ticket_number;
+
+create dataset store_returns (store_returns_type) primary key sr_item_sk, sr_ticket_number;
+
+create dataset catalog_page (catalog_page_type) primary key cp_catalog_page_sk;
+
+create dataset catalog_sales (catalog_sales_type) primary key cs_item_sk, cs_order_number;
+
+create dataset catalog_returns (catalog_returns_type) primary key cr_item_sk, cr_order_number;
+
+create dataset web_site (web_site_type) primary key web_site_sk;
+
+create dataset web_sales (web_sales_type) primary key ws_item_sk, ws_order_number;
+
+create dataset web_returns (web_returns_type) primary key wr_item_sk, wr_order_number;
+
+create dataset date_dim(date_dim_type) primary key d_date_sk;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q05/q05.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q05/q05.2.update.sqlpp
new file mode 100644
index 0000000..9b66400
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q05/q05.2.update.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+use tpcds;
+
+load dataset store using localfs ((`path`=`asterix_nc1://data/tpcds/store.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset store_sales using localfs ((`path`=`asterix_nc1://data/tpcds/store_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset store_returns using localfs ((`path`=`asterix_nc1://data/tpcds/store_returns.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset catalog_page using localfs ((`path`=`asterix_nc1://data/tpcds/catalog_page.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset catalog_sales using localfs ((`path`=`asterix_nc1://data/tpcds/catalog_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset catalog_returns using localfs ((`path`=`asterix_nc1://data/tpcds/catalog_returns.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset web_site using localfs ((`path`=`asterix_nc1://data/tpcds/web_site.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset web_sales using localfs ((`path`=`asterix_nc1://data/tpcds/web_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset web_returns using localfs ((`path`=`asterix_nc1://data/tpcds/web_returns.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset date_dim using localfs ((`path`=`asterix_nc1://data/tpcds/date_dim.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q05/q05.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q05/q05.3.query.sqlpp
new file mode 100644
index 0000000..7997b21
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q05/q05.3.query.sqlpp
@@ -0,0 +1,155 @@
+/*
+ * 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.
+ */
+
+USE tpcds;
+
+WITH
+ssr AS (
+ SELECT s.s_store_id,
+ SUM(salesreturns.sales_price) AS sales,
+ SUM(salesreturns.profit) AS profit,
+ SUM(salesreturns.return_amt) AS returns,
+ SUM(salesreturns.net_loss) AS profit_loss
+ FROM (
+ SELECT ss_store_sk AS store_sk,
+ ss_sold_date_sk AS date_sk,
+ ss_ext_sales_price AS sales_price,
+ ss_net_profit AS profit,
+ 0 AS return_amt,
+ 0 AS net_loss
+ FROM store_sales
+
+ UNION ALL
+
+ SELECT sr_store_sk AS store_sk,
+ sr_returned_date_sk AS date_sk,
+ 0 AS sales_price,
+ 0 AS profit,
+ sr_return_amt AS return_amt,
+ sr_net_loss AS net_loss
+ FROM store_returns
+ ) salesreturns,
+ date_dim d,
+ store s
+ WHERE salesreturns.date_sk = d.d_date_sk
+ AND date(d.d_date) BETWEEN date('1998-01-01') AND (date('1998-01-01') + duration('P5Y'))
+ AND salesreturns.store_sk = s.s_store_sk
+ GROUP BY s.s_store_id
+),
+
+csr AS (
+ SELECT cp.cp_catalog_page_id,
+ SUM(salesreturns.sales_price) AS sales,
+ SUM(salesreturns.profit) AS profit,
+ SUM(salesreturns.return_amt) AS returns,
+ SUM(salesreturns.net_loss) AS profit_loss
+ FROM (
+ SELECT cs_catalog_page_sk AS page_sk,
+ cs_sold_date_sk AS date_sk,
+ cs_ext_sales_price AS sales_price,
+ cs_net_profit AS profit,
+ 0 AS return_amt,
+ 0 AS net_loss
+ FROM catalog_sales
+
+ UNION ALL
+
+ SELECT cr_catalog_page_sk AS page_sk,
+ cr_returned_date_sk AS date_sk,
+ 0 AS sales_price,
+ 0 AS profit,
+ cr_return_amount AS return_amt,
+ cr_net_loss AS net_loss
+ FROM catalog_returns
+ ) salesreturns,
+ date_dim d,
+ catalog_page cp
+ WHERE salesreturns.date_sk = d.d_date_sk
+ AND date(d.d_date) BETWEEN date('1998-01-01') AND (date('1998-01-01') + duration('P5Y'))
+ AND salesreturns.page_sk = cp.cp_catalog_page_sk
+ GROUP BY cp.cp_catalog_page_id
+),
+
+wsr AS (
+ SELECT web.web_site_id,
+ SUM(salesreturns.sales_price) AS sales,
+ SUM(salesreturns.profit) AS profit,
+ SUM(salesreturns.return_amt) AS returns,
+ SUM(salesreturns.net_loss) AS profit_loss
+ FROM (
+ SELECT ws_web_site_sk AS wsr_web_site_sk,
+ ws_sold_date_sk AS date_sk,
+ ws_ext_sales_price AS sales_price,
+ ws_net_profit AS profit,
+ 0 AS return_amt,
+ 0 AS net_loss
+ FROM web_sales
+
+ UNION ALL
+
+ SELECT ws.ws_web_site_sk AS wsr_web_site_sk,
+ wr.wr_returned_date_sk AS date_sk,
+ 0 AS sales_price,
+ 0 AS profit,
+ wr.wr_return_amt AS return_amt,
+ wr.wr_net_loss AS net_loss
+ FROM web_returns wr LEFT OUTER JOIN web_sales ws
+ ON ( wr.wr_item_sk = ws.ws_item_sk AND wr.wr_order_number = ws.ws_order_number)
+ ) salesreturns,
+ date_dim d,
+ web_site web
+ WHERE salesreturns.date_sk = d.d_date_sk
+ AND date(d.d_date) BETWEEN date('1998-01-01') AND (date('1998-01-01') + duration('P5Y'))
+ AND salesreturns.wsr_web_site_sk = web.web_site_sk
+ GROUP BY web.web_site_id
+)
+
+SELECT channel, id,
+ ROUND(SUM(sales), 2) AS sales,
+ ROUND(SUM(returns), 2) AS returns,
+ ROUND(SUM(profit), 2) AS profit
+FROM (
+ SELECT 'store channel' AS channel,
+ 'store' || s_store_id AS id,
+ sales,
+ returns,
+ (profit - profit_loss) AS profit
+ FROM ssr
+
+ UNION ALL
+
+ SELECT 'catalog channel' AS channel,
+ 'catalog_page' || cp_catalog_page_id AS id,
+ sales,
+ returns,
+ (profit - profit_loss) AS profit
+ FROM csr
+
+ UNION ALL
+
+ SELECT 'web channel' AS channel,
+ 'web_site' || web_site_id AS id,
+ sales,
+ returns,
+ (profit - profit_loss) AS profit
+ FROM wsr
+) x
+GROUP BY ROLLUP (channel, id)
+ORDER BY channel, id
+LIMIT 100;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q15/q15.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q15/q15.1.ddl.sqlpp
index 3c40721..66a4d36 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q15/q15.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q15/q15.1.ddl.sqlpp
@@ -54,6 +54,7 @@
cs_ship_hdemo_sk: bigint?,
cs_ship_addr_sk: bigint?,
cs_call_center_sk: bigint?,
+ cs_catalog_page_sk: bigint?,
cs_ship_mode_sk: bigint?,
cs_warehouse_sk: bigint?,
cs_item_sk: bigint,
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q15/q15.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q15/q15.2.update.sqlpp
index 5159a42..b2f60d4 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q15/q15.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q15/q15.2.update.sqlpp
@@ -20,10 +20,10 @@
use tpcds;
-load dataset customer_address using localfs ((`path`=`asterix_nc1://data/tpcds/customer_address.csv`),(`format`=`delimited-text`),(`delimiter`=`|`));
+load dataset customer_address using localfs ((`path`=`asterix_nc1://data/tpcds/customer_address.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
-load dataset catalog_sales using localfs ((`path`=`asterix_nc1://data/tpcds/catalog_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`));
+load dataset catalog_sales using localfs ((`path`=`asterix_nc1://data/tpcds/catalog_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
-load dataset date_dim using localfs ((`path`=`asterix_nc1://data/tpcds/date_dim.csv`),(`format`=`delimited-text`),(`delimiter`=`|`));
+load dataset date_dim using localfs ((`path`=`asterix_nc1://data/tpcds/date_dim.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
-load dataset customer using localfs ((`path`=`asterix_nc1://data/tpcds/customer.csv`),(`format`=`delimited-text`),(`delimiter`=`|`));
+load dataset customer using localfs ((`path`=`asterix_nc1://data/tpcds/customer.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q18/q18.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q18/q18.1.ddl.sqlpp
new file mode 100644
index 0000000..85e3a8c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q18/q18.1.ddl.sqlpp
@@ -0,0 +1,183 @@
+/*
+ * 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.
+ */
+
+drop dataverse tpcds if exists;
+create dataverse tpcds;
+
+use tpcds;
+
+create type tpcds.catalog_sales_type as
+ closed {
+ cs_sold_date_sk: bigint?,
+ cs_sold_time_sk: bigint?,
+ cs_ship_date_sk: bigint?,
+ cs_bill_customer_sk: bigint?,
+ cs_bill_cdemo_sk: bigint?,
+ cs_bill_hdemo_sk: bigint?,
+ cs_bill_addr_sk: bigint?,
+ cs_ship_customer_sk: bigint?,
+ cs_ship_cdemo_sk: bigint?,
+ cs_ship_hdemo_sk: bigint?,
+ cs_ship_addr_sk: bigint?,
+ cs_call_center_sk: bigint?,
+ cs_catalog_page_sk: bigint?,
+ cs_ship_mode_sk: bigint?,
+ cs_warehouse_sk: bigint?,
+ cs_item_sk: bigint,
+ cs_promo_sk: bigint?,
+ cs_order_number: bigint,
+ cs_quantity: bigint?,
+ cs_wholesale_cost: double?,
+ cs_list_price: double?,
+ cs_sales_price: double?,
+ cs_ext_discount_amt: double?,
+ cs_ext_sales_price: double?,
+ cs_ext_wholesale_cost: double?,
+ cs_ext_list_price: double?,
+ cs_ext_tax: double?,
+ cs_coupon_amt: double?,
+ cs_ext_ship_cost: double?,
+ cs_net_paid: double?,
+ cs_net_paid_inc_tax: double?,
+ cs_net_paid_inc_ship: double?,
+ cs_net_paid_inc_ship_tax: double?,
+ cs_net_profit: double?
+};
+
+create type tpcds.customer_demographics_type as
+ closed {
+ cd_demo_sk : int64,
+ cd_gender : string?,
+ cd_marital_status : string?,
+ cd_education_status : string?,
+ cd_purchase_estimate : int64?,
+ cd_credit_rating : string?,
+ cd_dep_count : int64?,
+ cd_dep_employed_count : int64?,
+ cd_dep_college_count : int64?
+};
+
+create type tpcds.customer_type as
+ closed {
+ c_customer_sk : int64,
+ c_customer_id : string,
+ c_current_cdemo_sk : int64?,
+ c_current_hdemo_sk : int64?,
+ c_current_addr_sk : int64?,
+ c_first_shipto_date_sk : int64?,
+ c_first_sales_date_sk : int64?,
+ c_salutation : string?,
+ c_first_name : string?,
+ c_last_name : string?,
+ c_preferred_cust_flag : string?,
+ c_birth_day : int64?,
+ c_birth_month : int64?,
+ c_birth_year : int64?,
+ c_birth_country : string?,
+ c_login : string?,
+ c_email_address : string?,
+ c_last_review_date : string?
+};
+
+create type tpcds.customer_address_type as
+ closed {
+ ca_address_sk : bigint,
+ ca_address_id : string,
+ ca_street_number : string?,
+ ca_street_name : string?,
+ ca_street_type : string?,
+ ca_suite_number : string?,
+ ca_city : string?,
+ ca_county : string?,
+ ca_state : string?,
+ ca_zip : string?,
+ ca_country : string?,
+ ca_gmt_offset : double?,
+ ca_location_type : string?
+ };
+
+create type tpcds.item_type as
+ closed {
+ i_item_sk : bigint,
+ i_item_id : string,
+ i_rec_start_date : string?,
+ i_rec_end_date : string?,
+ i_item_desc : string?,
+ i_current_price : double?,
+ i_wholesale_cost : double?,
+ i_brand_id : bigint?,
+ i_brand : string?,
+ i_class_id : bigint?,
+ i_class : string?,
+ i_category_id : bigint?,
+ i_category : string?,
+ i_manufact_id : bigint?,
+ i_manufact : string?,
+ i_size : string?,
+ i_formulation : string?,
+ i_color : string?,
+ i_units : string?,
+ i_container : string?,
+ i_manager_id : bigint?,
+ i_product_name : string?
+};
+
+create type tpcds.date_dim_type as
+ closed {
+ d_date_sk : bigint,
+ d_date_id : string,
+ d_date : string?,
+ d_month_seq : bigint?,
+ d_week_seq : bigint?,
+ d_quarter_seq : bigint?,
+ d_year : bigint? ,
+ d_dow : bigint? ,
+ d_moy : bigint?,
+ d_dom : bigint?,
+ d_qoy : bigint?,
+ d_fy_year : bigint?,
+ d_fy_quarter_seq : bigint?,
+ d_fy_week_seq : bigint?,
+ d_day_name : string?,
+ d_quarter_name : string?,
+ d_holiday : string?,
+ d_weekend : string?,
+ d_following_holiday : string?,
+ d_first_dom : bigint?,
+ d_last_dom : bigint?,
+ d_same_day_ly : bigint?,
+ d_same_day_lq : bigint?,
+ d_current_day : string?,
+ d_current_week : string?,
+ d_current_month : string?,
+ d_current_quarter : string?,
+ d_current_year : string?
+};
+
+create dataset catalog_sales (catalog_sales_type) primary key cs_item_sk, cs_order_number;
+
+create dataset customer_demographics(customer_demographics_type) primary key cd_demo_sk;
+
+create dataset customer (customer_type) primary key c_customer_sk;
+
+create dataset customer_address(customer_address_type) primary key ca_address_sk;
+
+create dataset item (item_type) primary key i_item_sk;
+
+create dataset date_dim(date_dim_type) primary key d_date_sk;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q18/q18.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q18/q18.2.update.sqlpp
new file mode 100644
index 0000000..406067f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q18/q18.2.update.sqlpp
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+use tpcds;
+
+load dataset catalog_sales using localfs ((`path`=`asterix_nc1://data/tpcds/catalog_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset customer_demographics using localfs ((`path`=`asterix_nc1://data/tpcds/customer_demographics.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset customer using localfs ((`path`=`asterix_nc1://data/tpcds/customer.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset customer_address using localfs ((`path`=`asterix_nc1://data/tpcds/customer_address.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset item using localfs ((`path`=`asterix_nc1://data/tpcds/item.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset date_dim using localfs ((`path`=`asterix_nc1://data/tpcds/date_dim.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q18/q18.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q18/q18.3.query.sqlpp
new file mode 100644
index 0000000..4bb6203
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q18/q18.3.query.sqlpp
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+SET `compiler.joinmemory` "160KB";
+
+USE tpcds;
+
+SELECT i.i_item_id,
+ ca.ca_country,
+ ca.ca_state,
+ ca.ca_county,
+ ROUND(AVG(cs.cs_quantity), 2) agg1,
+ ROUND(AVG(cs.cs_list_price), 2) agg2,
+ ROUND(AVG(cs.cs_coupon_amt), 2) agg3,
+ ROUND(AVG(cs.cs_sales_price), 2) agg4,
+ ROUND(AVG(cs.cs_net_profit), 2) agg5,
+ ROUND(AVG(cs.c_birth_year), 2) agg6,
+ ROUND(AVG(cd1.cd_dep_count), 2) agg7
+FROM catalog_sales cs, customer_demographics cd1,
+ customer_demographics cd2, customer c, customer_address ca, date_dim d, item i
+WHERE cs.cs_sold_date_sk = d.d_date_sk
+ AND cs.cs_item_sk = i.i_item_sk
+ AND cs.cs_bill_cdemo_sk = cd1.cd_demo_sk
+ AND cs.cs_bill_customer_sk = c.c_customer_sk
+ AND cd1.cd_gender = 'F'
+ AND cd1.cd_education_status = 'Secondary'
+ AND c.c_current_cdemo_sk = cd2.cd_demo_sk
+ AND c.c_current_addr_sk = ca.ca_address_sk
+ AND c.c_birth_month in [4,5,6,9,10,12]
+ AND d.d_year = 2000
+ AND ca.ca_state in ['IL','PA','TX','MO','WA','OR']
+GROUP BY ROLLUP (i.i_item_id, ca.ca_country, ca.ca_state, ca.ca_county)
+ORDER BY ca.ca_country, ca.ca_state, ca.ca_county, i.i_item_id
+LIMIT 100;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q20/q20.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q20/q20.1.ddl.sqlpp
index 3326d7a..c76f81a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q20/q20.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q20/q20.1.ddl.sqlpp
@@ -36,6 +36,7 @@
cs_ship_hdemo_sk: bigint?,
cs_ship_addr_sk: bigint?,
cs_call_center_sk: bigint?,
+ cs_catalog_page_sk: bigint?,
cs_ship_mode_sk: bigint?,
cs_warehouse_sk: bigint?,
cs_item_sk: bigint,
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q20/q20.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q20/q20.2.update.sqlpp
index a14b6b6..1fe0fe6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q20/q20.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q20/q20.2.update.sqlpp
@@ -19,9 +19,9 @@
use tpcds;
-load dataset catalog_sales using localfs ((`path`=`asterix_nc1://data/tpcds/catalog_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`));
+load dataset catalog_sales using localfs ((`path`=`asterix_nc1://data/tpcds/catalog_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
-load dataset date_dim using localfs ((`path`=`asterix_nc1://data/tpcds/date_dim.csv`),(`format`=`delimited-text`),(`delimiter`=`|`));
+load dataset date_dim using localfs ((`path`=`asterix_nc1://data/tpcds/date_dim.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
-load dataset item using localfs ((`path`=`asterix_nc1://data/tpcds/item.csv`),(`format`=`delimited-text`),(`delimiter`=`|`));
+load dataset item using localfs ((`path`=`asterix_nc1://data/tpcds/item.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q20/q20.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q20/q20.3.query.sqlpp
index 28834d3..2c6148d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q20/q20.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q20/q20.3.query.sqlpp
@@ -35,7 +35,7 @@
cs.cs_item_sk = i.i_item_sk
AND i.i_category IN ['Home', 'Men', 'Women']
AND cs.cs_sold_date_sk = d.d_date_sk
- AND date(d.d_date) BETWEEN date('1999-01-01') AND (date('1999-01-01') + duration('P1Y'))
+ AND date(d.d_date) BETWEEN date('1999-01-01') AND (date('1999-01-01') + duration('P3Y'))
GROUP BY
i.i_item_id,
i.i_item_desc,
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q22/q22.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q22/q22.1.ddl.sqlpp
new file mode 100644
index 0000000..73a7309
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q22/q22.1.ddl.sqlpp
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ */
+
+drop dataverse tpcds if exists;
+create dataverse tpcds;
+
+use tpcds;
+
+create type tpcds.item_type as
+ closed {
+ i_item_sk : bigint,
+ i_item_id : string,
+ i_rec_start_date : string?,
+ i_rec_end_date : string?,
+ i_item_desc : string?,
+ i_current_price : double?,
+ i_wholesale_cost : double?,
+ i_brand_id : bigint?,
+ i_brand : string?,
+ i_class_id : bigint?,
+ i_class : string?,
+ i_category_id : bigint?,
+ i_category : string?,
+ i_manufact_id : bigint?,
+ i_manufact : string?,
+ i_size : string?,
+ i_formulation : string?,
+ i_color : string?,
+ i_units : string?,
+ i_container : string?,
+ i_manager_id : bigint?,
+ i_product_name : string?
+};
+
+create type tpcds.date_dim_type as
+ closed {
+ d_date_sk : bigint,
+ d_date_id : string,
+ d_date : string?,
+ d_month_seq : bigint?,
+ d_week_seq : bigint?,
+ d_quarter_seq : bigint?,
+ d_year : bigint? ,
+ d_dow : bigint? ,
+ d_moy : bigint?,
+ d_dom : bigint?,
+ d_qoy : bigint?,
+ d_fy_year : bigint?,
+ d_fy_quarter_seq : bigint?,
+ d_fy_week_seq : bigint?,
+ d_day_name : string?,
+ d_quarter_name : string?,
+ d_holiday : string?,
+ d_weekend : string?,
+ d_following_holiday : string?,
+ d_first_dom : bigint?,
+ d_last_dom : bigint?,
+ d_same_day_ly : bigint?,
+ d_same_day_lq : bigint?,
+ d_current_day : string?,
+ d_current_week : string?,
+ d_current_month : string?,
+ d_current_quarter : string?,
+ d_current_year : string?
+};
+
+create type tpcds.inventory_type as
+ closed {
+ inv_date_sk : bigint,
+ inv_item_sk : bigint,
+ inv_warehouse_sk : bigint,
+ inv_quantity_on_hand : bigint?
+};
+
+create dataset item (item_type) primary key i_item_sk;
+
+create dataset date_dim(date_dim_type) primary key d_date_sk;
+
+create dataset inventory (inventory_type) primary key inv_date_sk, inv_item_sk, inv_warehouse_sk;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q22/q22.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q22/q22.2.update.sqlpp
new file mode 100644
index 0000000..daaf2ad
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q22/q22.2.update.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+use tpcds;
+
+load dataset item using localfs ((`path`=`asterix_nc1://data/tpcds/item.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset date_dim using localfs ((`path`=`asterix_nc1://data/tpcds/date_dim.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset inventory using localfs ((`path`=`asterix_nc1://data/tpcds/inventory.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q22/q22.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q22/q22.3.query.sqlpp
new file mode 100644
index 0000000..fc8a488
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q22/q22.3.query.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+USE tpcds;
+
+SELECT i.i_product_name, i.i_brand, i.i_class, i.i_category,
+ AVG(inv.inv_quantity_on_hand) qoh
+FROM inventory inv, date_dim d, item i
+WHERE inv.inv_date_sk=d.d_date_sk
+ AND inv.inv_item_sk=i.i_item_sk
+ AND d.d_month_seq BETWEEN 1000 AND 2000
+GROUP BY ROLLUP(i.i_product_name, i.i_brand, i.i_class, i.i_category)
+ORDER BY qoh, i.i_product_name, i.i_brand, i.i_class, i.i_category
+LIMIT 100;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q25/q25.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q25/q25.1.ddl.sqlpp
index 8391405..0ccd813 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q25/q25.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q25/q25.1.ddl.sqlpp
@@ -114,6 +114,8 @@
cs_ship_hdemo_sk: bigint?,
cs_ship_addr_sk: bigint?,
cs_call_center_sk: bigint?,
+ /* TODO(dmitry): removed until we get better data
+ cs_catalog_page_sk: bigint?, */
cs_ship_mode_sk: bigint?,
cs_warehouse_sk: bigint?,
cs_item_sk: bigint,
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q26/q26.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q26/q26.1.ddl.sqlpp
index 1320742..2e13554 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q26/q26.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q26/q26.1.ddl.sqlpp
@@ -75,6 +75,7 @@
cs_ship_hdemo_sk: bigint?,
cs_ship_addr_sk: bigint?,
cs_call_center_sk: bigint?,
+ cs_catalog_page_sk: bigint?,
cs_ship_mode_sk: bigint?,
cs_warehouse_sk: bigint?,
cs_item_sk: bigint,
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q26/q26.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q26/q26.2.update.sqlpp
index bcbd71f..0e880dd 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q26/q26.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q26/q26.2.update.sqlpp
@@ -20,12 +20,12 @@
use tpcds;
-load dataset item using localfs ((`path`=`asterix_nc1://data/tpcds/item.csv`),(`format`=`delimited-text`),(`delimiter`=`|`));
+load dataset item using localfs ((`path`=`asterix_nc1://data/tpcds/item.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
-load dataset customer_demographics using localfs ((`path`=`asterix_nc1://data/tpcds/customer_demographics.csv`),(`format`=`delimited-text`),(`delimiter`=`|`));
+load dataset customer_demographics using localfs ((`path`=`asterix_nc1://data/tpcds/customer_demographics.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
-load dataset catalog_sales using localfs ((`path`=`asterix_nc1://data/tpcds/catalog_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`));
+load dataset catalog_sales using localfs ((`path`=`asterix_nc1://data/tpcds/catalog_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
-load dataset date_dim using localfs ((`path`=`asterix_nc1://data/tpcds/date_dim.csv`),(`format`=`delimited-text`),(`delimiter`=`|`));
+load dataset date_dim using localfs ((`path`=`asterix_nc1://data/tpcds/date_dim.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
-load dataset promotion using localfs ((`path`=`asterix_nc1://data/tpcds/promotion.csv`),(`format`=`delimited-text`),(`delimiter`=`|`));
+load dataset promotion using localfs ((`path`=`asterix_nc1://data/tpcds/promotion.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q27/q27.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q27/q27.1.ddl.sqlpp
new file mode 100644
index 0000000..e0a51c0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q27/q27.1.ddl.sqlpp
@@ -0,0 +1,165 @@
+/*
+ * 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.
+ */
+
+drop dataverse tpcds if exists;
+create dataverse tpcds;
+
+use tpcds;
+
+
+create type tpcds.item_type as
+ closed {
+ i_item_sk : bigint,
+ i_item_id : string,
+ i_rec_start_date : string?,
+ i_rec_end_date : string?,
+ i_item_desc : string?,
+ i_current_price : double?,
+ i_wholesale_cost : double?,
+ i_brand_id : bigint?,
+ i_brand : string?,
+ i_class_id : bigint?,
+ i_class : string?,
+ i_category_id : bigint?,
+ i_category : string?,
+ i_manufact_id : bigint?,
+ i_manufact : string?,
+ i_size : string?,
+ i_formulation : string?,
+ i_color : string?,
+ i_units : string?,
+ i_container : string?,
+ i_manager_id : bigint?,
+ i_product_name : string?
+};
+
+create type tpcds.store_sales_type as
+ closed {
+ ss_sold_date_sk: bigint?,
+ ss_sold_time_sk: bigint?,
+ ss_item_sk: bigint,
+ ss_customer_sk: bigint?,
+ ss_cdemo_sk: bigint?,
+ ss_hdemo_sk: bigint?,
+ ss_addr_sk: bigint?,
+ ss_store_sk: bigint?,
+ ss_promo_sk: bigint?,
+ ss_ticket_number: bigint,
+ ss_quantity: bigint?,
+ ss_wholesale_cost: double?,
+ ss_list_price: double?,
+ ss_sales_price: double?,
+ ss_ext_discount_amt: double?,
+ ss_ext_sales_price: double?,
+ ss_ext_wholesale_cost: double?,
+ ss_ext_list_price: double?,
+ ss_ext_tax: double?,
+ ss_coupon_amt: double?,
+ ss_net_paid: double?,
+ ss_net_paid_inc_tax: double?,
+ ss_net_profit: double?
+};
+
+create type tpcds.date_dim_type as
+ closed {
+ d_date_sk : bigint,
+ d_date_id : string,
+ d_date : string?,
+ d_month_seq : bigint?,
+ d_week_seq : bigint?,
+ d_quarter_seq : bigint?,
+ d_year : bigint? ,
+ d_dow : bigint? ,
+ d_moy : bigint?,
+ d_dom : bigint?,
+ d_qoy : bigint?,
+ d_fy_year : bigint?,
+ d_fy_quarter_seq : bigint?,
+ d_fy_week_seq : bigint?,
+ d_day_name : string?,
+ d_quarter_name : string?,
+ d_holiday : string?,
+ d_weekend : string?,
+ d_following_holiday : string?,
+ d_first_dom : bigint?,
+ d_last_dom : bigint?,
+ d_same_day_ly : bigint?,
+ d_same_day_lq : bigint?,
+ d_current_day : string?,
+ d_current_week : string?,
+ d_current_month : string?,
+ d_current_quarter : string?,
+ d_current_year : string?
+};
+
+create type tpcds.store_type as
+ closed {
+ s_store_sk : bigint,
+ s_store_id : string,
+ s_rec_start_date : string?,
+ s_rec_end_date : string?,
+ s_closed_date_sk : bigint?,
+ s_store_name : string?,
+ s_number_employees : bigint?,
+ s_floor_space : bigint?,
+ s_hours : string?,
+ s_manager : string?,
+ s_market_id : bigint?,
+ s_geography_class : string?,
+ s_market_desc : string?,
+ s_market_manager : string?,
+ s_division_id : bigint?,
+ s_division_name : string?,
+ s_company_id : bigint?,
+ s_company_name : string?,
+ s_street_number : string?,
+ s_street_name : string?,
+ s_street_type : string?,
+ s_suite_number : string?,
+ s_city : string?,
+ s_county : string?,
+ s_state : string?,
+ s_zip : string?,
+ s_country : string?,
+ s_gmt_offset : double?,
+ s_tax_precentage : double?
+};
+
+create type tpcds.customer_demographics_type as
+ closed {
+ cd_demo_sk : bigint,
+ cd_gender : string?,
+ cd_marital_status : string?,
+ cd_education_status : string?,
+ cd_purchase_estimate : bigint?,
+ cd_credit_rating : string?,
+ cd_dep_count : bigint?,
+ cd_dep_employed_count : bigint?,
+ cd_dep_college_count : bigint?
+};
+
+create dataset item (item_type) primary key i_item_sk;
+
+create dataset store_sales (store_sales_type) primary key ss_item_sk, ss_ticket_number;
+
+create dataset date_dim(date_dim_type) primary key d_date_sk;
+
+create dataset store (store_type) primary key s_store_sk;
+
+create dataset customer_demographics(customer_demographics_type) primary key cd_demo_sk;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q27/q27.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q27/q27.2.update.sqlpp
new file mode 100644
index 0000000..2344686
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q27/q27.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+use tpcds;
+
+load dataset item using localfs ((`path`=`asterix_nc1://data/tpcds/item.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset store_sales using localfs ((`path`=`asterix_nc1://data/tpcds/store_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset date_dim using localfs ((`path`=`asterix_nc1://data/tpcds/date_dim.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset store using localfs ((`path`=`asterix_nc1://data/tpcds/store.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset customer_demographics using localfs ((`path`=`asterix_nc1://data/tpcds/customer_demographics.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q27/q27.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q27/q27.3.query.sqlpp
new file mode 100644
index 0000000..4a33d6c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q27/q27.3.query.sqlpp
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+USE tpcds;
+
+SELECT i.i_item_id,
+ s.s_state, GROUPING(s.s_state) g_state,
+ ROUND(AVG(ss.ss_quantity), 2) agg1,
+ ROUND(AVG(ss.ss_list_price), 2) agg2,
+ ROUND(AVG(ss.ss_coupon_amt), 2) agg3,
+ ROUND(AVG(ss.ss_sales_price), 2) agg4
+FROM store_sales ss, customer_demographics cd, date_dim d, store s, item i
+WHERE ss.ss_sold_date_sk = d.d_date_sk
+ AND ss.ss_item_sk = i.i_item_sk
+ AND ss.ss_store_sk = s.s_store_sk
+ AND ss.ss_cdemo_sk = cd.cd_demo_sk
+ AND cd.cd_gender = 'M'
+ AND cd.cd_marital_status = 'M'
+ AND cd.cd_education_status = 'Primary'
+ AND d.d_year = 1999
+ AND s.s_state IN ['TN','TN']
+GROUP BY ROLLUP (i.i_item_id, s.s_state)
+ORDER BY i.i_item_id, s.s_state
+LIMIT 100;
+
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q29/q29.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q29/q29.1.ddl.sqlpp
index 8391405..0ccd813 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q29/q29.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q29/q29.1.ddl.sqlpp
@@ -114,6 +114,8 @@
cs_ship_hdemo_sk: bigint?,
cs_ship_addr_sk: bigint?,
cs_call_center_sk: bigint?,
+ /* TODO(dmitry): removed until we get better data
+ cs_catalog_page_sk: bigint?, */
cs_ship_mode_sk: bigint?,
cs_warehouse_sk: bigint?,
cs_item_sk: bigint,
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q36/q36.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q36/q36.1.ddl.sqlpp
new file mode 100644
index 0000000..f26563f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q36/q36.1.ddl.sqlpp
@@ -0,0 +1,150 @@
+/*
+ * 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.
+ */
+
+drop dataverse tpcds if exists;
+create dataverse tpcds;
+
+use tpcds;
+
+
+create type tpcds.item_type as
+ closed {
+ i_item_sk : bigint,
+ i_item_id : string,
+ i_rec_start_date : string?,
+ i_rec_end_date : string?,
+ i_item_desc : string?,
+ i_current_price : double?,
+ i_wholesale_cost : double?,
+ i_brand_id : bigint?,
+ i_brand : string?,
+ i_class_id : bigint?,
+ i_class : string?,
+ i_category_id : bigint?,
+ i_category : string?,
+ i_manufact_id : bigint?,
+ i_manufact : string?,
+ i_size : string?,
+ i_formulation : string?,
+ i_color : string?,
+ i_units : string?,
+ i_container : string?,
+ i_manager_id : bigint?,
+ i_product_name : string?
+};
+
+create type tpcds.store_sales_type as
+ closed {
+ ss_sold_date_sk: bigint?,
+ ss_sold_time_sk: bigint?,
+ ss_item_sk: bigint,
+ ss_customer_sk: bigint?,
+ ss_cdemo_sk: bigint?,
+ ss_hdemo_sk: bigint?,
+ ss_addr_sk: bigint?,
+ ss_store_sk: bigint?,
+ ss_promo_sk: bigint?,
+ ss_ticket_number: bigint,
+ ss_quantity: bigint?,
+ ss_wholesale_cost: double?,
+ ss_list_price: double?,
+ ss_sales_price: double?,
+ ss_ext_discount_amt: double?,
+ ss_ext_sales_price: double?,
+ ss_ext_wholesale_cost: double?,
+ ss_ext_list_price: double?,
+ ss_ext_tax: double?,
+ ss_coupon_amt: double?,
+ ss_net_paid: double?,
+ ss_net_paid_inc_tax: double?,
+ ss_net_profit: double?
+};
+
+create type tpcds.date_dim_type as
+ closed {
+ d_date_sk : bigint,
+ d_date_id : string,
+ d_date : string?,
+ d_month_seq : bigint?,
+ d_week_seq : bigint?,
+ d_quarter_seq : bigint?,
+ d_year : bigint? ,
+ d_dow : bigint? ,
+ d_moy : bigint?,
+ d_dom : bigint?,
+ d_qoy : bigint?,
+ d_fy_year : bigint?,
+ d_fy_quarter_seq : bigint?,
+ d_fy_week_seq : bigint?,
+ d_day_name : string?,
+ d_quarter_name : string?,
+ d_holiday : string?,
+ d_weekend : string?,
+ d_following_holiday : string?,
+ d_first_dom : bigint?,
+ d_last_dom : bigint?,
+ d_same_day_ly : bigint?,
+ d_same_day_lq : bigint?,
+ d_current_day : string?,
+ d_current_week : string?,
+ d_current_month : string?,
+ d_current_quarter : string?,
+ d_current_year : string?
+};
+
+create type tpcds.store_type as
+ closed {
+ s_store_sk : bigint,
+ s_store_id : string,
+ s_rec_start_date : string?,
+ s_rec_end_date : string?,
+ s_closed_date_sk : bigint?,
+ s_store_name : string?,
+ s_number_employees : bigint?,
+ s_floor_space : bigint?,
+ s_hours : string?,
+ s_manager : string?,
+ s_market_id : bigint?,
+ s_geography_class : string?,
+ s_market_desc : string?,
+ s_market_manager : string?,
+ s_division_id : bigint?,
+ s_division_name : string?,
+ s_company_id : bigint?,
+ s_company_name : string?,
+ s_street_number : string?,
+ s_street_name : string?,
+ s_street_type : string?,
+ s_suite_number : string?,
+ s_city : string?,
+ s_county : string?,
+ s_state : string?,
+ s_zip : string?,
+ s_country : string?,
+ s_gmt_offset : double?,
+ s_tax_precentage : double?
+};
+
+create dataset item (item_type) primary key i_item_sk;
+
+create dataset store_sales (store_sales_type) primary key ss_item_sk, ss_ticket_number;
+
+create dataset date_dim(date_dim_type) primary key d_date_sk;
+
+create dataset store (store_type) primary key s_store_sk;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q36/q36.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q36/q36.2.update.sqlpp
new file mode 100644
index 0000000..277a679
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q36/q36.2.update.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+use tpcds;
+
+load dataset item using localfs ((`path`=`asterix_nc1://data/tpcds/item.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset store_sales using localfs ((`path`=`asterix_nc1://data/tpcds/store_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset date_dim using localfs ((`path`=`asterix_nc1://data/tpcds/date_dim.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset store using localfs ((`path`=`asterix_nc1://data/tpcds/store.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q36/q36.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q36/q36.3.query.sqlpp
new file mode 100644
index 0000000..8a24510
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q36/q36.3.query.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+USE tpcds;
+
+SELECT
+ ROUND(SUM(ss.ss_net_profit) / SUM(ss.ss_ext_sales_price), 2) AS gross_margin,
+ i.i_category,
+ i.i_class,
+ GROUPING(i.i_category) + GROUPING(i.i_class) AS lochierarchy,
+ RANK() OVER (
+ PARTITION BY
+ GROUPING(i.i_category) + GROUPING(i.i_class),
+ CASE WHEN GROUPING(i.i_class) = 0 THEN i.i_category END
+ ORDER BY
+ SUM(ss.ss_net_profit) / SUM(ss.ss_ext_sales_price) ASC
+ ) AS rank_within_parent
+FROM store_sales ss, date_dim d, item i, store s
+WHERE d.d_year = 1999
+ AND d.d_date_sk = ss.ss_sold_date_sk
+ AND i.i_item_sk = ss.ss_item_sk
+ AND s.s_store_sk = ss.ss_store_sk
+ AND s.s_state IN ['TN','TN']
+GROUP BY
+ ROLLUP(i.i_category, i.i_class)
+ORDER BY
+ lochierarchy DESC,
+ CASE WHEN lochierarchy = 0 THEN i.i_category END,
+ rank_within_parent
+ /* TODO(dmitry). makes result stable. revisit. */
+ , i.i_category, i.i_class
+LIMIT 100;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q37/q37.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q37/q37.1.ddl.sqlpp
index 24cbaa4..25fdb80 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q37/q37.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q37/q37.1.ddl.sqlpp
@@ -95,6 +95,7 @@
cs_ship_hdemo_sk: bigint?,
cs_ship_addr_sk: bigint?,
cs_call_center_sk: bigint?,
+ cs_catalog_page_sk: bigint?,
cs_ship_mode_sk: bigint?,
cs_warehouse_sk: bigint?,
cs_item_sk: bigint,
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q49/q49.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q49/q49.1.ddl.sqlpp
index 36c7f47..4378cfd 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q49/q49.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q49/q49.1.ddl.sqlpp
@@ -67,6 +67,7 @@
cs_ship_hdemo_sk: bigint?,
cs_ship_addr_sk: bigint?,
cs_call_center_sk: bigint?,
+ cs_catalog_page_sk: bigint?,
cs_ship_mode_sk: bigint?,
cs_warehouse_sk: bigint?,
cs_item_sk: bigint,
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q49/q49.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q49/q49.2.update.sqlpp
index 2ed4e32..773390c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q49/q49.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q49/q49.2.update.sqlpp
@@ -19,16 +19,16 @@
use tpcds;
-load dataset catalog_returns using localfs ((`path`=`asterix_nc1://data/tpcds/catalog_returns.csv`),(`format`=`delimited-text`),(`delimiter`=`|`));
+load dataset catalog_returns using localfs ((`path`=`asterix_nc1://data/tpcds/catalog_returns.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
-load dataset catalog_sales using localfs ((`path`=`asterix_nc1://data/tpcds/catalog_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`));
+load dataset catalog_sales using localfs ((`path`=`asterix_nc1://data/tpcds/catalog_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
-load dataset date_dim using localfs ((`path`=`asterix_nc1://data/tpcds/date_dim.csv`),(`format`=`delimited-text`),(`delimiter`=`|`));
+load dataset date_dim using localfs ((`path`=`asterix_nc1://data/tpcds/date_dim.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
-load dataset store_returns using localfs ((`path`=`asterix_nc1://data/tpcds/store_returns.csv`),(`format`=`delimited-text`),(`delimiter`=`|`));
+load dataset store_returns using localfs ((`path`=`asterix_nc1://data/tpcds/store_returns.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
-load dataset store_sales using localfs ((`path`=`asterix_nc1://data/tpcds/store_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`));
+load dataset store_sales using localfs ((`path`=`asterix_nc1://data/tpcds/store_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
-load dataset web_returns using localfs ((`path`=`asterix_nc1://data/tpcds/web_returns.csv`),(`format`=`delimited-text`),(`delimiter`=`|`));
+load dataset web_returns using localfs ((`path`=`asterix_nc1://data/tpcds/web_returns.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
-load dataset web_sales using localfs ((`path`=`asterix_nc1://data/tpcds/web_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`));
\ No newline at end of file
+load dataset web_sales using localfs ((`path`=`asterix_nc1://data/tpcds/web_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q49/q49.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q49/q49.3.query.sqlpp
index b906174..4fc3bf2 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q49/q49.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q49/q49.3.query.sqlpp
@@ -43,7 +43,7 @@
date_dim d
WHERE
wr.wr_return_amt > 100
- AND ws.ws_net_profit > 1
+ /* AND ws.ws_net_profit > 1 */
AND ws.ws_net_paid > 0
AND ws.ws_quantity > 0
AND ws.ws_sold_date_sk = d.d_date_sk
@@ -80,11 +80,11 @@
date_dim d
WHERE
cr.cr_return_amount > 100
- AND cs.cs_net_profit > 1
+ /* AND cs.cs_net_profit > 1 */
AND cs.cs_net_paid > 0
AND cs.cs_quantity > 0
AND cs.cs_sold_date_sk = d.d_date_sk
- /*AND d.d_year = 1999 AND d.d_moy = 12*/
+ /* AND d.d_year = 1999 AND d.d_moy = 12 */
GROUP BY
cs.cs_item_sk
) in_cat
@@ -117,11 +117,11 @@
date_dim d
WHERE
sr.sr_return_amt > 100
- AND sts.ss_net_profit > 1
+ /* AND sts.ss_net_profit > 1 */
AND sts.ss_net_paid > 0
AND sts.ss_quantity > 0
AND sts.ss_sold_date_sk = d.d_date_sk
- /*AND d.d_year = 1999 AND d.d_moy = 12*/
+ /* AND d.d_year = 1999 AND d.d_moy = 12 */
GROUP BY
sts.ss_item_sk
) in_store
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q57/q57.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q57/q57.1.ddl.sqlpp
index 8581407..cf294d5 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q57/q57.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q57/q57.1.ddl.sqlpp
@@ -71,6 +71,7 @@
cs_ship_hdemo_sk: bigint?,
cs_ship_addr_sk: bigint?,
cs_call_center_sk: bigint?,
+ cs_catalog_page_sk: bigint?,
cs_ship_mode_sk: bigint?,
cs_warehouse_sk: bigint?,
cs_item_sk: bigint,
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q57/q57.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q57/q57.3.query.sqlpp
index 802f904..f11b617 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q57/q57.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q57/q57.3.query.sqlpp
@@ -39,7 +39,7 @@
cs.cs_item_sk = i.i_item_sk
AND cs.cs_sold_date_sk = d.d_date_sk
AND cc.cc_call_center_sk = cs.cs_call_center_sk
- /*AND ( d.d_year = 2000 OR ( d.d_year = 2000 - 1 AND d.d_moy = 12 ) OR ( d.d_year = 2000 + 1 AND d.d_moy = 1 ) )*/
+ /*AND ( d.d_year = 2001 OR ( d.d_year = 2001 - 1 AND d.d_moy = 12 ) OR ( d.d_year = 2001 + 1 AND d.d_moy = 1 ) )*/
GROUP BY
i.i_category,
i.i_brand,
@@ -75,7 +75,7 @@
SELECT v2.*
FROM v2
WHERE
- d_year = 2000 AND
+ d_year = 2001 AND
avg_monthly_sales > 0
/*AND CASE WHEN avg_monthly_sales > 0 THEN ABS(sum_sales - avg_monthly_sales) / avg_monthly_sales ELSE NULL END > 0.1*/
ORDER BY
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q67/q67.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q67/q67.1.ddl.sqlpp
new file mode 100644
index 0000000..f26563f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q67/q67.1.ddl.sqlpp
@@ -0,0 +1,150 @@
+/*
+ * 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.
+ */
+
+drop dataverse tpcds if exists;
+create dataverse tpcds;
+
+use tpcds;
+
+
+create type tpcds.item_type as
+ closed {
+ i_item_sk : bigint,
+ i_item_id : string,
+ i_rec_start_date : string?,
+ i_rec_end_date : string?,
+ i_item_desc : string?,
+ i_current_price : double?,
+ i_wholesale_cost : double?,
+ i_brand_id : bigint?,
+ i_brand : string?,
+ i_class_id : bigint?,
+ i_class : string?,
+ i_category_id : bigint?,
+ i_category : string?,
+ i_manufact_id : bigint?,
+ i_manufact : string?,
+ i_size : string?,
+ i_formulation : string?,
+ i_color : string?,
+ i_units : string?,
+ i_container : string?,
+ i_manager_id : bigint?,
+ i_product_name : string?
+};
+
+create type tpcds.store_sales_type as
+ closed {
+ ss_sold_date_sk: bigint?,
+ ss_sold_time_sk: bigint?,
+ ss_item_sk: bigint,
+ ss_customer_sk: bigint?,
+ ss_cdemo_sk: bigint?,
+ ss_hdemo_sk: bigint?,
+ ss_addr_sk: bigint?,
+ ss_store_sk: bigint?,
+ ss_promo_sk: bigint?,
+ ss_ticket_number: bigint,
+ ss_quantity: bigint?,
+ ss_wholesale_cost: double?,
+ ss_list_price: double?,
+ ss_sales_price: double?,
+ ss_ext_discount_amt: double?,
+ ss_ext_sales_price: double?,
+ ss_ext_wholesale_cost: double?,
+ ss_ext_list_price: double?,
+ ss_ext_tax: double?,
+ ss_coupon_amt: double?,
+ ss_net_paid: double?,
+ ss_net_paid_inc_tax: double?,
+ ss_net_profit: double?
+};
+
+create type tpcds.date_dim_type as
+ closed {
+ d_date_sk : bigint,
+ d_date_id : string,
+ d_date : string?,
+ d_month_seq : bigint?,
+ d_week_seq : bigint?,
+ d_quarter_seq : bigint?,
+ d_year : bigint? ,
+ d_dow : bigint? ,
+ d_moy : bigint?,
+ d_dom : bigint?,
+ d_qoy : bigint?,
+ d_fy_year : bigint?,
+ d_fy_quarter_seq : bigint?,
+ d_fy_week_seq : bigint?,
+ d_day_name : string?,
+ d_quarter_name : string?,
+ d_holiday : string?,
+ d_weekend : string?,
+ d_following_holiday : string?,
+ d_first_dom : bigint?,
+ d_last_dom : bigint?,
+ d_same_day_ly : bigint?,
+ d_same_day_lq : bigint?,
+ d_current_day : string?,
+ d_current_week : string?,
+ d_current_month : string?,
+ d_current_quarter : string?,
+ d_current_year : string?
+};
+
+create type tpcds.store_type as
+ closed {
+ s_store_sk : bigint,
+ s_store_id : string,
+ s_rec_start_date : string?,
+ s_rec_end_date : string?,
+ s_closed_date_sk : bigint?,
+ s_store_name : string?,
+ s_number_employees : bigint?,
+ s_floor_space : bigint?,
+ s_hours : string?,
+ s_manager : string?,
+ s_market_id : bigint?,
+ s_geography_class : string?,
+ s_market_desc : string?,
+ s_market_manager : string?,
+ s_division_id : bigint?,
+ s_division_name : string?,
+ s_company_id : bigint?,
+ s_company_name : string?,
+ s_street_number : string?,
+ s_street_name : string?,
+ s_street_type : string?,
+ s_suite_number : string?,
+ s_city : string?,
+ s_county : string?,
+ s_state : string?,
+ s_zip : string?,
+ s_country : string?,
+ s_gmt_offset : double?,
+ s_tax_precentage : double?
+};
+
+create dataset item (item_type) primary key i_item_sk;
+
+create dataset store_sales (store_sales_type) primary key ss_item_sk, ss_ticket_number;
+
+create dataset date_dim(date_dim_type) primary key d_date_sk;
+
+create dataset store (store_type) primary key s_store_sk;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q67/q67.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q67/q67.2.update.sqlpp
new file mode 100644
index 0000000..277a679
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q67/q67.2.update.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+use tpcds;
+
+load dataset item using localfs ((`path`=`asterix_nc1://data/tpcds/item.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset store_sales using localfs ((`path`=`asterix_nc1://data/tpcds/store_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset date_dim using localfs ((`path`=`asterix_nc1://data/tpcds/date_dim.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset store using localfs ((`path`=`asterix_nc1://data/tpcds/store.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q67/q67.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q67/q67.3.query.sqlpp
new file mode 100644
index 0000000..8ab128a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q67/q67.3.query.sqlpp
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+USE tpcds;
+
+SELECT dw2.*
+FROM (
+ SELECT
+ i_category, i_class, i_brand, i_product_name, d_year, d_qoy, d_moy, s_store_id, sumsales,
+ RANK() OVER (PARTITION BY i_category ORDER BY sumsales DESC) rk
+ FROM (
+ SELECT
+ i.i_category, i.i_class, i.i_brand, i.i_product_name, d.d_year, d.d_qoy, d.d_moy, s.s_store_id,
+ ROUND(SUM(COALESCE(ss.ss_sales_price * ss.ss_quantity, 0)), 2) sumsales
+ FROM
+ store_sales ss, date_dim d, store s, item i
+ WHERE ss.ss_sold_date_sk = d.d_date_sk
+ AND ss.ss_item_sk = i.i_item_sk
+ AND ss.ss_store_sk = s.s_store_sk
+ AND d.d_month_seq BETWEEN 1000 AND 2000
+ GROUP BY ROLLUP(i.i_category, i.i_class, i.i_brand, i.i_product_name, d.d_year, d.d_qoy, d.d_moy, s.s_store_id)
+ ) dw1
+ ) dw2
+WHERE rk <= 100
+ORDER BY i_category, i_class, i_brand, i_product_name, d_year, d_qoy, d_moy, s_store_id, sumsales, rk
+LIMIT 100;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q70/q70.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q70/q70.1.ddl.sqlpp
new file mode 100644
index 0000000..91d69c9
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q70/q70.1.ddl.sqlpp
@@ -0,0 +1,121 @@
+/*
+ * 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.
+ */
+
+drop dataverse tpcds if exists;
+create dataverse tpcds;
+
+use tpcds;
+
+create type tpcds.store_sales_type as
+ closed {
+ ss_sold_date_sk: bigint?,
+ ss_sold_time_sk: bigint?,
+ ss_item_sk: bigint,
+ ss_customer_sk: bigint?,
+ ss_cdemo_sk: bigint?,
+ ss_hdemo_sk: bigint?,
+ ss_addr_sk: bigint?,
+ ss_store_sk: bigint?,
+ ss_promo_sk: bigint?,
+ ss_ticket_number: bigint,
+ ss_quantity: bigint?,
+ ss_wholesale_cost: double?,
+ ss_list_price: double?,
+ ss_sales_price: double?,
+ ss_ext_discount_amt: double?,
+ ss_ext_sales_price: double?,
+ ss_ext_wholesale_cost: double?,
+ ss_ext_list_price: double?,
+ ss_ext_tax: double?,
+ ss_coupon_amt: double?,
+ ss_net_paid: double?,
+ ss_net_paid_inc_tax: double?,
+ ss_net_profit: double?
+};
+
+create type tpcds.date_dim_type as
+ closed {
+ d_date_sk : bigint,
+ d_date_id : string,
+ d_date : string?,
+ d_month_seq : bigint?,
+ d_week_seq : bigint?,
+ d_quarter_seq : bigint?,
+ d_year : bigint? ,
+ d_dow : bigint? ,
+ d_moy : bigint?,
+ d_dom : bigint?,
+ d_qoy : bigint?,
+ d_fy_year : bigint?,
+ d_fy_quarter_seq : bigint?,
+ d_fy_week_seq : bigint?,
+ d_day_name : string?,
+ d_quarter_name : string?,
+ d_holiday : string?,
+ d_weekend : string?,
+ d_following_holiday : string?,
+ d_first_dom : bigint?,
+ d_last_dom : bigint?,
+ d_same_day_ly : bigint?,
+ d_same_day_lq : bigint?,
+ d_current_day : string?,
+ d_current_week : string?,
+ d_current_month : string?,
+ d_current_quarter : string?,
+ d_current_year : string?
+};
+
+create type tpcds.store_type as
+ closed {
+ s_store_sk : bigint,
+ s_store_id : string,
+ s_rec_start_date : string?,
+ s_rec_end_date : string?,
+ s_closed_date_sk : bigint?,
+ s_store_name : string?,
+ s_number_employees : bigint?,
+ s_floor_space : bigint?,
+ s_hours : string?,
+ s_manager : string?,
+ s_market_id : bigint?,
+ s_geography_class : string?,
+ s_market_desc : string?,
+ s_market_manager : string?,
+ s_division_id : bigint?,
+ s_division_name : string?,
+ s_company_id : bigint?,
+ s_company_name : string?,
+ s_street_number : string?,
+ s_street_name : string?,
+ s_street_type : string?,
+ s_suite_number : string?,
+ s_city : string?,
+ s_county : string?,
+ s_state : string?,
+ s_zip : string?,
+ s_country : string?,
+ s_gmt_offset : double?,
+ s_tax_precentage : double?
+};
+
+create dataset store_sales (store_sales_type) primary key ss_item_sk, ss_ticket_number;
+
+create dataset date_dim(date_dim_type) primary key d_date_sk;
+
+create dataset store (store_type) primary key s_store_sk;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q70/q70.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q70/q70.2.update.sqlpp
new file mode 100644
index 0000000..a6a6a04
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q70/q70.2.update.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+use tpcds;
+
+load dataset store_sales using localfs ((`path`=`asterix_nc1://data/tpcds/store_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset date_dim using localfs ((`path`=`asterix_nc1://data/tpcds/date_dim.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset store using localfs ((`path`=`asterix_nc1://data/tpcds/store.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q70/q70.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q70/q70.3.query.sqlpp
new file mode 100644
index 0000000..76b9c7e
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q70/q70.3.query.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+USE tpcds;
+
+SELECT
+ ROUND(SUM(ss1.ss_net_profit), 2) AS total_sum,
+ s1.s_state,
+ s1.s_county,
+ GROUPING(s1.s_state) + GROUPING(s1.s_county) AS lochierarchy,
+ RANK() OVER (
+ PARTITION BY
+ GROUPING(s1.s_state) + GROUPING(s1.s_county),
+ CASE WHEN GROUPING(s1.s_county) = 0 THEN s1.s_state END
+ ORDER BY
+ SUM(ss1.ss_net_profit) DESC
+ ) AS rank_within_parent
+FROM
+ store_sales ss1, date_dim d1, store s1
+WHERE d1.d_month_seq BETWEEN 1000 AND 2000
+ AND d1.d_date_sk = ss1.ss_sold_date_sk
+ AND s1.s_store_sk = ss1.ss_store_sk
+ AND s1.s_state IN (
+ SELECT VALUE s_state
+ FROM (
+ SELECT
+ s.s_state AS s_state,
+ RANK() OVER (
+ PARTITION BY s.s_state
+ ORDER BY SUM(ss.ss_net_profit) DESC
+ ) AS ranking
+ FROM store_sales ss, store s, date_dim d
+ WHERE d.d_month_seq BETWEEN 1000 AND 2000
+ AND d.d_date_sk = ss.ss_sold_date_sk
+ AND s.s_store_sk = ss.ss_store_sk
+ GROUP BY s.s_state
+ ) tmp1
+ WHERE ranking <= 5
+ )
+GROUP BY ROLLUP(s1.s_state, s1.s_county)
+ORDER BY
+ lochierarchy DESC,
+ CASE WHEN lochierarchy = 0 THEN s1.s_state END,
+ rank_within_parent
+LIMIT 100;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q77/q77.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q77/q77.1.ddl.sqlpp
new file mode 100644
index 0000000..e0acbda
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q77/q77.1.ddl.sqlpp
@@ -0,0 +1,310 @@
+/*
+ * 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.
+ */
+
+drop dataverse tpcds if exists;
+create dataverse tpcds;
+
+use tpcds;
+
+create type tpcds.store_type as
+ closed {
+ s_store_sk : bigint,
+ s_store_id : string,
+ s_rec_start_date : string?,
+ s_rec_end_date : string?,
+ s_closed_date_sk : bigint?,
+ s_store_name : string?,
+ s_number_employees : bigint?,
+ s_floor_space : bigint?,
+ s_hours : string?,
+ s_manager : string?,
+ s_market_id : bigint?,
+ s_geography_class : string?,
+ s_market_desc : string?,
+ s_market_manager : string?,
+ s_division_id : bigint?,
+ s_division_name : string?,
+ s_company_id : bigint?,
+ s_company_name : string?,
+ s_street_number : string?,
+ s_street_name : string?,
+ s_street_type : string?,
+ s_suite_number : string?,
+ s_city : string?,
+ s_county : string?,
+ s_state : string?,
+ s_zip : string?,
+ s_country : string?,
+ s_gmt_offset : double?,
+ s_tax_precentage : double?
+};
+
+create type tpcds.store_sales_type as
+ closed {
+ ss_sold_date_sk: bigint?,
+ ss_sold_time_sk: bigint?,
+ ss_item_sk: bigint,
+ ss_customer_sk: bigint?,
+ ss_cdemo_sk: bigint?,
+ ss_hdemo_sk: bigint?,
+ ss_addr_sk: bigint?,
+ ss_store_sk: bigint?,
+ ss_promo_sk: bigint?,
+ ss_ticket_number: bigint,
+ ss_quantity: bigint?,
+ ss_wholesale_cost: double?,
+ ss_list_price: double?,
+ ss_sales_price: double?,
+ ss_ext_discount_amt: double?,
+ ss_ext_sales_price: double?,
+ ss_ext_wholesale_cost: double?,
+ ss_ext_list_price: double?,
+ ss_ext_tax: double?,
+ ss_coupon_amt: double?,
+ ss_net_paid: double?,
+ ss_net_paid_inc_tax: double?,
+ ss_net_profit: double?
+};
+
+create type tpcds.store_returns_type as
+ closed {
+ sr_returned_date_sk : int64?,
+ sr_return_time_sk : int64?,
+ sr_item_sk : int64,
+ sr_customer_sk : int64?,
+ sr_cdemo_sk : int64?,
+ sr_hdemo_sk : int64?,
+ sr_addr_sk : int64?,
+ sr_store_sk : int64?,
+ sr_reason_sk : int64?,
+ sr_ticket_number : int64,
+ sr_return_quantity : int64?,
+ sr_return_amt : double,
+ sr_return_tax : double?,
+ sr_return_amt_inc_tax : double?,
+ sr_fee : double?,
+ sr_return_ship_cost : double?,
+ sr_refunded_cash : double?,
+ sr_reversed_charge : double?,
+ sr_store_credit : double?,
+ sr_net_loss : double?
+};
+
+create type tpcds.catalog_sales_type as
+ closed {
+ cs_sold_date_sk: bigint?,
+ cs_sold_time_sk: bigint?,
+ cs_ship_date_sk: bigint?,
+ cs_bill_customer_sk: bigint?,
+ cs_bill_cdemo_sk: bigint?,
+ cs_bill_hdemo_sk: bigint?,
+ cs_bill_addr_sk: bigint?,
+ cs_ship_customer_sk: bigint?,
+ cs_ship_cdemo_sk: bigint?,
+ cs_ship_hdemo_sk: bigint?,
+ cs_ship_addr_sk: bigint?,
+ cs_call_center_sk: bigint?,
+ cs_catalog_page_sk: bigint?,
+ cs_ship_mode_sk: bigint?,
+ cs_warehouse_sk: bigint?,
+ cs_item_sk: bigint,
+ cs_promo_sk: bigint?,
+ cs_order_number: bigint,
+ cs_quantity: bigint?,
+ cs_wholesale_cost: double?,
+ cs_list_price: double?,
+ cs_sales_price: double?,
+ cs_ext_discount_amt: double?,
+ cs_ext_sales_price: double?,
+ cs_ext_wholesale_cost: double?,
+ cs_ext_list_price: double?,
+ cs_ext_tax: double?,
+ cs_coupon_amt: double?,
+ cs_ext_ship_cost: double?,
+ cs_net_paid: double?,
+ cs_net_paid_inc_tax: double?,
+ cs_net_paid_inc_ship: double?,
+ cs_net_paid_inc_ship_tax: double?,
+ cs_net_profit: double?
+};
+
+create type tpcds.catalog_returns_type as
+ closed {
+ cr_returned_date_sk : bigint?,
+ cr_returned_time_sk : bigint?,
+ cr_item_sk : bigint,
+ cr_refunded_customer_sk : bigint?,
+ cr_refunded_cdemo_sk : bigint?,
+ cr_refunded_hdemo_sk : bigint?,
+ cr_refunded_addr_sk : bigint?,
+ cr_returning_customer_sk : bigint?,
+ cr_returning_cdemo_sk : bigint?,
+ cr_returning_hdemo_sk : bigint?,
+ cr_returning_addr_sk : bigint?,
+ cr_call_center_sk : bigint?,
+ cr_catalog_page_sk : bigint?,
+ cr_ship_mode_sk : bigint?,
+ cr_warehouse_sk : bigint?,
+ cr_reason_sk : bigint?,
+ cr_order_number : bigint,
+ cr_return_quantity : bigint?,
+ cr_return_amount : double?,
+ cr_return_tax : double?,
+ cr_return_amt_inc_tax : double?,
+ cr_fee : double?,
+ cr_return_ship_cost : double?,
+ cr_refunded_cash : double?,
+ cr_reversed_charge : double?,
+ cr_store_credit : double?,
+ cr_net_loss : double?
+};
+
+create type tpcds.web_page_type as
+ closed {
+ wp_web_page_sk : int64,
+ wp_web_page_id : string,
+ wp_rec_start_date : string?,
+ wp_rec_end_date : string?,
+ wp_creation_date_sk : int64?,
+ wp_access_date_sk : int64?,
+ wp_autogen_flag : string?,
+ wp_customer_sk : int64?,
+ wp_url : string?,
+ wp_type : string?,
+ wp_char_count : int64?,
+ wp_link_count : int64?,
+ wp_image_count : int64?,
+ wp_max_ad_count : int64?
+};
+
+create type tpcds.web_sales_type as
+ closed {
+ ws_sold_date_sk : int64?,
+ ws_sold_time_sk : int64?,
+ ws_ship_date_sk : int64?,
+ ws_item_sk : int64,
+ ws_bill_customer_sk : int64?,
+ ws_bill_cdemo_sk : int64?,
+ ws_bill_hdemo_sk : int64?,
+ ws_bill_addr_sk : int64?,
+ ws_ship_customer_sk : int64?,
+ ws_ship_cdemo_sk : int64?,
+ ws_ship_hdemo_sk : int64?,
+ ws_ship_addr_sk : int64?,
+ ws_web_page_sk : int64?,
+ ws_web_site_sk : int64?,
+ ws_ship_mode_sk : int64?,
+ ws_warehouse_sk : int64?,
+ ws_promo_sk : int64?,
+ ws_order_number : int64,
+ ws_quantity : int64?,
+ ws_wholesale_cost : double?,
+ ws_list_price : double?,
+ ws_sales_price : double?,
+ ws_ext_discount_amt : double?,
+ ws_ext_sales_price : double?,
+ ws_ext_wholesale_cost : double?,
+ ws_ext_list_price : double?,
+ ws_ext_tax : double?,
+ ws_coupon_amt : double?,
+ ws_ext_ship_cost : double?,
+ ws_net_paid : double?,
+ ws_net_paid_inc_tax : double?,
+ ws_net_paid_inc_ship : double?,
+ ws_net_paid_inc_ship_tax : double?,
+ ws_net_profit : double?
+};
+
+create type tpcds.web_returns_type as
+ closed {
+ wr_returned_date_sk : bigint?,
+ wr_returned_time_sk : bigint?,
+ wr_item_sk : bigint,
+ wr_refunded_customer_sk : bigint?,
+ wr_refunded_cdemo_sk : bigint?,
+ wr_refunded_hdemo_sk : bigint?,
+ wr_refunded_addr_sk : bigint?,
+ wr_returning_customer_sk : bigint?,
+ wr_returning_cdemo_sk : bigint?,
+ wr_returning_hdemo_sk : bigint?,
+ wr_returning_addr_sk : bigint?,
+ wr_web_page_sk : bigint?,
+ wr_reason_sk : bigint?,
+ wr_order_number : bigint,
+ wr_return_quantity : bigint?,
+ wr_return_amt : double?,
+ wr_return_tax : double?,
+ wr_return_amt_inc_tax : double?,
+ wr_fee : double?,
+ wr_return_ship_cost: double?,
+ wr_refunded_cash: double?,
+ wr_reversed_charge: double?,
+ wr_account_credit: double?,
+ wr_net_loss: double?
+};
+
+create type tpcds.date_dim_type as
+ closed {
+ d_date_sk : bigint,
+ d_date_id : string,
+ d_date : string?,
+ d_month_seq : bigint?,
+ d_week_seq : bigint?,
+ d_quarter_seq : bigint?,
+ d_year : bigint? ,
+ d_dow : bigint? ,
+ d_moy : bigint?,
+ d_dom : bigint?,
+ d_qoy : bigint?,
+ d_fy_year : bigint?,
+ d_fy_quarter_seq : bigint?,
+ d_fy_week_seq : bigint?,
+ d_day_name : string?,
+ d_quarter_name : string?,
+ d_holiday : string?,
+ d_weekend : string?,
+ d_following_holiday : string?,
+ d_first_dom : bigint?,
+ d_last_dom : bigint?,
+ d_same_day_ly : bigint?,
+ d_same_day_lq : bigint?,
+ d_current_day : string?,
+ d_current_week : string?,
+ d_current_month : string?,
+ d_current_quarter : string?,
+ d_current_year : string?
+};
+
+create dataset store (store_type) primary key s_store_sk;
+
+create dataset store_sales (store_sales_type) primary key ss_item_sk, ss_ticket_number;
+
+create dataset store_returns (store_returns_type) primary key sr_item_sk, sr_ticket_number;
+
+create dataset catalog_sales (catalog_sales_type) primary key cs_item_sk, cs_order_number;
+
+create dataset catalog_returns (catalog_returns_type) primary key cr_item_sk, cr_order_number;
+
+create dataset web_page (web_page_type) primary key wp_web_page_sk;
+
+create dataset web_sales (web_sales_type) primary key ws_item_sk, ws_order_number;
+
+create dataset web_returns (web_returns_type) primary key wr_item_sk, wr_order_number;
+
+create dataset date_dim(date_dim_type) primary key d_date_sk;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q77/q77.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q77/q77.2.update.sqlpp
new file mode 100644
index 0000000..6e356c7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q77/q77.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+use tpcds;
+
+load dataset store using localfs ((`path`=`asterix_nc1://data/tpcds/store.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset store_sales using localfs ((`path`=`asterix_nc1://data/tpcds/store_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset store_returns using localfs ((`path`=`asterix_nc1://data/tpcds/store_returns.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset catalog_sales using localfs ((`path`=`asterix_nc1://data/tpcds/catalog_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset catalog_returns using localfs ((`path`=`asterix_nc1://data/tpcds/catalog_returns.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset web_page using localfs ((`path`=`asterix_nc1://data/tpcds/web_page.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset web_sales using localfs ((`path`=`asterix_nc1://data/tpcds/web_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset web_returns using localfs ((`path`=`asterix_nc1://data/tpcds/web_returns.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset date_dim using localfs ((`path`=`asterix_nc1://data/tpcds/date_dim.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q77/q77.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q77/q77.3.query.sqlpp
new file mode 100644
index 0000000..05ff05a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q77/q77.3.query.sqlpp
@@ -0,0 +1,115 @@
+/*
+ * 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.
+ */
+
+USE tpcds;
+
+WITH
+ss AS (
+ SELECT s.s_store_sk,
+ SUM(ss.ss_ext_sales_price) AS sales,
+ SUM(ss.ss_net_profit) AS profit
+ FROM store_sales ss, date_dim d, store s
+ WHERE ss.ss_sold_date_sk = d.d_date_sk
+ AND date(d.d_date) BETWEEN date('1999-01-01') AND (date('1999-01-01') + duration('P1Y'))
+ AND ss.ss_store_sk = s.s_store_sk
+ GROUP BY s.s_store_sk
+),
+sr AS (
+ SELECT s.s_store_sk,
+ SUM(sr.sr_return_amt) AS returns,
+ SUM(sr.sr_net_loss) AS profit_loss
+ FROM store_returns sr, date_dim d, store s
+ WHERE sr.sr_returned_date_sk = d.d_date_sk
+ AND date(d.d_date) BETWEEN date('1999-01-01') AND (date('1999-01-01') + duration('P1Y'))
+ AND sr.sr_store_sk = s.s_store_sk
+ GROUP BY s.s_store_sk
+),
+cs AS (
+ SELECT cs.cs_call_center_sk,
+ SUM(cs.cs_ext_sales_price) AS sales,
+ SUM(cs.cs_net_profit) AS profit
+ FROM catalog_sales cs, date_dim d
+ WHERE cs.cs_sold_date_sk = d.d_date_sk
+ AND date(d.d_date) BETWEEN date('1999-01-01') AND (date('1999-01-01') + duration('P1Y'))
+ GROUP BY cs.cs_call_center_sk
+),
+cr AS (
+ SELECT cr.cr_call_center_sk,
+ SUM(cr.cr_return_amount) AS returns,
+ SUM(cr.cr_net_loss) AS profit_loss
+ FROM catalog_returns cr, date_dim d
+ WHERE cr.cr_returned_date_sk = d.d_date_sk
+ AND date(d.d_date) BETWEEN date('1999-01-01') AND (date('1999-01-01') + duration('P1Y'))
+ GROUP by cr.cr_call_center_sk
+),
+ws AS (
+ SELECT wp.wp_web_page_sk,
+ SUM(ws.ws_ext_sales_price) AS sales,
+ SUM(ws.ws_net_profit) AS profit
+ FROM web_sales ws, date_dim d, web_page wp
+ WHERE ws.ws_sold_date_sk = d.d_date_sk
+ AND date(d.d_date) BETWEEN date('1999-01-01') AND (date('1999-01-01') + duration('P1Y'))
+ AND ws.ws_web_page_sk = wp.wp_web_page_sk
+ GROUP BY wp.wp_web_page_sk
+),
+wr AS (
+ SELECT wp.wp_web_page_sk,
+ SUM(wr.wr_return_amt) AS returns,
+ SUM(wr.wr_net_loss) AS profit_loss
+ FROM web_returns wr, date_dim d, web_page wp
+ WHERE wr.wr_returned_date_sk = d.d_date_sk
+ AND date(d.d_date) BETWEEN date('1999-01-01') AND (date('1999-01-01') + duration('P1Y'))
+ AND wr.wr_web_page_sk = wp.wp_web_page_sk
+ GROUP BY wp.wp_web_page_sk
+)
+
+SELECT channel,
+ id,
+ ROUND(SUM(sales), 2) AS sales,
+ ROUND(SUM(returns), 2) AS returns,
+ ROUND(SUM(profit), 2) AS profit
+FROM (
+ SELECT 'store channel' AS channel,
+ ss.s_store_sk AS id,
+ ss.sales,
+ COALESCE(sr.returns, 0.0) AS returns,
+ (ss.profit - COALESCE(sr.profit_loss, 0.0)) AS profit
+ FROM ss LEFT JOIN sr ON ss.s_store_sk = sr.s_store_sk
+
+ UNION ALL
+
+ SELECT 'catalog channel' AS channel,
+ cs.cs_call_center_sk AS id,
+ cs.sales,
+ cr.returns,
+ (cs.profit - cr.profit_loss) AS profit
+ FROM cs LEFT JOIN cr ON cs.cs_call_center_sk = cr.cr_call_center_sk
+
+ UNION ALL
+
+ SELECT 'web channel' AS channel,
+ ws.wp_web_page_sk AS id,
+ ROUND(ws.sales, 2) AS sales,
+ ROUND(COALESCE(wr.returns, 0.0), 2) AS returns,
+ ROUND(ws.profit - COALESCE(wr.profit_loss, 0.0), 2) AS profit
+ FROM ws LEFT JOIN wr ON ws.wp_web_page_sk = wr.wp_web_page_sk
+) x
+GROUP BY ROLLUP(channel, id)
+ORDER BY channel, id
+LIMIT 100;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q80/q80.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q80/q80.1.ddl.sqlpp
new file mode 100644
index 0000000..a720685
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q80/q80.1.ddl.sqlpp
@@ -0,0 +1,410 @@
+/*
+ * 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.
+ */
+
+drop dataverse tpcds if exists;
+create dataverse tpcds;
+
+use tpcds;
+
+create type tpcds.store_type as
+ closed {
+ s_store_sk : bigint,
+ s_store_id : string,
+ s_rec_start_date : string?,
+ s_rec_end_date : string?,
+ s_closed_date_sk : bigint?,
+ s_store_name : string?,
+ s_number_employees : bigint?,
+ s_floor_space : bigint?,
+ s_hours : string?,
+ s_manager : string?,
+ s_market_id : bigint?,
+ s_geography_class : string?,
+ s_market_desc : string?,
+ s_market_manager : string?,
+ s_division_id : bigint?,
+ s_division_name : string?,
+ s_company_id : bigint?,
+ s_company_name : string?,
+ s_street_number : string?,
+ s_street_name : string?,
+ s_street_type : string?,
+ s_suite_number : string?,
+ s_city : string?,
+ s_county : string?,
+ s_state : string?,
+ s_zip : string?,
+ s_country : string?,
+ s_gmt_offset : double?,
+ s_tax_precentage : double?
+};
+
+create type tpcds.store_sales_type as
+ closed {
+ ss_sold_date_sk: bigint?,
+ ss_sold_time_sk: bigint?,
+ ss_item_sk: bigint,
+ ss_customer_sk: bigint?,
+ ss_cdemo_sk: bigint?,
+ ss_hdemo_sk: bigint?,
+ ss_addr_sk: bigint?,
+ ss_store_sk: bigint?,
+ ss_promo_sk: bigint?,
+ ss_ticket_number: bigint,
+ ss_quantity: bigint?,
+ ss_wholesale_cost: double?,
+ ss_list_price: double?,
+ ss_sales_price: double?,
+ ss_ext_discount_amt: double?,
+ ss_ext_sales_price: double?,
+ ss_ext_wholesale_cost: double?,
+ ss_ext_list_price: double?,
+ ss_ext_tax: double?,
+ ss_coupon_amt: double?,
+ ss_net_paid: double?,
+ ss_net_paid_inc_tax: double?,
+ ss_net_profit: double?
+};
+
+create type tpcds.store_returns_type as
+ closed {
+ sr_returned_date_sk : int64?,
+ sr_return_time_sk : int64?,
+ sr_item_sk : int64,
+ sr_customer_sk : int64?,
+ sr_cdemo_sk : int64?,
+ sr_hdemo_sk : int64?,
+ sr_addr_sk : int64?,
+ sr_store_sk : int64?,
+ sr_reason_sk : int64?,
+ sr_ticket_number : int64,
+ sr_return_quantity : int64?,
+ sr_return_amt : double,
+ sr_return_tax : double?,
+ sr_return_amt_inc_tax : double?,
+ sr_fee : double?,
+ sr_return_ship_cost : double?,
+ sr_refunded_cash : double?,
+ sr_reversed_charge : double?,
+ sr_store_credit : double?,
+ sr_net_loss : double?
+};
+
+create type tpcds.catalog_sales_type as
+ closed {
+ cs_sold_date_sk: bigint?,
+ cs_sold_time_sk: bigint?,
+ cs_ship_date_sk: bigint?,
+ cs_bill_customer_sk: bigint?,
+ cs_bill_cdemo_sk: bigint?,
+ cs_bill_hdemo_sk: bigint?,
+ cs_bill_addr_sk: bigint?,
+ cs_ship_customer_sk: bigint?,
+ cs_ship_cdemo_sk: bigint?,
+ cs_ship_hdemo_sk: bigint?,
+ cs_ship_addr_sk: bigint?,
+ cs_call_center_sk: bigint?,
+ cs_catalog_page_sk: bigint?,
+ cs_ship_mode_sk: bigint?,
+ cs_warehouse_sk: bigint?,
+ cs_item_sk: bigint,
+ cs_promo_sk: bigint?,
+ cs_order_number: bigint,
+ cs_quantity: bigint?,
+ cs_wholesale_cost: double?,
+ cs_list_price: double?,
+ cs_sales_price: double?,
+ cs_ext_discount_amt: double?,
+ cs_ext_sales_price: double?,
+ cs_ext_wholesale_cost: double?,
+ cs_ext_list_price: double?,
+ cs_ext_tax: double?,
+ cs_coupon_amt: double?,
+ cs_ext_ship_cost: double?,
+ cs_net_paid: double?,
+ cs_net_paid_inc_tax: double?,
+ cs_net_paid_inc_ship: double?,
+ cs_net_paid_inc_ship_tax: double?,
+ cs_net_profit: double?
+};
+
+create type tpcds.catalog_returns_type as
+ closed {
+ cr_returned_date_sk : bigint?,
+ cr_returned_time_sk : bigint?,
+ cr_item_sk : bigint,
+ cr_refunded_customer_sk : bigint?,
+ cr_refunded_cdemo_sk : bigint?,
+ cr_refunded_hdemo_sk : bigint?,
+ cr_refunded_addr_sk : bigint?,
+ cr_returning_customer_sk : bigint?,
+ cr_returning_cdemo_sk : bigint?,
+ cr_returning_hdemo_sk : bigint?,
+ cr_returning_addr_sk : bigint?,
+ cr_call_center_sk : bigint?,
+ cr_catalog_page_sk : bigint?,
+ cr_ship_mode_sk : bigint?,
+ cr_warehouse_sk : bigint?,
+ cr_reason_sk : bigint?,
+ cr_order_number : bigint,
+ cr_return_quantity : bigint?,
+ cr_return_amount : double?,
+ cr_return_tax : double?,
+ cr_return_amt_inc_tax : double?,
+ cr_fee : double?,
+ cr_return_ship_cost : double?,
+ cr_refunded_cash : double?,
+ cr_reversed_charge : double?,
+ cr_store_credit : double?,
+ cr_net_loss : double?
+};
+
+create type tpcds.web_page_type as
+ closed {
+ wp_web_page_sk : int64,
+ wp_web_page_id : string,
+ wp_rec_start_date : string?,
+ wp_rec_end_date : string?,
+ wp_creation_date_sk : int64?,
+ wp_access_date_sk : int64?,
+ wp_autogen_flag : string?,
+ wp_customer_sk : int64?,
+ wp_url : string?,
+ wp_type : string?,
+ wp_char_count : int64?,
+ wp_link_count : int64?,
+ wp_image_count : int64?,
+ wp_max_ad_count : int64?
+};
+
+create type tpcds.web_sales_type as
+ closed {
+ ws_sold_date_sk : int64?,
+ ws_sold_time_sk : int64?,
+ ws_ship_date_sk : int64?,
+ ws_item_sk : int64,
+ ws_bill_customer_sk : int64?,
+ ws_bill_cdemo_sk : int64?,
+ ws_bill_hdemo_sk : int64?,
+ ws_bill_addr_sk : int64?,
+ ws_ship_customer_sk : int64?,
+ ws_ship_cdemo_sk : int64?,
+ ws_ship_hdemo_sk : int64?,
+ ws_ship_addr_sk : int64?,
+ ws_web_page_sk : int64?,
+ ws_web_site_sk : int64?,
+ ws_ship_mode_sk : int64?,
+ ws_warehouse_sk : int64?,
+ ws_promo_sk : int64?,
+ ws_order_number : int64,
+ ws_quantity : int64?,
+ ws_wholesale_cost : double?,
+ ws_list_price : double?,
+ ws_sales_price : double?,
+ ws_ext_discount_amt : double?,
+ ws_ext_sales_price : double?,
+ ws_ext_wholesale_cost : double?,
+ ws_ext_list_price : double?,
+ ws_ext_tax : double?,
+ ws_coupon_amt : double?,
+ ws_ext_ship_cost : double?,
+ ws_net_paid : double?,
+ ws_net_paid_inc_tax : double?,
+ ws_net_paid_inc_ship : double?,
+ ws_net_paid_inc_ship_tax : double?,
+ ws_net_profit : double?
+};
+
+create type tpcds.web_returns_type as
+ closed {
+ wr_returned_date_sk : bigint?,
+ wr_returned_time_sk : bigint?,
+ wr_item_sk : bigint,
+ wr_refunded_customer_sk : bigint?,
+ wr_refunded_cdemo_sk : bigint?,
+ wr_refunded_hdemo_sk : bigint?,
+ wr_refunded_addr_sk : bigint?,
+ wr_returning_customer_sk : bigint?,
+ wr_returning_cdemo_sk : bigint?,
+ wr_returning_hdemo_sk : bigint?,
+ wr_returning_addr_sk : bigint?,
+ wr_web_page_sk : bigint?,
+ wr_reason_sk : bigint?,
+ wr_order_number : bigint,
+ wr_return_quantity : bigint?,
+ wr_return_amt : double?,
+ wr_return_tax : double?,
+ wr_return_amt_inc_tax : double?,
+ wr_fee : double?,
+ wr_return_ship_cost: double?,
+ wr_refunded_cash: double?,
+ wr_reversed_charge: double?,
+ wr_account_credit: double?,
+ wr_net_loss: double?
+};
+
+create type tpcds.date_dim_type as
+ closed {
+ d_date_sk : bigint,
+ d_date_id : string,
+ d_date : string?,
+ d_month_seq : bigint?,
+ d_week_seq : bigint?,
+ d_quarter_seq : bigint?,
+ d_year : bigint? ,
+ d_dow : bigint? ,
+ d_moy : bigint?,
+ d_dom : bigint?,
+ d_qoy : bigint?,
+ d_fy_year : bigint?,
+ d_fy_quarter_seq : bigint?,
+ d_fy_week_seq : bigint?,
+ d_day_name : string?,
+ d_quarter_name : string?,
+ d_holiday : string?,
+ d_weekend : string?,
+ d_following_holiday : string?,
+ d_first_dom : bigint?,
+ d_last_dom : bigint?,
+ d_same_day_ly : bigint?,
+ d_same_day_lq : bigint?,
+ d_current_day : string?,
+ d_current_week : string?,
+ d_current_month : string?,
+ d_current_quarter : string?,
+ d_current_year : string?
+};
+
+create type tpcds.item_type as
+ closed {
+ i_item_sk : bigint,
+ i_item_id : string,
+ i_rec_start_date : string?,
+ i_rec_end_date : string?,
+ i_item_desc : string?,
+ i_current_price : double?,
+ i_wholesale_cost : double?,
+ i_brand_id : bigint?,
+ i_brand : string?,
+ i_class_id : bigint?,
+ i_class : string?,
+ i_category_id : bigint?,
+ i_category : string?,
+ i_manufact_id : bigint?,
+ i_manufact : string?,
+ i_size : string?,
+ i_formulation : string?,
+ i_color : string?,
+ i_units : string?,
+ i_container : string?,
+ i_manager_id : bigint?,
+ i_product_name : string?
+};
+
+create type tpcds.promotion_type as
+ closed {
+ p_promo_sk : bigint,
+ p_promo_id : string,
+ p_start_date_sk : bigint?,
+ p_end_date_sk : bigint?,
+ p_item_sk : bigint?,
+ p_cost : double?,
+ p_response_target : bigint?,
+ p_promo_name : string?,
+ p_channel_dmail : string?,
+ p_channel_email : string?,
+ p_channel_catalog : string?,
+ p_channel_tv : string?,
+ p_channel_radio : string?,
+ p_channel_press : string?,
+ p_channel_event : string?,
+ p_channel_demo : string?,
+ p_channel_details : string?,
+ p_purpose : string?,
+ p_discount_active : string?
+};
+
+create type tpcds.web_site_type as
+ closed {
+ web_site_sk: bigint,
+ web_site_id: string,
+ web_rec_start_date: string?,
+ web_rec_end_date: string?,
+ web_name: string?,
+ web_open_date_sk: bigint?,
+ web_close_date_sk: bigint?,
+ web_class: string?,
+ web_manager: string?,
+ web_mkt_id: bigint?,
+ web_mkt_class: string?,
+ web_mkt_desc: string?,
+ web_market_manager: string?,
+ web_company_id: bigint?,
+ web_company_name: string?,
+ web_street_number: string?,
+ web_street_name: string?,
+ web_street_type: string?,
+ web_suite_number: string?,
+ web_city: string?,
+ web_county: string?,
+ web_state: string?,
+ web_zip: string?,
+ web_country: string?,
+ web_gmt_offset: double?,
+ web_tax_percentage: double?
+};
+
+create type tpcds.catalog_page_type as
+ closed {
+ cp_catalog_page_sk: bigint,
+ cp_catalog_page_id: string,
+ cp_start_date_sk: bigint?,
+ cp_end_date_sk: bigint?,
+ cp_department: string?,
+ cp_catalog_number: bigint?,
+ cp_catalog_page_number: bigint?,
+ cp_description: string?,
+ cp_type: string?
+};
+
+create dataset store (store_type) primary key s_store_sk;
+
+create dataset store_sales (store_sales_type) primary key ss_item_sk, ss_ticket_number;
+
+create dataset store_returns (store_returns_type) primary key sr_item_sk, sr_ticket_number;
+
+create dataset catalog_sales (catalog_sales_type) primary key cs_item_sk, cs_order_number;
+
+create dataset catalog_returns (catalog_returns_type) primary key cr_item_sk, cr_order_number;
+
+create dataset web_page (web_page_type) primary key wp_web_page_sk;
+
+create dataset web_sales (web_sales_type) primary key ws_item_sk, ws_order_number;
+
+create dataset web_returns (web_returns_type) primary key wr_item_sk, wr_order_number;
+
+create dataset date_dim(date_dim_type) primary key d_date_sk;
+
+create dataset item (item_type) primary key i_item_sk;
+
+create dataset promotion (promotion_type) primary key p_promo_sk;
+
+create dataset web_site (web_site_type) primary key web_site_sk;
+
+create dataset catalog_page (catalog_page_type) primary key cp_catalog_page_sk;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q80/q80.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q80/q80.2.update.sqlpp
new file mode 100644
index 0000000..795b065
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q80/q80.2.update.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+use tpcds;
+
+load dataset store using localfs ((`path`=`asterix_nc1://data/tpcds/store.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset store_sales using localfs ((`path`=`asterix_nc1://data/tpcds/store_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset store_returns using localfs ((`path`=`asterix_nc1://data/tpcds/store_returns.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset catalog_sales using localfs ((`path`=`asterix_nc1://data/tpcds/catalog_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset catalog_returns using localfs ((`path`=`asterix_nc1://data/tpcds/catalog_returns.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset web_page using localfs ((`path`=`asterix_nc1://data/tpcds/web_page.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset web_sales using localfs ((`path`=`asterix_nc1://data/tpcds/web_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset web_returns using localfs ((`path`=`asterix_nc1://data/tpcds/web_returns.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset date_dim using localfs ((`path`=`asterix_nc1://data/tpcds/date_dim.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset item using localfs ((`path`=`asterix_nc1://data/tpcds/item.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset promotion using localfs ((`path`=`asterix_nc1://data/tpcds/promotion.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset web_site using localfs ((`path`=`asterix_nc1://data/tpcds/web_site.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset catalog_page using localfs ((`path`=`asterix_nc1://data/tpcds/catalog_page.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q80/q80.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q80/q80.3.query.sqlpp
new file mode 100644
index 0000000..09165e3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q80/q80.3.query.sqlpp
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ */
+
+USE tpcds;
+
+WITH
+ssr AS (
+ SELECT s.s_store_id AS store_id,
+ SUM(ss.ss_ext_sales_price) AS sales,
+ SUM(COALESCE(sr.sr_return_amt, 0.0)) AS returns,
+ SUM(ss.ss_net_profit - COALESCE(sr.sr_net_loss, 0.0)) AS profit
+ FROM store_sales ss
+ LEFT OUTER JOIN store_returns sr ON (ss.ss_item_sk = sr.sr_item_sk AND ss.ss_ticket_number = sr.sr_ticket_number),
+ date_dim d, store s, item i, promotion p
+ WHERE ss.ss_sold_date_sk = d.d_date_sk
+ AND date(d.d_date) BETWEEN date('1998-01-01') AND (date('1998-01-01') + duration('P5Y'))
+ AND ss.ss_store_sk = s.s_store_sk
+ AND ss.ss_item_sk = i.i_item_sk
+ AND i.i_current_price > 1
+ AND ss.ss_promo_sk = p.p_promo_sk
+ AND p.p_channel_tv = 'N'
+ GROUP BY s.s_store_id
+),
+
+csr AS (
+ SELECT cp.cp_catalog_page_id AS catalog_page_id,
+ SUM(cs.cs_ext_sales_price) AS sales,
+ SUM(COALESCE(cr.cr_return_amount, 0.0)) AS returns,
+ SUM(cs.cs_net_profit - COALESCE(cr.cr_net_loss, 0.0)) AS profit
+ FROM catalog_sales cs
+ LEFT OUTER JOIN catalog_returns cr ON (cs.cs_item_sk = cr.cr_item_sk AND cs.cs_order_number = cr.cr_order_number),
+ date_dim d, catalog_page cp, item i, promotion p
+ WHERE cs.cs_sold_date_sk = d.d_date_sk
+ AND date(d.d_date) BETWEEN date('1998-01-01') AND (date('1998-01-01') + duration('P5Y'))
+ AND cs.cs_catalog_page_sk = cp.cp_catalog_page_sk
+ AND cs.cs_item_sk = i.i_item_sk
+ AND i.i_current_price > 1
+ AND cs.cs_promo_sk = p.p_promo_sk
+ AND p.p_channel_tv = 'N'
+ GROUP BY cp.cp_catalog_page_id
+),
+
+wsr AS (
+ SELECT web.web_site_id,
+ SUM(ws.ws_ext_sales_price) AS sales,
+ SUM(COALESCE(wr.wr_return_amt, 0.0)) AS returns,
+ SUM(ws.ws_net_profit - COALESCE(wr.wr_net_loss, 0.0)) AS profit
+ FROM web_sales ws
+ LEFT OUTER JOIN web_returns wr ON (ws.ws_item_sk = wr.wr_item_sk AND ws.ws_order_number = wr.wr_order_number),
+ date_dim d, web_site web, item i, promotion p
+ WHERE ws.ws_sold_date_sk = d.d_date_sk
+ AND date(d.d_date) BETWEEN date('1998-01-01') AND (date('1998-01-01') + duration('P5Y'))
+ AND ws.ws_web_site_sk = web.web_site_sk
+ AND ws.ws_item_sk = i.i_item_sk
+ AND i.i_current_price > 1
+ AND ws.ws_promo_sk = p.p_promo_sk
+ AND p.p_channel_tv = 'N'
+ GROUP BY web.web_site_id
+)
+
+SELECT channel, id,
+ ROUND(SUM(sales), 2) AS sales,
+ ROUND(SUM(returns), 2) AS returns,
+ ROUND(SUM(profit), 2) AS profit
+FROM (
+ SELECT 'store channel' AS channel,
+ 'store' || store_id AS id,
+ sales,
+ returns,
+ profit
+ FROM ssr
+
+ UNION ALL
+
+ SELECT 'catalog channel' AS channel,
+ 'catalog_page' || catalog_page_id AS id,
+ sales,
+ returns,
+ profit
+ FROM csr
+
+ UNION ALL
+
+ SELECT 'web channel' AS channel,
+ 'web_site' || web_site_id AS id,
+ ROUND(sales, 2) AS sales,
+ ROUND(returns, 2) AS returns,
+ ROUND(profit, 2) AS profit
+ FROM wsr
+) x
+GROUP BY ROLLUP (channel, id)
+ORDER BY channel, id
+LIMIT 100;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q86/q86.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q86/q86.1.ddl.sqlpp
new file mode 100644
index 0000000..0cee82b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q86/q86.1.ddl.sqlpp
@@ -0,0 +1,125 @@
+/*
+ * 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.
+ */
+
+drop dataverse tpcds if exists;
+create dataverse tpcds;
+
+use tpcds;
+
+create type tpcds.item_type as
+ closed {
+ i_item_sk : bigint,
+ i_item_id : string,
+ i_rec_start_date : string?,
+ i_rec_end_date : string?,
+ i_item_desc : string?,
+ i_current_price : double?,
+ i_wholesale_cost : double?,
+ i_brand_id : bigint?,
+ i_brand : string?,
+ i_class_id : bigint?,
+ i_class : string?,
+ i_category_id : bigint?,
+ i_category : string?,
+ i_manufact_id : bigint?,
+ i_manufact : string?,
+ i_size : string?,
+ i_formulation : string?,
+ i_color : string?,
+ i_units : string?,
+ i_container : string?,
+ i_manager_id : bigint?,
+ i_product_name : string?
+};
+
+create type tpcds.date_dim_type as
+ closed {
+ d_date_sk : bigint,
+ d_date_id : string,
+ d_date : string?,
+ d_month_seq : bigint?,
+ d_week_seq : bigint?,
+ d_quarter_seq : bigint?,
+ d_year : bigint? ,
+ d_dow : bigint? ,
+ d_moy : bigint?,
+ d_dom : bigint?,
+ d_qoy : bigint?,
+ d_fy_year : bigint?,
+ d_fy_quarter_seq : bigint?,
+ d_fy_week_seq : bigint?,
+ d_day_name : string?,
+ d_quarter_name : string?,
+ d_holiday : string?,
+ d_weekend : string?,
+ d_following_holiday : string?,
+ d_first_dom : bigint?,
+ d_last_dom : bigint?,
+ d_same_day_ly : bigint?,
+ d_same_day_lq : bigint?,
+ d_current_day : string?,
+ d_current_week : string?,
+ d_current_month : string?,
+ d_current_quarter : string?,
+ d_current_year : string?
+};
+
+create type tpcds.web_sales_type as
+ closed {
+ ws_sold_date_sk : int64?,
+ ws_sold_time_sk : int64?,
+ ws_ship_date_sk : int64?,
+ ws_item_sk : int64,
+ ws_bill_customer_sk : int64?,
+ ws_bill_cdemo_sk : int64?,
+ ws_bill_hdemo_sk : int64?,
+ ws_bill_addr_sk : int64?,
+ ws_ship_customer_sk : int64?,
+ ws_ship_cdemo_sk : int64?,
+ ws_ship_hdemo_sk : int64?,
+ ws_ship_addr_sk : int64?,
+ ws_web_page_sk : int64?,
+ ws_web_site_sk : int64?,
+ ws_ship_mode_sk : int64?,
+ ws_warehouse_sk : int64?,
+ ws_promo_sk : int64?,
+ ws_order_number : int64,
+ ws_quantity : int64?,
+ ws_wholesale_cost : double?,
+ ws_list_price : double?,
+ ws_sales_price : double?,
+ ws_ext_discount_amt : double?,
+ ws_ext_sales_price : double?,
+ ws_ext_wholesale_cost : double?,
+ ws_ext_list_price : double?,
+ ws_ext_tax : double?,
+ ws_coupon_amt : double?,
+ ws_ext_ship_cost : double?,
+ ws_net_paid : double?,
+ ws_net_paid_inc_tax : double?,
+ ws_net_paid_inc_ship : double?,
+ ws_net_paid_inc_ship_tax : double?,
+ ws_net_profit : double?
+};
+
+create dataset item (item_type) primary key i_item_sk;
+
+create dataset date_dim(date_dim_type) primary key d_date_sk;
+
+create dataset web_sales (web_sales_type) primary key ws_item_sk, ws_order_number;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q86/q86.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q86/q86.2.update.sqlpp
new file mode 100644
index 0000000..33b61cd
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q86/q86.2.update.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+use tpcds;
+
+load dataset item using localfs ((`path`=`asterix_nc1://data/tpcds/item.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset date_dim using localfs ((`path`=`asterix_nc1://data/tpcds/date_dim.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
+
+load dataset web_sales using localfs ((`path`=`asterix_nc1://data/tpcds/web_sales.csv`),(`format`=`delimited-text`),(`delimiter`=`|`),(`null`=``));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q86/q86.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q86/q86.3.query.sqlpp
new file mode 100644
index 0000000..c47fba0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpcds/q86/q86.3.query.sqlpp
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+USE tpcds;
+
+SELECT
+ ROUND(SUM(ws.ws_net_paid), 2) AS total_sum,
+ i.i_category,
+ i.i_class,
+ GROUPING(i.i_category) + GROUPING(i.i_class) AS lochierarchy,
+ RANK() OVER (
+ PARTITION BY GROUPING(i.i_category) + GROUPING(i.i_class),
+ CASE WHEN GROUPING(i.i_class) = 0 THEN i.i_category END
+ ORDER BY SUM(ws.ws_net_paid) DESC
+ ) AS rank_within_parent
+ FROM web_sales ws, date_dim d, item i
+ WHERE d.d_month_seq between 1000 and 2000
+ AND d.d_date_sk = ws.ws_sold_date_sk
+ AND i.i_item_sk = ws.ws_item_sk
+ GROUP BY ROLLUP(i.i_category, i.i_class)
+ ORDER BY
+ lochierarchy DESC,
+ CASE WHEN lochierarchy = 0 THEN i.i_category END,
+ rank_within_parent
+LIMIT 100;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.regexadm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.regexadm
index 378fc83..b6a49a6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.regexadm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.regexadm
@@ -14,6 +14,7 @@
"compiler\.indexonly" : true,
"compiler\.internal\.sanitycheck" : true,
"compiler\.joinmemory" : 262144,
+ "compiler\.min\.memory\.allocation" : true,
"compiler\.parallelism" : 0,
"compiler\.sort\.parallel" : false,
"compiler\.sort\.samples" : 100,
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.regexadm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.regexadm
index 5ff1b7a..dedb40f 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.regexadm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.regexadm
@@ -14,6 +14,7 @@
"compiler\.indexonly" : true,
"compiler\.internal\.sanitycheck" : false,
"compiler\.joinmemory" : 262144,
+ "compiler\.min\.memory\.allocation" : true,
"compiler\.parallelism" : -1,
"compiler\.sort\.parallel" : true,
"compiler\.sort\.samples" : 100,
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.regexadm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.regexadm
index 2e76d04..985d3bd 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.regexadm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.regexadm
@@ -14,6 +14,7 @@
"compiler\.indexonly" : true,
"compiler\.internal\.sanitycheck" : false,
"compiler\.joinmemory" : 262144,
+ "compiler\.min\.memory\.allocation" : true,
"compiler\.parallelism" : 3,
"compiler\.sort\.parallel" : true,
"compiler\.sort\.samples" : 100,
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/group-by/grouping-sets-1/grouping-sets-1.16.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/group-by/grouping-sets-1/grouping-sets-1.16.adm
new file mode 100644
index 0000000..13bcff2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/group-by/grouping-sets-1/grouping-sets-1.16.adm
@@ -0,0 +1,7 @@
+{ "two": null, "four": null, "agg_sum": 45000 }
+{ "two": 0, "four": null, "agg_sum": 20000 }
+{ "two": 0, "four": 0, "agg_sum": 10000 }
+{ "two": 0, "four": 2, "agg_sum": 10000 }
+{ "two": 1, "four": null, "agg_sum": 25000 }
+{ "two": 1, "four": 1, "agg_sum": 12500 }
+{ "two": 1, "four": 3, "agg_sum": 12500 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/group-by/grouping-sets-1/grouping-sets-1.17.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/group-by/grouping-sets-1/grouping-sets-1.17.adm
new file mode 100644
index 0000000..d6f49a5
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/group-by/grouping-sets-1/grouping-sets-1.17.adm
@@ -0,0 +1,7 @@
+{ "two": null, "four": null, "agg_sum": 18000 }
+{ "two": 0, "four": null, "agg_sum": 8000 }
+{ "two": 0, "four": 0, "agg_sum": 4000 }
+{ "two": 0, "four": 2, "agg_sum": 4000 }
+{ "two": 1, "four": null, "agg_sum": 10000 }
+{ "two": 1, "four": 1, "agg_sum": 5000 }
+{ "two": 1, "four": 3, "agg_sum": 5000 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/group-by/grouping-sets-1/grouping-sets-1.18.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/group-by/grouping-sets-1/grouping-sets-1.18.adm
new file mode 100644
index 0000000..4ff4ee6
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/group-by/grouping-sets-1/grouping-sets-1.18.adm
@@ -0,0 +1,7 @@
+{ "two": null, "two_plus_four": null, "grp_two": 1, "grp_two_plus_four": 1, "agg_sum": 45000 }
+{ "two": 0, "two_plus_four": null, "grp_two": 0, "grp_two_plus_four": 1, "agg_sum": 20000 }
+{ "two": 0, "two_plus_four": 0, "grp_two": 0, "grp_two_plus_four": 0, "agg_sum": 10000 }
+{ "two": 0, "two_plus_four": 2, "grp_two": 0, "grp_two_plus_four": 0, "agg_sum": 10000 }
+{ "two": 1, "two_plus_four": null, "grp_two": 0, "grp_two_plus_four": 1, "agg_sum": 25000 }
+{ "two": 1, "two_plus_four": 2, "grp_two": 0, "grp_two_plus_four": 0, "agg_sum": 12500 }
+{ "two": 1, "two_plus_four": 4, "grp_two": 0, "grp_two_plus_four": 0, "agg_sum": 12500 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/group-by/grouping-sets-1/grouping-sets-1.19.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/group-by/grouping-sets-1/grouping-sets-1.19.adm
new file mode 100644
index 0000000..e143f9a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/group-by/grouping-sets-1/grouping-sets-1.19.adm
@@ -0,0 +1,7 @@
+{ "two": null, "four": null, "agg_sum": 45000, "total_sum": 45000 }
+{ "two": 0, "four": null, "agg_sum": 20000, "total_sum": 45000 }
+{ "two": 0, "four": 0, "agg_sum": 10000, "total_sum": 45000 }
+{ "two": 0, "four": 2, "agg_sum": 10000, "total_sum": 45000 }
+{ "two": 1, "four": null, "agg_sum": 25000, "total_sum": 45000 }
+{ "two": 1, "four": 1, "agg_sum": 12500, "total_sum": 45000 }
+{ "two": 1, "four": 3, "agg_sum": 12500, "total_sum": 45000 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/metadata_only_01/metadata_only_01.2.regex b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/metadata_only_01/metadata_only_01.2.regex
new file mode 100644
index 0000000..6af6770
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/metadata_only_01/metadata_only_01.2.regex
@@ -0,0 +1 @@
+/memory\D+1146880/
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q05/q05.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q05/q05.1.adm
new file mode 100644
index 0000000..ccf54a5
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q05/q05.1.adm
@@ -0,0 +1,15 @@
+{ "channel": null, "id": null, "sales": 92502.1, "returns": 20611.78, "profit": -44495.08 }
+{ "channel": "catalog channel", "id": null, "sales": 34305.02, "returns": 0, "profit": 3323.76 }
+{ "channel": "catalog channel", "id": "catalog_pageAAAAAAAABAAAAAAA", "sales": 20382.0, "returns": 0, "profit": 6726.16 }
+{ "channel": "catalog channel", "id": "catalog_pageAAAAAAAAGODAAAAA", "sales": 2799.03, "returns": 0, "profit": -4495.31 }
+{ "channel": "catalog channel", "id": "catalog_pageAAAAAAAAHGFBAAAA", "sales": 6573.16, "returns": 0, "profit": -680.23 }
+{ "channel": "catalog channel", "id": "catalog_pageAAAAAAAAKKPAAAAA", "sales": 1362.3, "returns": 0, "profit": 337.82 }
+{ "channel": "catalog channel", "id": "catalog_pageAAAAAAAAPNHAAAAA", "sales": 3188.53, "returns": 0, "profit": 1435.32 }
+{ "channel": "store channel", "id": null, "sales": 34634.58, "returns": 16009.26, "profit": -31862.3 }
+{ "channel": "store channel", "id": "storeAAAAAAAABAAAAAAA", "sales": 14371.21, "returns": 1639.07, "profit": -10779.36 }
+{ "channel": "store channel", "id": "storeAAAAAAAACAAAAAAA", "sales": 17291.82, "returns": 12466.15, "profit": -17067.08 }
+{ "channel": "store channel", "id": "storeAAAAAAAAEAAAAAAA", "sales": 2971.55, "returns": 1904.04, "profit": -4015.86 }
+{ "channel": "web channel", "id": null, "sales": 23562.5, "returns": 4602.52, "profit": -15956.54 }
+{ "channel": "web channel", "id": "web_siteAAAAAAAABAAAAAAA", "sales": 2697.0, "returns": 0.0, "profit": -3422.4 }
+{ "channel": "web channel", "id": "web_siteAAAAAAAACAAAAAAA", "sales": 10639.24, "returns": 946.44, "profit": -5474.67 }
+{ "channel": "web channel", "id": "web_siteAAAAAAAAEAAAAAAA", "sales": 10226.26, "returns": 3656.08, "profit": -7059.47 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q15/q15.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q15/q15.1.adm
index cdb4592..d587183 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q15/q15.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q15/q15.1.adm
@@ -1 +1 @@
-{ "ca_zip": "35708", "$1": 108.92 }
\ No newline at end of file
+{ "ca_zip": "35708", "$1": 75.15 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q18/q18.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q18/q18.1.adm
new file mode 100644
index 0000000..f8abab3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q18/q18.1.adm
@@ -0,0 +1,5 @@
+{ "i_item_id": null, "ca_country": null, "ca_state": null, "ca_county": null, "agg1": 94.0, "agg2": 105.88, "agg3": 0.0, "agg4": 530.82, "agg5": 889.24, "agg6": null, "agg7": 0.0 }
+{ "i_item_id": "AAAAAAAAEAAAAAAA", "ca_country": null, "ca_state": null, "ca_county": null, "agg1": 94.0, "agg2": 105.88, "agg3": 0.0, "agg4": 530.82, "agg5": 889.24, "agg6": null, "agg7": 0.0 }
+{ "i_item_id": "AAAAAAAAEAAAAAAA", "ca_country": "United States", "ca_state": null, "ca_county": null, "agg1": 94.0, "agg2": 105.88, "agg3": 0.0, "agg4": 530.82, "agg5": 889.24, "agg6": null, "agg7": 0.0 }
+{ "i_item_id": "AAAAAAAAEAAAAAAA", "ca_country": "United States", "ca_state": "WA", "ca_county": null, "agg1": 94.0, "agg2": 105.88, "agg3": 0.0, "agg4": 530.82, "agg5": 889.24, "agg6": null, "agg7": 0.0 }
+{ "i_item_id": "AAAAAAAAEAAAAAAA", "ca_country": "United States", "ca_state": "WA", "ca_county": "Bledsoe County", "agg1": 94.0, "agg2": 105.88, "agg3": 0.0, "agg4": 530.82, "agg5": 889.24, "agg6": null, "agg7": 0.0 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q20/q20.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q20/q20.1.adm
index 3cc1b0b..ef84a63 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q20/q20.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q20/q20.1.adm
@@ -1,2 +1,3 @@
-{ "i_item_id": "AAAAAAAACAAAAAAA", "i_item_desc": "False opportunities would run alone with a views. Early approaches would show inc, european intentions; important, main passages shall know urban, ", "i_category": "Home", "i_class": "decor", "i_current_price": 7.11, "itemrevenue": 99.71, "revenueratio": 100.0 }
-{ "i_item_id": "AAAAAAAACAAAAAAA", "i_item_desc": "False opportunities would run alone with a views. Early approaches would show inc, european intentions; important, main passages shall know urban, ", "i_category": "Women", "i_class": "dresses", "i_current_price": 1.12, "itemrevenue": 2139.4, "revenueratio": 100.0 }
\ No newline at end of file
+{ "i_item_id": "AAAAAAAACAAAAAAA", "i_item_desc": "False opportunities would run alone with a views. Early approaches would show inc, european intentions; important, main passages shall know urban, ", "i_category": "Home", "i_class": "decor", "i_current_price": 7.11, "itemrevenue": 3078.4, "revenueratio": 100.0 }
+{ "i_item_id": "AAAAAAAAEAAAAAAA", "i_item_desc": "Normal systems would join simply different theories. Full, new clothes may eat instead achievements. D", "i_category": "Men", "i_class": "shirts", "i_current_price": 1.3, "itemrevenue": 5333.21, "revenueratio": 100.0 }
+{ "i_item_id": "AAAAAAAACAAAAAAA", "i_item_desc": "False opportunities would run alone with a views. Early approaches would show inc, european intentions; important, main passages shall know urban, ", "i_category": "Women", "i_class": "dresses", "i_current_price": 1.12, "itemrevenue": 396.45, "revenueratio": 100.0 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q22/q22.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q22/q22.1.adm
new file mode 100644
index 0000000..824c9d0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q22/q22.1.adm
@@ -0,0 +1,21 @@
+{ "i_product_name": "pri", "i_brand": null, "i_class": null, "i_category": null, "qoh": 24.0 }
+{ "i_product_name": "pri", "i_brand": "brandbrand #4", "i_class": null, "i_category": null, "qoh": 24.0 }
+{ "i_product_name": "pri", "i_brand": "brandbrand #4", "i_class": "decor", "i_category": null, "qoh": 24.0 }
+{ "i_product_name": "pri", "i_brand": "brandbrand #4", "i_class": "decor", "i_category": "Home", "qoh": 24.0 }
+{ "i_product_name": "anti", "i_brand": null, "i_class": null, "i_category": null, "qoh": 200.0 }
+{ "i_product_name": "anti", "i_brand": "importoimporto #2", "i_class": null, "i_category": null, "qoh": 200.0 }
+{ "i_product_name": "anti", "i_brand": "importoimporto #2", "i_class": "shirts", "i_category": null, "qoh": 200.0 }
+{ "i_product_name": "anti", "i_brand": "importoimporto #2", "i_class": "shirts", "i_category": "Men", "qoh": 200.0 }
+{ "i_product_name": "ought", "i_brand": null, "i_class": null, "i_category": null, "qoh": 405.0 }
+{ "i_product_name": "ought", "i_brand": "exportischolar #2", "i_class": null, "i_category": null, "qoh": 405.0 }
+{ "i_product_name": "ought", "i_brand": "exportischolar #2", "i_class": "pop", "i_category": null, "qoh": 405.0 }
+{ "i_product_name": "ought", "i_brand": "exportischolar #2", "i_class": "pop", "i_category": "Music", "qoh": 405.0 }
+{ "i_product_name": null, "i_brand": null, "i_class": null, "i_category": null, "qoh": 441.6 }
+{ "i_product_name": "n st", "i_brand": null, "i_class": null, "i_category": null, "qoh": 745.0 }
+{ "i_product_name": "n st", "i_brand": "edu packamalg #2", "i_class": null, "i_category": null, "qoh": 745.0 }
+{ "i_product_name": "n st", "i_brand": "edu packamalg #2", "i_class": "swimwear", "i_category": null, "qoh": 745.0 }
+{ "i_product_name": "n st", "i_brand": "edu packamalg #2", "i_class": "swimwear", "i_category": "Women", "qoh": 745.0 }
+{ "i_product_name": "barought", "i_brand": null, "i_class": null, "i_category": null, "qoh": 834.0 }
+{ "i_product_name": "barought", "i_brand": "namelessunivamalg #11", "i_class": null, "i_category": null, "qoh": 834.0 }
+{ "i_product_name": "barought", "i_brand": "namelessunivamalg #11", "i_class": "scanners", "i_category": null, "qoh": 834.0 }
+{ "i_product_name": "barought", "i_brand": "namelessunivamalg #11", "i_class": "scanners", "i_category": "Electronics", "qoh": 834.0 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q26/q26.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q26/q26.1.adm
index 7fc4a51..95f489b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q26/q26.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q26/q26.1.adm
@@ -1 +1 @@
-{ "i_item_id": "AAAAAAAAKAAAAAAA", "agg1": 7.0, "agg2": 40.88, "agg3": 11.56, "agg4": 51.91 }
\ No newline at end of file
+{ "i_item_id": "AAAAAAAAEAAAAAAA", "agg1": 31.0, "agg2": 51.91, "agg3": 0.0, "agg4": 6.22 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q27/q27.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q27/q27.1.adm
new file mode 100644
index 0000000..fbe8c57
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q27/q27.1.adm
@@ -0,0 +1,13 @@
+{ "i_item_id": null, "s_state": null, "g_state": 1, "agg1": 97.4, "agg2": 14.92, "agg3": 4.6, "agg4": 7.32 }
+{ "i_item_id": "AAAAAAAAABAAAAAA", "s_state": null, "g_state": 1, "agg1": 108.0, "agg2": 5.34, "agg3": 0.0, "agg4": 3.52 }
+{ "i_item_id": "AAAAAAAAABAAAAAA", "s_state": "TN", "g_state": 0, "agg1": 108.0, "agg2": 5.34, "agg3": 0.0, "agg4": 3.52 }
+{ "i_item_id": "AAAAAAAACAAAAAAA", "s_state": null, "g_state": 1, "agg1": 2.0, "agg2": 101.17, "agg3": 46.03, "agg4": 41.47 }
+{ "i_item_id": "AAAAAAAACAAAAAAA", "s_state": "TN", "g_state": 0, "agg1": 2.0, "agg2": 101.17, "agg3": 46.03, "agg4": 41.47 }
+{ "i_item_id": "AAAAAAAADBAAAAAA", "s_state": null, "g_state": 1, "agg1": 108.0, "agg2": 5.34, "agg3": 0.0, "agg4": 3.52 }
+{ "i_item_id": "AAAAAAAADBAAAAAA", "s_state": "TN", "g_state": 0, "agg1": 108.0, "agg2": 5.34, "agg3": 0.0, "agg4": 3.52 }
+{ "i_item_id": "AAAAAAAAEBAAAAAA", "s_state": null, "g_state": 1, "agg1": 108.0, "agg2": 5.34, "agg3": 0.0, "agg4": 3.52 }
+{ "i_item_id": "AAAAAAAAEBAAAAAA", "s_state": "TN", "g_state": 0, "agg1": 108.0, "agg2": 5.34, "agg3": 0.0, "agg4": 3.52 }
+{ "i_item_id": "AAAAAAAAGBAAAAAA", "s_state": null, "g_state": 1, "agg1": 108.0, "agg2": 5.34, "agg3": 0.0, "agg4": 3.52 }
+{ "i_item_id": "AAAAAAAAGBAAAAAA", "s_state": "TN", "g_state": 0, "agg1": 108.0, "agg2": 5.34, "agg3": 0.0, "agg4": 3.52 }
+{ "i_item_id": "AAAAAAAAKAAAAAAA", "s_state": null, "g_state": 1, "agg1": 108.0, "agg2": 5.34, "agg3": 0.0, "agg4": 3.52 }
+{ "i_item_id": "AAAAAAAAKAAAAAAA", "s_state": "TN", "g_state": 0, "agg1": 108.0, "agg2": 5.34, "agg3": 0.0, "agg4": 3.52 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q36/q36.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q36/q36.1.adm
new file mode 100644
index 0000000..80a52f0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q36/q36.1.adm
@@ -0,0 +1,19 @@
+{ "gross_margin": -0.71, "i_category": null, "i_class": null, "lochierarchy": 2, "rank_within_parent": 1 }
+{ "gross_margin": -19.71, "i_category": "Music", "i_class": null, "lochierarchy": 1, "rank_within_parent": 1 }
+{ "gross_margin": -0.56, "i_category": "Women", "i_class": null, "lochierarchy": 1, "rank_within_parent": 2 }
+{ "gross_margin": -0.3, "i_category": "Electronics", "i_class": null, "lochierarchy": 1, "rank_within_parent": 3 }
+{ "gross_margin": -0.3, "i_category": "Jewelry", "i_class": null, "lochierarchy": 1, "rank_within_parent": 3 }
+{ "gross_margin": -0.29, "i_category": "Men", "i_class": null, "lochierarchy": 1, "rank_within_parent": 5 }
+{ "gross_margin": -0.3, "i_category": "Electronics", "i_class": "karoke", "lochierarchy": 0, "rank_within_parent": 1 }
+{ "gross_margin": -0.3, "i_category": "Electronics", "i_class": "scanners", "lochierarchy": 0, "rank_within_parent": 1 }
+{ "gross_margin": -0.3, "i_category": "Jewelry", "i_class": "consignment", "lochierarchy": 0, "rank_within_parent": 1 }
+{ "gross_margin": -33.36, "i_category": "Men", "i_class": "shirts", "lochierarchy": 0, "rank_within_parent": 1 }
+{ "gross_margin": -0.3, "i_category": "Men", "i_class": "accessories", "lochierarchy": 0, "rank_within_parent": 2 }
+{ "gross_margin": -0.3, "i_category": "Men", "i_class": "sports-apparel", "lochierarchy": 0, "rank_within_parent": 2 }
+{ "gross_margin": 0.0, "i_category": "Men", "i_class": "pants", "lochierarchy": 0, "rank_within_parent": 4 }
+{ "gross_margin": -298.29, "i_category": "Music", "i_class": "country", "lochierarchy": 0, "rank_within_parent": 1 }
+{ "gross_margin": -3.53, "i_category": "Music", "i_class": "pop", "lochierarchy": 0, "rank_within_parent": 2 }
+{ "gross_margin": null, "i_category": "Women", "i_class": "swimwear", "lochierarchy": 0, "rank_within_parent": 1 }
+{ "gross_margin": -0.56, "i_category": "Women", "i_class": "dresses", "lochierarchy": 0, "rank_within_parent": 2 }
+{ "gross_margin": -0.3, "i_category": "Women", "i_class": "fragrances", "lochierarchy": 0, "rank_within_parent": 3 }
+{ "gross_margin": -0.3, "i_category": "Women", "i_class": "maternity", "lochierarchy": 0, "rank_within_parent": 3 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q49/q49.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q49/q49.1.adm
index e94c4ac..1959e09 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q49/q49.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q49/q49.1.adm
@@ -1,4 +1,7 @@
-{ "channel": "catalog", "item": 10, "return_ratio": 2.43, "return_rank": 1, "currency_rank": 2 }
-{ "channel": "catalog", "item": 1, "return_ratio": 3.0, "return_rank": 2, "currency_rank": 1 }
-{ "channel": "store", "item": 13, "return_ratio": 9.0, "return_rank": 1, "currency_rank": 1 }
-{ "channel": "web", "item": 25, "return_ratio": 2.67, "return_rank": 1, "currency_rank": 1 }
\ No newline at end of file
+{ "channel": "catalog", "item": 5, "return_ratio": 2.32, "return_rank": 1, "currency_rank": 1 }
+{ "channel": "store", "item": 15, "return_ratio": 0.08, "return_rank": 1, "currency_rank": 2 }
+{ "channel": "store", "item": 5, "return_ratio": 0.3, "return_rank": 2, "currency_rank": 3 }
+{ "channel": "store", "item": 13, "return_ratio": 9.0, "return_rank": 3, "currency_rank": 1 }
+{ "channel": "web", "item": 5, "return_ratio": 0.18, "return_rank": 1, "currency_rank": 1 }
+{ "channel": "web", "item": 25, "return_ratio": 0.35, "return_rank": 2, "currency_rank": 2 }
+{ "channel": "web", "item": 3, "return_ratio": 4.33, "return_rank": 3, "currency_rank": 3 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q57/q57.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q57/q57.1.adm
index e8ef0c1..fccb18d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q57/q57.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q57/q57.1.adm
@@ -1 +1 @@
-{ "i_category": "Home", "i_brand": "brandbrand #4", "cc_name": "NY Metro", "d_year": 2000, "d_moy": 5, "avg_monthly_sales": 108.92, "sum_sales": 108.92, "psum": 84.42, "nsum": 153.03 }
\ No newline at end of file
+{ "i_category": "Women", "i_brand": "amalgamalg #1", "cc_name": "NY Metro", "d_year": 2001, "d_moy": 12, "avg_monthly_sales": 8.81, "sum_sales": 8.81, "psum": 5.51, "nsum": 2.77 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q67/q67.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q67/q67.1.adm
new file mode 100644
index 0000000..2125ebe
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q67/q67.1.adm
@@ -0,0 +1,47 @@
+{ "i_category": null, "i_class": null, "i_brand": null, "i_product_name": null, "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 1, "sumsales": 6144.62 }
+{ "i_category": "Home", "i_class": null, "i_brand": null, "i_product_name": null, "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 1, "sumsales": 699.3 }
+{ "i_category": "Home", "i_class": "decor", "i_brand": null, "i_product_name": null, "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 1, "sumsales": 699.3 }
+{ "i_category": "Home", "i_class": "decor", "i_brand": "brandbrand #4", "i_product_name": null, "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 1, "sumsales": 699.3 }
+{ "i_category": "Home", "i_class": "decor", "i_brand": "brandbrand #4", "i_product_name": "pri", "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 1, "sumsales": 699.3 }
+{ "i_category": "Home", "i_class": "decor", "i_brand": "brandbrand #4", "i_product_name": "pri", "d_year": 1998, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 1, "sumsales": 699.3 }
+{ "i_category": "Home", "i_class": "decor", "i_brand": "brandbrand #4", "i_product_name": "pri", "d_year": 1998, "d_qoy": 1, "d_moy": null, "s_store_id": null, "rk": 1, "sumsales": 699.3 }
+{ "i_category": "Home", "i_class": "decor", "i_brand": "brandbrand #4", "i_product_name": "pri", "d_year": 1998, "d_qoy": 1, "d_moy": 12, "s_store_id": null, "rk": 1, "sumsales": 699.3 }
+{ "i_category": "Home", "i_class": "decor", "i_brand": "brandbrand #4", "i_product_name": "pri", "d_year": 1998, "d_qoy": 1, "d_moy": 12, "s_store_id": "AAAAAAAACAAAAAAA", "rk": 1, "sumsales": 699.3 }
+{ "i_category": "Jewelry", "i_class": null, "i_brand": null, "i_product_name": null, "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 1, "sumsales": 3735.3 }
+{ "i_category": "Jewelry", "i_class": "costume", "i_brand": null, "i_product_name": null, "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 9, "sumsales": 251.94 }
+{ "i_category": "Jewelry", "i_class": "costume", "i_brand": "importobrand #6", "i_product_name": null, "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 9, "sumsales": 251.94 }
+{ "i_category": "Jewelry", "i_class": "costume", "i_brand": "importobrand #6", "i_product_name": "priought", "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 9, "sumsales": 251.94 }
+{ "i_category": "Jewelry", "i_class": "costume", "i_brand": "importobrand #6", "i_product_name": "priought", "d_year": 1998, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 9, "sumsales": 251.94 }
+{ "i_category": "Jewelry", "i_class": "costume", "i_brand": "importobrand #6", "i_product_name": "priought", "d_year": 1998, "d_qoy": 1, "d_moy": null, "s_store_id": null, "rk": 9, "sumsales": 251.94 }
+{ "i_category": "Jewelry", "i_class": "costume", "i_brand": "importobrand #6", "i_product_name": "priought", "d_year": 1998, "d_qoy": 1, "d_moy": 12, "s_store_id": null, "rk": 9, "sumsales": 251.94 }
+{ "i_category": "Jewelry", "i_class": "costume", "i_brand": "importobrand #6", "i_product_name": "priought", "d_year": 1998, "d_qoy": 1, "d_moy": 12, "s_store_id": "AAAAAAAAEAAAAAAA", "rk": 9, "sumsales": 251.94 }
+{ "i_category": "Jewelry", "i_class": "estate", "i_brand": null, "i_product_name": null, "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 2, "sumsales": 3483.36 }
+{ "i_category": "Jewelry", "i_class": "estate", "i_brand": "edu packbrand #4", "i_product_name": null, "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 2, "sumsales": 3483.36 }
+{ "i_category": "Jewelry", "i_class": "estate", "i_brand": "edu packbrand #4", "i_product_name": "oughtought", "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 2, "sumsales": 3483.36 }
+{ "i_category": "Jewelry", "i_class": "estate", "i_brand": "edu packbrand #4", "i_product_name": "oughtought", "d_year": 2001, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 2, "sumsales": 3483.36 }
+{ "i_category": "Jewelry", "i_class": "estate", "i_brand": "edu packbrand #4", "i_product_name": "oughtought", "d_year": 2001, "d_qoy": 1, "d_moy": null, "s_store_id": null, "rk": 2, "sumsales": 3483.36 }
+{ "i_category": "Jewelry", "i_class": "estate", "i_brand": "edu packbrand #4", "i_product_name": "oughtought", "d_year": 2001, "d_qoy": 1, "d_moy": 12, "s_store_id": null, "rk": 2, "sumsales": 3483.36 }
+{ "i_category": "Jewelry", "i_class": "estate", "i_brand": "edu packbrand #4", "i_product_name": "oughtought", "d_year": 2001, "d_qoy": 1, "d_moy": 12, "s_store_id": "AAAAAAAACAAAAAAA", "rk": 2, "sumsales": 3483.36 }
+{ "i_category": "Men", "i_class": null, "i_brand": null, "i_product_name": null, "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 1, "sumsales": 1685.62 }
+{ "i_category": "Men", "i_class": "pants", "i_brand": null, "i_product_name": null, "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 2, "sumsales": 1678.32 }
+{ "i_category": "Men", "i_class": "pants", "i_brand": "exportiimporto #1", "i_product_name": null, "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 2, "sumsales": 1678.32 }
+{ "i_category": "Men", "i_class": "pants", "i_brand": "exportiimporto #1", "i_product_name": "cally", "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 2, "sumsales": 1678.32 }
+{ "i_category": "Men", "i_class": "pants", "i_brand": "exportiimporto #1", "i_product_name": "cally", "d_year": 1999, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 2, "sumsales": 1678.32 }
+{ "i_category": "Men", "i_class": "pants", "i_brand": "exportiimporto #1", "i_product_name": "cally", "d_year": 1999, "d_qoy": 1, "d_moy": null, "s_store_id": null, "rk": 2, "sumsales": 1678.32 }
+{ "i_category": "Men", "i_class": "pants", "i_brand": "exportiimporto #1", "i_product_name": "cally", "d_year": 1999, "d_qoy": 1, "d_moy": 11, "s_store_id": null, "rk": 2, "sumsales": 1678.32 }
+{ "i_category": "Men", "i_class": "pants", "i_brand": "exportiimporto #1", "i_product_name": "cally", "d_year": 1999, "d_qoy": 1, "d_moy": 11, "s_store_id": "AAAAAAAACAAAAAAA", "rk": 2, "sumsales": 1678.32 }
+{ "i_category": "Men", "i_class": "shirts", "i_brand": null, "i_product_name": null, "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 9, "sumsales": 7.3 }
+{ "i_category": "Men", "i_class": "shirts", "i_brand": "importoimporto #2", "i_product_name": null, "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 9, "sumsales": 7.3 }
+{ "i_category": "Men", "i_class": "shirts", "i_brand": "importoimporto #2", "i_product_name": "anti", "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 9, "sumsales": 7.3 }
+{ "i_category": "Men", "i_class": "shirts", "i_brand": "importoimporto #2", "i_product_name": "anti", "d_year": 1999, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 9, "sumsales": 7.3 }
+{ "i_category": "Men", "i_class": "shirts", "i_brand": "importoimporto #2", "i_product_name": "anti", "d_year": 1999, "d_qoy": 1, "d_moy": null, "s_store_id": null, "rk": 9, "sumsales": 7.3 }
+{ "i_category": "Men", "i_class": "shirts", "i_brand": "importoimporto #2", "i_product_name": "anti", "d_year": 1999, "d_qoy": 1, "d_moy": 11, "s_store_id": null, "rk": 9, "sumsales": 7.3 }
+{ "i_category": "Men", "i_class": "shirts", "i_brand": "importoimporto #2", "i_product_name": "anti", "d_year": 1999, "d_qoy": 1, "d_moy": 11, "s_store_id": "AAAAAAAAEAAAAAAA", "rk": 9, "sumsales": 7.3 }
+{ "i_category": "Women", "i_class": null, "i_brand": null, "i_product_name": null, "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 1, "sumsales": 24.4 }
+{ "i_category": "Women", "i_class": "Jewelry", "i_brand": null, "i_product_name": null, "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 1, "sumsales": 24.4 }
+{ "i_category": "Women", "i_class": "Jewelry", "i_brand": "importoexporti #1", "i_product_name": null, "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 1, "sumsales": 24.4 }
+{ "i_category": "Women", "i_class": "Jewelry", "i_brand": "importoexporti #1", "i_product_name": "ese", "d_year": null, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 1, "sumsales": 24.4 }
+{ "i_category": "Women", "i_class": "Jewelry", "i_brand": "importoexporti #1", "i_product_name": "ese", "d_year": 1998, "d_qoy": null, "d_moy": null, "s_store_id": null, "rk": 1, "sumsales": 24.4 }
+{ "i_category": "Women", "i_class": "Jewelry", "i_brand": "importoexporti #1", "i_product_name": "ese", "d_year": 1998, "d_qoy": 1, "d_moy": null, "s_store_id": null, "rk": 1, "sumsales": 24.4 }
+{ "i_category": "Women", "i_class": "Jewelry", "i_brand": "importoexporti #1", "i_product_name": "ese", "d_year": 1998, "d_qoy": 1, "d_moy": 12, "s_store_id": null, "rk": 1, "sumsales": 24.4 }
+{ "i_category": "Women", "i_class": "Jewelry", "i_brand": "importoexporti #1", "i_product_name": "ese", "d_year": 1998, "d_qoy": 1, "d_moy": 12, "s_store_id": "AAAAAAAAEAAAAAAA", "rk": 1, "sumsales": 24.4 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q70/q70.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q70/q70.1.adm
new file mode 100644
index 0000000..edafb00
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q70/q70.1.adm
@@ -0,0 +1,3 @@
+{ "total_sum": -3169.6, "s_state": null, "s_county": null, "lochierarchy": 2, "rank_within_parent": 1 }
+{ "total_sum": -3169.6, "s_state": "TN", "s_county": null, "lochierarchy": 1, "rank_within_parent": 1 }
+{ "total_sum": -3169.6, "s_state": "TN", "s_county": "Williamson County", "lochierarchy": 0, "rank_within_parent": 1 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q77/q77.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q77/q77.1.adm
new file mode 100644
index 0000000..82b1b8e
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q77/q77.1.adm
@@ -0,0 +1,12 @@
+{ "channel": null, "id": null, "sales": 18263.2, "returns": 709.19, "profit": -11830.54 }
+{ "channel": "catalog channel", "id": null, "sales": 7959.47, "returns": null, "profit": null }
+{ "channel": "catalog channel", "id": 1, "sales": 4881.07, "returns": null, "profit": null }
+{ "channel": "catalog channel", "id": 4, "sales": 3078.4, "returns": null, "profit": null }
+{ "channel": "store channel", "id": null, "sales": 3605.88, "returns": 574.79, "profit": -6673.96 }
+{ "channel": "store channel", "id": 1, "sales": 0.0, "returns": 347.42, "profit": -597.66 }
+{ "channel": "store channel", "id": 3, "sales": 3384.68, "returns": 0.0, "profit": -5247.1 }
+{ "channel": "store channel", "id": 5, "sales": 221.2, "returns": 227.37, "profit": -829.2 }
+{ "channel": "web channel", "id": null, "sales": 6697.85, "returns": 134.4, "profit": -5156.58 }
+{ "channel": "web channel", "id": 7, "sales": 2546.73, "returns": 0.0, "profit": -2674.29 }
+{ "channel": "web channel", "id": 8, "sales": 2168.28, "returns": 0.0, "profit": -895.53 }
+{ "channel": "web channel", "id": 10, "sales": 1982.84, "returns": 134.4, "profit": -1586.76 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q80/q80.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q80/q80.1.adm
new file mode 100644
index 0000000..46f9e96
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q80/q80.1.adm
@@ -0,0 +1,13 @@
+{ "channel": null, "id": null, "sales": 62214.72, "returns": 4839.2, "profit": -26998.14 }
+{ "channel": "catalog channel", "id": null, "sales": 34305.02, "returns": 2157.76, "profit": 1953.48 }
+{ "channel": "catalog channel", "id": "catalog_pageAAAAAAAABAAAAAAA", "sales": 20382.0, "returns": 0.0, "profit": 6726.16 }
+{ "channel": "catalog channel", "id": "catalog_pageAAAAAAAAGODAAAAA", "sales": 2799.03, "returns": 2157.76, "profit": -5865.59 }
+{ "channel": "catalog channel", "id": "catalog_pageAAAAAAAAHGFBAAAA", "sales": 6573.16, "returns": 0.0, "profit": -680.23 }
+{ "channel": "catalog channel", "id": "catalog_pageAAAAAAAAKKPAAAAA", "sales": 1362.3, "returns": 0.0, "profit": 337.82 }
+{ "channel": "catalog channel", "id": "catalog_pageAAAAAAAAPNHAAAAA", "sales": 3188.53, "returns": 0.0, "profit": 1435.32 }
+{ "channel": "store channel", "id": null, "sales": 25741.42, "returns": 2681.44, "profit": -28056.09 }
+{ "channel": "store channel", "id": "storeAAAAAAAABAAAAAAA", "sales": 14371.21, "returns": 37.23, "profit": -10319.54 }
+{ "channel": "store channel", "id": "storeAAAAAAAACAAAAAAA", "sales": 8398.66, "returns": 2416.84, "profit": -15384.3 }
+{ "channel": "store channel", "id": "storeAAAAAAAAEAAAAAAA", "sales": 2971.55, "returns": 227.37, "profit": -2352.25 }
+{ "channel": "web channel", "id": null, "sales": 2168.28, "returns": 0.0, "profit": -895.53 }
+{ "channel": "web channel", "id": "web_siteAAAAAAAAEAAAAAAA", "sales": 2168.28, "returns": 0.0, "profit": -895.53 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q86/q86.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q86/q86.1.adm
new file mode 100644
index 0000000..2811d77
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/tpcds/q86/q86.1.adm
@@ -0,0 +1,10 @@
+{ "total_sum": 6620.01, "i_category": null, "i_class": null, "lochierarchy": 2, "rank_within_parent": 1 }
+{ "total_sum": 2650.56, "i_category": "Books", "i_class": null, "lochierarchy": 1, "rank_within_parent": 1 }
+{ "total_sum": 2568.02, "i_category": "Electronics", "i_class": null, "lochierarchy": 1, "rank_within_parent": 2 }
+{ "total_sum": 1219.57, "i_category": "Children", "i_class": null, "lochierarchy": 1, "rank_within_parent": 3 }
+{ "total_sum": 181.86, "i_category": "Home", "i_class": null, "lochierarchy": 1, "rank_within_parent": 4 }
+{ "total_sum": 2650.56, "i_category": "Books", "i_class": "history", "lochierarchy": 0, "rank_within_parent": 1 }
+{ "total_sum": 1219.57, "i_category": "Children", "i_class": "newborn", "lochierarchy": 0, "rank_within_parent": 1 }
+{ "total_sum": 2180.16, "i_category": "Electronics", "i_class": "musical", "lochierarchy": 0, "rank_within_parent": 1 }
+{ "total_sum": 387.86, "i_category": "Electronics", "i_class": "karoke", "lochierarchy": 0, "rank_within_parent": 2 }
+{ "total_sum": 181.86, "i_category": "Home", "i_class": "decor", "lochierarchy": 0, "rank_within_parent": 1 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/group-by/grouping-sets-1/grouping-sets-1.16.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/group-by/grouping-sets-1/grouping-sets-1.16.ast
new file mode 100644
index 0000000..7c286b7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/group-by/grouping-sets-1/grouping-sets-1.16.ast
@@ -0,0 +1,156 @@
+DataverseUse test
+Query:
+SELECT ELEMENT [
+Variable [ Name=#1 ]
+]
+FROM [ (
+ SELECT [
+ Variable [ Name=$two ]
+ two
+ Variable [ Name=$four ]
+ four
+ FunctionCall asterix.sql-sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=$gi ]
+ Field=tenk
+ ]
+ Field=ten
+ ]
+ ]
+ FROM [ Variable [ Name=$g ]
+ AS Variable [ Name=$gi ]
+ ]
+ )
+ ]
+ agg_sum
+ ]
+ FROM [ FunctionCall asterix.dataset@1[
+ LiteralExpr [STRING] [test.tenk]
+ ]
+ AS Variable [ Name=$tenk ]
+ ]
+ Groupby
+ Variable [ Name=$two ]
+ :=
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=two
+ ]
+ Variable [ Name=$four ]
+ :=
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=four
+ ]
+ GROUP AS Variable [ Name=$g ]
+ (
+ tenk:=Variable [ Name=$tenk ]
+ )
+
+ UNION
+ SELECT [
+ Variable [ Name=$two ]
+ two
+ Variable [ Name=$four ]
+ four
+ FunctionCall asterix.sql-sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=$gi ]
+ Field=tenk
+ ]
+ Field=ten
+ ]
+ ]
+ FROM [ Variable [ Name=$g ]
+ AS Variable [ Name=$gi ]
+ ]
+ )
+ ]
+ agg_sum
+ ]
+ FROM [ FunctionCall asterix.dataset@1[
+ LiteralExpr [STRING] [test.tenk]
+ ]
+ AS Variable [ Name=$tenk ]
+ ]
+ Groupby
+ Variable [ Name=$two ]
+ :=
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=two
+ ]
+ DECOR
+ Variable [ Name=$four ]
+ :=
+ LiteralExpr [NULL]
+ GROUP AS Variable [ Name=$g ]
+ (
+ tenk:=Variable [ Name=$tenk ]
+ )
+
+ UNION
+ SELECT [
+ Variable [ Name=$two ]
+ two
+ Variable [ Name=$four ]
+ four
+ FunctionCall asterix.sql-sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=$gi ]
+ Field=tenk
+ ]
+ Field=ten
+ ]
+ ]
+ FROM [ Variable [ Name=$g ]
+ AS Variable [ Name=$gi ]
+ ]
+ )
+ ]
+ agg_sum
+ ]
+ FROM [ FunctionCall asterix.dataset@1[
+ LiteralExpr [STRING] [test.tenk]
+ ]
+ AS Variable [ Name=$tenk ]
+ ]
+ Groupby
+ GROUPING SET (
+ )
+ DECOR
+ Variable [ Name=$two ]
+ :=
+ LiteralExpr [NULL]
+ Variable [ Name=$four ]
+ :=
+ LiteralExpr [NULL]
+ GROUP AS Variable [ Name=$g ]
+ (
+ tenk:=Variable [ Name=$tenk ]
+ )
+
+ )
+ AS Variable [ Name=#1 ]
+]
+Orderby
+ FieldAccessor [
+ Variable [ Name=#1 ]
+ Field=two
+ ]
+ ASC
+ FieldAccessor [
+ Variable [ Name=#1 ]
+ Field=four
+ ]
+ ASC
+
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/group-by/grouping-sets-1/grouping-sets-1.17.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/group-by/grouping-sets-1/grouping-sets-1.17.ast
new file mode 100644
index 0000000..8f1f1de
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/group-by/grouping-sets-1/grouping-sets-1.17.ast
@@ -0,0 +1,342 @@
+DataverseUse test
+Query:
+SELECT ELEMENT [
+Variable [ Name=#1 ]
+]
+FROM [ (
+ SELECT [
+ Variable [ Name=$two ]
+ two
+ Variable [ Name=$four ]
+ four
+ FunctionCall asterix.sql-sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=#2 ]
+ Field=x
+ ]
+ Field=ten
+ ]
+ ]
+ FROM [ Variable [ Name=$g ]
+ AS Variable [ Name=#2 ]
+ ]
+ )
+ ]
+ agg_sum
+ ]
+ FROM [ (
+ SELECT [
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=two
+ ]
+ two
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=four
+ ]
+ four
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=ten
+ ]
+ ten
+ ]
+ FROM [ FunctionCall asterix.dataset@1[
+ LiteralExpr [STRING] [test.tenk]
+ ]
+ AS Variable [ Name=$tenk ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=hundred
+ ]
+ <
+ LiteralExpr [LONG] [20]
+ ]
+ UNION
+ SELECT [
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=two
+ ]
+ two
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=four
+ ]
+ four
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=ten
+ ]
+ ten
+ ]
+ FROM [ FunctionCall asterix.dataset@1[
+ LiteralExpr [STRING] [test.tenk]
+ ]
+ AS Variable [ Name=$tenk ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=hundred
+ ]
+ >=
+ LiteralExpr [LONG] [80]
+ ]
+ )
+ AS Variable [ Name=$x ]
+ ]
+ Groupby
+ Variable [ Name=$two ]
+ :=
+ FieldAccessor [
+ Variable [ Name=$x ]
+ Field=two
+ ]
+ Variable [ Name=$four ]
+ :=
+ FieldAccessor [
+ Variable [ Name=$x ]
+ Field=four
+ ]
+ GROUP AS Variable [ Name=$g ]
+ (
+ x:=Variable [ Name=$x ]
+ )
+
+ UNION
+ SELECT [
+ Variable [ Name=$two ]
+ two
+ Variable [ Name=$four ]
+ four
+ FunctionCall asterix.sql-sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=#3 ]
+ Field=x
+ ]
+ Field=ten
+ ]
+ ]
+ FROM [ Variable [ Name=$g ]
+ AS Variable [ Name=#3 ]
+ ]
+ )
+ ]
+ agg_sum
+ ]
+ FROM [ (
+ SELECT [
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=two
+ ]
+ two
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=four
+ ]
+ four
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=ten
+ ]
+ ten
+ ]
+ FROM [ FunctionCall asterix.dataset@1[
+ LiteralExpr [STRING] [test.tenk]
+ ]
+ AS Variable [ Name=$tenk ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=hundred
+ ]
+ <
+ LiteralExpr [LONG] [20]
+ ]
+ UNION
+ SELECT [
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=two
+ ]
+ two
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=four
+ ]
+ four
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=ten
+ ]
+ ten
+ ]
+ FROM [ FunctionCall asterix.dataset@1[
+ LiteralExpr [STRING] [test.tenk]
+ ]
+ AS Variable [ Name=$tenk ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=hundred
+ ]
+ >=
+ LiteralExpr [LONG] [80]
+ ]
+ )
+ AS Variable [ Name=$x ]
+ ]
+ Groupby
+ Variable [ Name=$two ]
+ :=
+ FieldAccessor [
+ Variable [ Name=$x ]
+ Field=two
+ ]
+ DECOR
+ Variable [ Name=$four ]
+ :=
+ LiteralExpr [NULL]
+ GROUP AS Variable [ Name=$g ]
+ (
+ x:=Variable [ Name=$x ]
+ )
+
+ UNION
+ SELECT [
+ Variable [ Name=$two ]
+ two
+ Variable [ Name=$four ]
+ four
+ FunctionCall asterix.sql-sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=#4 ]
+ Field=x
+ ]
+ Field=ten
+ ]
+ ]
+ FROM [ Variable [ Name=$g ]
+ AS Variable [ Name=#4 ]
+ ]
+ )
+ ]
+ agg_sum
+ ]
+ FROM [ (
+ SELECT [
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=two
+ ]
+ two
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=four
+ ]
+ four
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=ten
+ ]
+ ten
+ ]
+ FROM [ FunctionCall asterix.dataset@1[
+ LiteralExpr [STRING] [test.tenk]
+ ]
+ AS Variable [ Name=$tenk ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=hundred
+ ]
+ <
+ LiteralExpr [LONG] [20]
+ ]
+ UNION
+ SELECT [
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=two
+ ]
+ two
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=four
+ ]
+ four
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=ten
+ ]
+ ten
+ ]
+ FROM [ FunctionCall asterix.dataset@1[
+ LiteralExpr [STRING] [test.tenk]
+ ]
+ AS Variable [ Name=$tenk ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=hundred
+ ]
+ >=
+ LiteralExpr [LONG] [80]
+ ]
+ )
+ AS Variable [ Name=$x ]
+ ]
+ Groupby
+ GROUPING SET (
+ )
+ DECOR
+ Variable [ Name=$two ]
+ :=
+ LiteralExpr [NULL]
+ Variable [ Name=$four ]
+ :=
+ LiteralExpr [NULL]
+ GROUP AS Variable [ Name=$g ]
+ (
+ x:=Variable [ Name=$x ]
+ )
+
+ )
+ AS Variable [ Name=#1 ]
+]
+Orderby
+ FieldAccessor [
+ Variable [ Name=#1 ]
+ Field=two
+ ]
+ ASC
+ FieldAccessor [
+ Variable [ Name=#1 ]
+ Field=four
+ ]
+ ASC
+
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/group-by/grouping-sets-1/grouping-sets-1.18.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/group-by/grouping-sets-1/grouping-sets-1.18.ast
new file mode 100644
index 0000000..26adc91
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/group-by/grouping-sets-1/grouping-sets-1.18.ast
@@ -0,0 +1,193 @@
+DataverseUse test
+Query:
+SELECT ELEMENT [
+Variable [ Name=#5 ]
+]
+FROM [ (
+ SELECT [
+ Variable [ Name=$two ]
+ two
+ Variable [ Name=#1 ]
+ two_plus_four
+ Variable [ Name=#3 ]
+ grp_two
+ Variable [ Name=#4 ]
+ grp_two_plus_four
+ FunctionCall asterix.sql-sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=#6 ]
+ Field=tenk
+ ]
+ Field=ten
+ ]
+ ]
+ FROM [ Variable [ Name=#2 ]
+ AS Variable [ Name=#6 ]
+ ]
+ )
+ ]
+ agg_sum
+ ]
+ FROM [ FunctionCall asterix.dataset@1[
+ LiteralExpr [STRING] [test.tenk]
+ ]
+ AS Variable [ Name=$tenk ]
+ ]
+ Groupby
+ Variable [ Name=$two ]
+ :=
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=two
+ ]
+ Variable [ Name=#1 ]
+ :=
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=two
+ ]
+ +
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=four
+ ]
+ ]
+ GROUP AS Variable [ Name=#2 ]
+ (
+ tenk:=Variable [ Name=$tenk ]
+ )
+
+ Let Variable [ Name=#3 ]
+ :=
+ LiteralExpr [LONG] [0]
+ Let Variable [ Name=#4 ]
+ :=
+ LiteralExpr [LONG] [0]
+ UNION
+ SELECT [
+ Variable [ Name=$two ]
+ two
+ Variable [ Name=#1 ]
+ two_plus_four
+ Variable [ Name=#3 ]
+ grp_two
+ Variable [ Name=#4 ]
+ grp_two_plus_four
+ FunctionCall asterix.sql-sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=#7 ]
+ Field=tenk
+ ]
+ Field=ten
+ ]
+ ]
+ FROM [ Variable [ Name=#2 ]
+ AS Variable [ Name=#7 ]
+ ]
+ )
+ ]
+ agg_sum
+ ]
+ FROM [ FunctionCall asterix.dataset@1[
+ LiteralExpr [STRING] [test.tenk]
+ ]
+ AS Variable [ Name=$tenk ]
+ ]
+ Groupby
+ Variable [ Name=$two ]
+ :=
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=two
+ ]
+ DECOR
+ Variable [ Name=#1 ]
+ :=
+ LiteralExpr [NULL]
+ GROUP AS Variable [ Name=#2 ]
+ (
+ tenk:=Variable [ Name=$tenk ]
+ )
+
+ Let Variable [ Name=#3 ]
+ :=
+ LiteralExpr [LONG] [0]
+ Let Variable [ Name=#4 ]
+ :=
+ LiteralExpr [LONG] [1]
+ UNION
+ SELECT [
+ Variable [ Name=$two ]
+ two
+ Variable [ Name=#1 ]
+ two_plus_four
+ Variable [ Name=#3 ]
+ grp_two
+ Variable [ Name=#4 ]
+ grp_two_plus_four
+ FunctionCall asterix.sql-sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=#8 ]
+ Field=tenk
+ ]
+ Field=ten
+ ]
+ ]
+ FROM [ Variable [ Name=#2 ]
+ AS Variable [ Name=#8 ]
+ ]
+ )
+ ]
+ agg_sum
+ ]
+ FROM [ FunctionCall asterix.dataset@1[
+ LiteralExpr [STRING] [test.tenk]
+ ]
+ AS Variable [ Name=$tenk ]
+ ]
+ Groupby
+ GROUPING SET (
+ )
+ DECOR
+ Variable [ Name=$two ]
+ :=
+ LiteralExpr [NULL]
+ Variable [ Name=#1 ]
+ :=
+ LiteralExpr [NULL]
+ GROUP AS Variable [ Name=#2 ]
+ (
+ tenk:=Variable [ Name=$tenk ]
+ )
+
+ Let Variable [ Name=#3 ]
+ :=
+ LiteralExpr [LONG] [1]
+ Let Variable [ Name=#4 ]
+ :=
+ LiteralExpr [LONG] [1]
+ )
+ AS Variable [ Name=#5 ]
+]
+Orderby
+ FieldAccessor [
+ Variable [ Name=#5 ]
+ Field=two
+ ]
+ ASC
+ FieldAccessor [
+ Variable [ Name=#5 ]
+ Field=two_plus_four
+ ]
+ ASC
+
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/group-by/grouping-sets-1/grouping-sets-1.19.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/group-by/grouping-sets-1/grouping-sets-1.19.ast
new file mode 100644
index 0000000..8112b6f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/group-by/grouping-sets-1/grouping-sets-1.19.ast
@@ -0,0 +1,208 @@
+DataverseUse test
+Query:
+Let Variable [ Name=$total_sum ]
+ :=
+ IndexAccessor [
+ (
+ SELECT ELEMENT [
+ FunctionCall asterix.sql-sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=#4 ]
+ Field=tenk
+ ]
+ Field=ten
+ ]
+ ]
+ FROM [ Variable [ Name=#1 ]
+ AS Variable [ Name=#4 ]
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall asterix.dataset@1[
+ LiteralExpr [STRING] [test.tenk]
+ ]
+ AS Variable [ Name=$tenk ]
+ ]
+ Group All
+ GROUP AS Variable [ Name=#1 ]
+ (
+ tenk:=Variable [ Name=$tenk ]
+ )
+
+ )
+ Index: LiteralExpr [LONG] [0]
+ ]
+SELECT ELEMENT [
+Variable [ Name=#3 ]
+]
+FROM [ (
+ SELECT [
+ Variable [ Name=$two ]
+ two
+ Variable [ Name=$four ]
+ four
+ FunctionCall asterix.sql-sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=#5 ]
+ Field=tenk
+ ]
+ Field=ten
+ ]
+ ]
+ FROM [ Variable [ Name=#2 ]
+ AS Variable [ Name=#5 ]
+ ]
+ )
+ ]
+ agg_sum
+ Variable [ Name=$total_sum ]
+ total_sum
+ ]
+ FROM [ FunctionCall asterix.dataset@1[
+ LiteralExpr [STRING] [test.tenk]
+ ]
+ AS Variable [ Name=$tenk ]
+ ]
+ Groupby
+ Variable [ Name=$two ]
+ :=
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=two
+ ]
+ Variable [ Name=$four ]
+ :=
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=four
+ ]
+ DECOR
+ Variable [ Name=$total_sum ]
+ :=
+ Variable [ Name=$total_sum ]
+ GROUP AS Variable [ Name=#2 ]
+ (
+ tenk:=Variable [ Name=$tenk ]
+ )
+
+ UNION
+ SELECT [
+ Variable [ Name=$two ]
+ two
+ Variable [ Name=$four ]
+ four
+ FunctionCall asterix.sql-sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=#6 ]
+ Field=tenk
+ ]
+ Field=ten
+ ]
+ ]
+ FROM [ Variable [ Name=#2 ]
+ AS Variable [ Name=#6 ]
+ ]
+ )
+ ]
+ agg_sum
+ Variable [ Name=$total_sum ]
+ total_sum
+ ]
+ FROM [ FunctionCall asterix.dataset@1[
+ LiteralExpr [STRING] [test.tenk]
+ ]
+ AS Variable [ Name=$tenk ]
+ ]
+ Groupby
+ Variable [ Name=$two ]
+ :=
+ FieldAccessor [
+ Variable [ Name=$tenk ]
+ Field=two
+ ]
+ DECOR
+ Variable [ Name=$four ]
+ :=
+ LiteralExpr [NULL]
+ Variable [ Name=$total_sum ]
+ :=
+ Variable [ Name=$total_sum ]
+ GROUP AS Variable [ Name=#2 ]
+ (
+ tenk:=Variable [ Name=$tenk ]
+ )
+
+ UNION
+ SELECT [
+ Variable [ Name=$two ]
+ two
+ Variable [ Name=$four ]
+ four
+ FunctionCall asterix.sql-sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=#7 ]
+ Field=tenk
+ ]
+ Field=ten
+ ]
+ ]
+ FROM [ Variable [ Name=#2 ]
+ AS Variable [ Name=#7 ]
+ ]
+ )
+ ]
+ agg_sum
+ Variable [ Name=$total_sum ]
+ total_sum
+ ]
+ FROM [ FunctionCall asterix.dataset@1[
+ LiteralExpr [STRING] [test.tenk]
+ ]
+ AS Variable [ Name=$tenk ]
+ ]
+ Groupby
+ GROUPING SET (
+ )
+ DECOR
+ Variable [ Name=$two ]
+ :=
+ LiteralExpr [NULL]
+ Variable [ Name=$four ]
+ :=
+ LiteralExpr [NULL]
+ Variable [ Name=$total_sum ]
+ :=
+ Variable [ Name=$total_sum ]
+ GROUP AS Variable [ Name=#2 ]
+ (
+ tenk:=Variable [ Name=$tenk ]
+ )
+
+ )
+ AS Variable [ Name=#3 ]
+]
+Orderby
+ FieldAccessor [
+ Variable [ Name=#3 ]
+ Field=two
+ ]
+ ASC
+ FieldAccessor [
+ Variable [ Name=#3 ]
+ Field=four
+ ]
+ ASC
+
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
index 86e3c17..e224a60 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
@@ -1,4 +1,5 @@
DataverseUse test
+Set compiler.internal.sanitycheck=false
Query:
SELECT ELEMENT [
RecordConstructor [
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
index 5abf3e3..f2162b0 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
@@ -1,4 +1,5 @@
DataverseUse test
+Set compiler.internal.sanitycheck=false
Query:
SELECT ELEMENT [
RecordConstructor [
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
index e0496a1..c55d33e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
@@ -1,4 +1,5 @@
DataverseUse test
+Set compiler.internal.sanitycheck=false
Query:
SELECT ELEMENT [
RecordConstructor [
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
index d4bad51..f0d7535 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
@@ -1,4 +1,5 @@
DataverseUse test
+Set compiler.internal.sanitycheck=false
Query:
SELECT ELEMENT [
RecordConstructor [
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_external_dataset_s3.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_external_dataset_s3.xml
index e0a28ba..6557230 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_external_dataset_s3.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_external_dataset_s3.xml
@@ -143,6 +143,11 @@
<expected-warn>The provided external dataset configuration returned no files from the external source</expected-warn>
</compilation-unit>
</test-case>
+ <test-case FilePath="external-dataset/s3">
+ <compilation-unit name="non-s3-region">
+ <output-dir compare="Text">non-s3-region</output-dir>
+ </compilation-unit>
+ </test-case>
<test-case FilePath="external-dataset/common">
<compilation-unit name="query-with-limit-plan">
<placeholder name="adapter" value="S3" />
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 7cb5180..82f9f77 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -10590,6 +10590,11 @@
</compilation-unit>
</test-case>
<test-case FilePath="tpcds">
+ <compilation-unit name="q05">
+ <output-dir compare="Text">q05</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="tpcds">
<compilation-unit name="q07">
<output-dir compare="Text">q07</output-dir>
</compilation-unit>
@@ -10610,6 +10615,11 @@
</compilation-unit>
</test-case>
<test-case FilePath="tpcds">
+ <compilation-unit name="q18">
+ <output-dir compare="Text">q18</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="tpcds">
<compilation-unit name="q19">
<output-dir compare="Text">q19</output-dir>
</compilation-unit>
@@ -10625,6 +10635,11 @@
</compilation-unit>
</test-case>
<test-case FilePath="tpcds">
+ <compilation-unit name="q22">
+ <output-dir compare="Text">q22</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="tpcds">
<compilation-unit name="q24a">
<output-dir compare="Text">q24a</output-dir>
</compilation-unit>
@@ -10645,6 +10660,11 @@
</compilation-unit>
</test-case>
<test-case FilePath="tpcds">
+ <compilation-unit name="q27">
+ <output-dir compare="Text">q27</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="tpcds">
<compilation-unit name="q29">
<output-dir compare="Text">q29</output-dir>
</compilation-unit>
@@ -10665,6 +10685,11 @@
</compilation-unit>
</test-case>
<test-case FilePath="tpcds">
+ <compilation-unit name="q36">
+ <output-dir compare="Text">q36</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="tpcds">
<compilation-unit name="q37">
<output-dir compare="Text">q37</output-dir>
</compilation-unit>
@@ -10735,21 +10760,41 @@
</compilation-unit>
</test-case>
<test-case FilePath="tpcds">
+ <compilation-unit name="q67">
+ <output-dir compare="Text">q67</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="tpcds">
<compilation-unit name="q68">
<output-dir compare="Text">q68</output-dir>
</compilation-unit>
</test-case>
<test-case FilePath="tpcds">
+ <compilation-unit name="q70">
+ <output-dir compare="Text">q70</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="tpcds">
<compilation-unit name="q73">
<output-dir compare="Text">q73</output-dir>
</compilation-unit>
</test-case>
<test-case FilePath="tpcds">
+ <compilation-unit name="q77">
+ <output-dir compare="Text">q77</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="tpcds">
<compilation-unit name="q79">
<output-dir compare="Text">q79</output-dir>
</compilation-unit>
</test-case>
<test-case FilePath="tpcds">
+ <compilation-unit name="q80">
+ <output-dir compare="Text">q80</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="tpcds">
<compilation-unit name="q81">
<output-dir compare="Text">q81</output-dir>
</compilation-unit>
@@ -10765,6 +10810,11 @@
</compilation-unit>
</test-case>
<test-case FilePath="tpcds">
+ <compilation-unit name="q86">
+ <output-dir compare="Text">q86</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="tpcds">
<compilation-unit name="q88">
<output-dir compare="Text">q88</output-dir>
</compilation-unit>
diff --git a/asterixdb/asterix-common/pom.xml b/asterixdb/asterix-common/pom.xml
index 9c7a7fe..2d8bec2 100644
--- a/asterixdb/asterix-common/pom.xml
+++ b/asterixdb/asterix-common/pom.xml
@@ -38,114 +38,6 @@
<build>
<plugins>
<plugin>
- <groupId>org.jvnet.jaxb2.maven2</groupId>
- <artifactId>maven-jaxb2-plugin</artifactId>
- <executions>
- <execution>
- <id>configuration</id>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <args>
- <arg>-Xsetters</arg>
- <arg>-Xvalue-constructor</arg>
- </args>
- <plugins>
- <plugin>
- <groupId>org.jvnet.jaxb2_commons</groupId>
- <artifactId>jaxb2-basics</artifactId>
- <version>0.6.2</version>
- </plugin>
- <plugin>
- <groupId>org.jvnet.jaxb2_commons</groupId>
- <artifactId>jaxb2-value-constructor</artifactId>
- <version>3.0</version>
- </plugin>
- </plugins>
- <schemaDirectory>src/main/resources/schema</schemaDirectory>
- <schemaIncludes>
- <include>asterix-conf.xsd</include>
- </schemaIncludes>
- <generatePackage>org.apache.asterix.common.configuration</generatePackage>
- <bindingDirectory>src/main/resources/schema</bindingDirectory>
- <bindingIncludes>
- <bindingInclude>jaxb-bindings.xjb</bindingInclude>
- </bindingIncludes>
- <generateDirectory>${project.build.directory}/generated-sources/configuration</generateDirectory>
- </configuration>
- </execution>
- <execution>
- <id>cluster</id>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <args>
- <arg>-Xsetters</arg>
- <arg>-Xvalue-constructor</arg>
- </args>
- <plugins>
- <plugin>
- <groupId>org.jvnet.jaxb2_commons</groupId>
- <artifactId>jaxb2-basics</artifactId>
- <version>0.6.2</version>
- </plugin>
- <plugin>
- <groupId>org.jvnet.jaxb2_commons</groupId>
- <artifactId>jaxb2-value-constructor</artifactId>
- <version>3.0</version>
- </plugin>
- </plugins>
- <schemaDirectory>src/main/resources/schema</schemaDirectory>
- <schemaIncludes>
- <include>cluster.xsd</include>
- </schemaIncludes>
- <generatePackage>org.apache.asterix.event.schema.cluster</generatePackage>
- <generateDirectory>${project.build.directory}/generated-sources/cluster</generateDirectory>
- <bindingDirectory>src/main/resources/schema</bindingDirectory>
- <bindingIncludes>
- <bindingInclude>jaxb-bindings.xjb</bindingInclude>
- </bindingIncludes>
- </configuration>
- </execution>
- <execution>
- <id>yarn_cluster</id>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <args>
- <arg>-Xsetters</arg>
- <arg>-Xvalue-constructor</arg>
- </args>
- <plugins>
- <plugin>
- <groupId>org.jvnet.jaxb2_commons</groupId>
- <artifactId>jaxb2-basics</artifactId>
- <version>0.6.2</version>
- </plugin>
- <plugin>
- <groupId>org.jvnet.jaxb2_commons</groupId>
- <artifactId>jaxb2-value-constructor</artifactId>
- <version>3.0</version>
- </plugin>
- </plugins>
- <schemaDirectory>src/main/resources/schema</schemaDirectory>
- <schemaIncludes>
- <include>yarn_cluster.xsd</include>
- </schemaIncludes>
- <generatePackage>org.apache.asterix.event.schema.yarnCluster</generatePackage>
- <generateDirectory>${project.build.directory}/generated-sources/yarn_cluster</generateDirectory>
- <bindingDirectory>src/main/resources/schema</bindingDirectory>
- <bindingIncludes>
- <bindingInclude>jaxb-bindings.xjb</bindingInclude>
- </bindingIncludes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/CompilerProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/CompilerProperties.java
index 9340110..39142e5 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/CompilerProperties.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/CompilerProperties.java
@@ -91,7 +91,11 @@
COMPILER_SUBPLAN_NESTEDPUSHDOWN(
BOOLEAN,
AlgebricksConfig.SUBPLAN_NESTEDPUSHDOWN_DEFAULT,
- "When merging subplans into groupby/suplan allow nesting of subplans");
+ "When merging subplans into groupby/suplan allow nesting of subplans"),
+ COMPILER_MIN_MEMORY_ALLOCATION(
+ BOOLEAN,
+ AlgebricksConfig.MIN_MEMORY_ALLOCATION_DEFAULT,
+ "Enable/disable allocating minimum budget for certain queries");
private final IOptionType type;
private final Object defaultValue;
@@ -150,6 +154,8 @@
public static final String COMPILER_SUBPLAN_NESTEDPUSHDOWN_KEY = Option.COMPILER_SUBPLAN_NESTEDPUSHDOWN.ini();
+ public static final String COMPILER_MIN_MEMORY_ALLOCATION_KEY = Option.COMPILER_MIN_MEMORY_ALLOCATION.ini();
+
public static final int COMPILER_PARALLELISM_AS_STORAGE = 0;
public CompilerProperties(PropertiesAccessor accessor) {
@@ -211,4 +217,8 @@
public boolean getSubplanNestedPushdown() {
return accessor.getBoolean(Option.COMPILER_SUBPLAN_NESTEDPUSHDOWN);
}
+
+ public boolean getMinMemoryAllocation() {
+ return accessor.getBoolean(Option.COMPILER_MIN_MEMORY_ALLOCATION);
+ }
}
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java
index c415437..9bef65d 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java
@@ -21,6 +21,7 @@
import static org.apache.hyracks.control.common.config.OptionTypes.LEVEL;
import static org.apache.hyracks.control.common.config.OptionTypes.NONNEGATIVE_INTEGER;
import static org.apache.hyracks.control.common.config.OptionTypes.POSITIVE_INTEGER;
+import static org.apache.hyracks.control.common.config.OptionTypes.POSITIVE_INTEGER_BYTE_UNIT;
import static org.apache.hyracks.control.common.config.OptionTypes.STRING;
import org.apache.hyracks.api.config.IOption;
@@ -46,7 +47,7 @@
CC_JAVA_OPTS(STRING, "-Xmx1024m", "The JVM options passed to the cluster controller process by managix"),
NC_JAVA_OPTS(STRING, "-Xmx1024m", "The JVM options passed to the node controller process(es) by managix"),
MAX_WEB_REQUEST_SIZE(
- NONNEGATIVE_INTEGER,
+ POSITIVE_INTEGER_BYTE_UNIT,
StorageUtil.getIntSizeInBytes(200, StorageUtil.StorageUnit.MEGABYTE),
"The maximum accepted web request size in bytes"),
REQUESTS_ARCHIVE_SIZE(NONNEGATIVE_INTEGER, 50, "The maximum number of archived requests to maintain");
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/OptimizationConfUtil.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/OptimizationConfUtil.java
index 5079b25..8832054 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/OptimizationConfUtil.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/OptimizationConfUtil.java
@@ -70,6 +70,8 @@
compilerProperties.getSubplanMerge());
boolean subplanNestedPushdown = getBoolean(querySpecificConfig,
CompilerProperties.COMPILER_SUBPLAN_NESTEDPUSHDOWN_KEY, compilerProperties.getSubplanNestedPushdown());
+ boolean minMemoryAllocation = getBoolean(querySpecificConfig,
+ CompilerProperties.COMPILER_MIN_MEMORY_ALLOCATION_KEY, compilerProperties.getMinMemoryAllocation());
PhysicalOptimizationConfig physOptConf = new PhysicalOptimizationConfig();
physOptConf.setFrameSize(frameSize);
@@ -85,6 +87,7 @@
physOptConf.setExternalFieldPushdown(externalFieldPushdown);
physOptConf.setSubplanMerge(subplanMerge);
physOptConf.setSubplanNestedPushdown(subplanNestedPushdown);
+ physOptConf.setMinMemoryAllocation(minMemoryAllocation);
return physOptConf;
}
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/INcLifecycleCoordinator.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/INcLifecycleCoordinator.java
index 1a7c3c8..9a3b125 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/INcLifecycleCoordinator.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/INcLifecycleCoordinator.java
@@ -18,6 +18,8 @@
*/
package org.apache.asterix.common.replication;
+import java.net.InetSocketAddress;
+
import org.apache.asterix.common.cluster.IClusterStateManager;
import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -35,9 +37,10 @@
* Defines the logic of a {@link INcLifecycleCoordinator} when a node leaves the cluster.
*
* @param nodeId
+ * @param replicaAddress
* @throws HyracksDataException
*/
- void notifyNodeFailure(String nodeId) throws HyracksDataException;
+ void notifyNodeFailure(String nodeId, InetSocketAddress replicaAddress) throws HyracksDataException;
/**
* Binds the coordinator to {@code cluserManager}.
diff --git a/asterixdb/asterix-external-data/pom.xml b/asterixdb/asterix-external-data/pom.xml
index a3daba8..9676da6 100644
--- a/asterixdb/asterix-external-data/pom.xml
+++ b/asterixdb/asterix-external-data/pom.xml
@@ -442,6 +442,10 @@
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
+ <artifactId>aws-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>software.amazon.awssdk</groupId>
<artifactId>http-client-spi</artifactId>
</dependency>
<dependency>
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/AwsS3InputStreamFactory.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/AwsS3InputStreamFactory.java
index 08f8dec..9f0f05c 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/AwsS3InputStreamFactory.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/AwsS3InputStreamFactory.java
@@ -43,8 +43,11 @@
import software.amazon.awssdk.core.exception.SdkException;
import software.amazon.awssdk.services.s3.S3Client;
+import software.amazon.awssdk.services.s3.model.ListObjectsRequest;
+import software.amazon.awssdk.services.s3.model.ListObjectsResponse;
import software.amazon.awssdk.services.s3.model.ListObjectsV2Request;
import software.amazon.awssdk.services.s3.model.ListObjectsV2Response;
+import software.amazon.awssdk.services.s3.model.S3Exception;
import software.amazon.awssdk.services.s3.model.S3Object;
public class AwsS3InputStreamFactory extends AbstractExternalInputStreamFactory {
@@ -62,44 +65,28 @@
this.configuration = configuration;
ICcApplicationContext ccApplicationContext = (ICcApplicationContext) ctx.getApplicationContext();
- String container = configuration.get(AwsS3.CONTAINER_NAME_FIELD_NAME);
-
- List<S3Object> filesOnly = new ArrayList<>();
-
// Ensure the validity of include/exclude
ExternalDataUtils.validateIncludeExclude(configuration);
+ IncludeExcludeMatcher includeExcludeMatcher = getIncludeExcludeMatchers();
+ // Prepare to retrieve the objects
+ List<S3Object> filesOnly;
+ String container = configuration.get(AwsS3.CONTAINER_NAME_FIELD_NAME);
S3Client s3Client = ExternalDataUtils.AwsS3.buildAwsS3Client(configuration);
- // Get all objects in a bucket and extract the paths to files
- ListObjectsV2Request.Builder listObjectsBuilder = ListObjectsV2Request.builder().bucket(container);
- listObjectsBuilder.prefix(ExternalDataUtils.getPrefix(configuration));
-
- ListObjectsV2Response listObjectsResponse;
- boolean done = false;
- String newMarker = null;
-
try {
- while (!done) {
- // List the objects from the start, or from the last marker in case of truncated result
- if (newMarker == null) {
- listObjectsResponse = s3Client.listObjectsV2(listObjectsBuilder.build());
+ filesOnly = listS3Objects(s3Client, container, includeExcludeMatcher);
+ } catch (S3Exception ex) {
+ // New API is not implemented, try falling back to old API
+ try {
+ // For error code, see https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html
+ if (ex.awsErrorDetails().errorCode().equals("NotImplemented")) {
+ filesOnly = oldApiListS3Objects(s3Client, container, includeExcludeMatcher);
} else {
- listObjectsResponse =
- s3Client.listObjectsV2(listObjectsBuilder.continuationToken(newMarker).build());
+ throw ex;
}
-
- // Collect the paths to files only
- IncludeExcludeMatcher includeExcludeMatcher = getIncludeExcludeMatchers();
- collectAndFilterFiles(listObjectsResponse.contents(), includeExcludeMatcher.getPredicate(),
- includeExcludeMatcher.getMatchersList(), filesOnly);
-
- // Mark the flag as done if done, otherwise, get the marker of the previous response for the next request
- if (!listObjectsResponse.isTruncated()) {
- done = true;
- } else {
- newMarker = listObjectsResponse.nextContinuationToken();
- }
+ } catch (SdkException ex2) {
+ throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex2.getMessage());
}
} catch (SdkException ex) {
throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex.getMessage());
@@ -124,6 +111,84 @@
}
/**
+ * Uses the latest API to retrieve the objects from the storage.
+ *
+ * @param s3Client S3 client
+ * @param container container name
+ * @param includeExcludeMatcher include/exclude matchers to apply
+ */
+ private List<S3Object> listS3Objects(S3Client s3Client, String container,
+ IncludeExcludeMatcher includeExcludeMatcher) {
+ String newMarker = null;
+ List<S3Object> filesOnly = new ArrayList<>();
+
+ ListObjectsV2Response listObjectsResponse;
+ ListObjectsV2Request.Builder listObjectsBuilder = ListObjectsV2Request.builder().bucket(container);
+ listObjectsBuilder.prefix(ExternalDataUtils.getPrefix(configuration));
+
+ while (true) {
+ // List the objects from the start, or from the last marker in case of truncated result
+ if (newMarker == null) {
+ listObjectsResponse = s3Client.listObjectsV2(listObjectsBuilder.build());
+ } else {
+ listObjectsResponse = s3Client.listObjectsV2(listObjectsBuilder.continuationToken(newMarker).build());
+ }
+
+ // Collect the paths to files only
+ collectAndFilterFiles(listObjectsResponse.contents(), includeExcludeMatcher.getPredicate(),
+ includeExcludeMatcher.getMatchersList(), filesOnly);
+
+ // Mark the flag as done if done, otherwise, get the marker of the previous response for the next request
+ if (!listObjectsResponse.isTruncated()) {
+ break;
+ } else {
+ newMarker = listObjectsResponse.nextContinuationToken();
+ }
+ }
+
+ return filesOnly;
+ }
+
+ /**
+ * Uses the old API (in case the new API is not implemented) to retrieve the objects from the storage
+ *
+ * @param s3Client S3 client
+ * @param container container name
+ * @param includeExcludeMatcher include/exclude matchers to apply
+ */
+ private List<S3Object> oldApiListS3Objects(S3Client s3Client, String container,
+ IncludeExcludeMatcher includeExcludeMatcher) {
+ String newMarker = null;
+ List<S3Object> filesOnly = new ArrayList<>();
+
+ ListObjectsResponse listObjectsResponse;
+ ListObjectsRequest.Builder listObjectsBuilder = ListObjectsRequest.builder().bucket(container);
+ listObjectsBuilder.prefix(ExternalDataUtils.getPrefix(configuration));
+
+ while (true) {
+ // List the objects from the start, or from the last marker in case of truncated result
+ if (newMarker == null) {
+ listObjectsResponse = s3Client.listObjects(listObjectsBuilder.build());
+ } else {
+ listObjectsResponse = s3Client.listObjects(listObjectsBuilder.marker(newMarker).build());
+ }
+
+ // Collect the paths to files only
+ collectAndFilterFiles(listObjectsResponse.contents(), includeExcludeMatcher.getPredicate(),
+ includeExcludeMatcher.getMatchersList(), filesOnly);
+
+ // Mark the flag as done if done, otherwise, get the marker of the previous response for the next request
+ if (!listObjectsResponse.isTruncated()) {
+ break;
+ } else {
+ newMarker = listObjectsResponse.nextMarker();
+ }
+ }
+
+ return filesOnly;
+ }
+
+ /**
* AWS S3 returns all the objects as paths, not differentiating between folder and files. The path is considered
* a file if it does not end up with a "/" which is the separator in a folder structure.
*
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataConstants.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataConstants.java
index 6be694b..1e3ab45 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataConstants.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataConstants.java
@@ -285,6 +285,8 @@
public static final String EMPTY_FIELD = "empty value";
public static final String INVALID_VAL = "invalid value";
+ public static final String DEFINITION_FIELD_NAME = "definition";
+
public static class AwsS3 {
private AwsS3() {
throw new AssertionError("do not instantiate");
@@ -295,7 +297,6 @@
public static final String SECRET_ACCESS_KEY_FIELD_NAME = "secretAccessKey";
public static final String SESSION_TOKEN_FIELD_NAME = "sessionToken";
public static final String CONTAINER_NAME_FIELD_NAME = "container";
- public static final String DEFINITION_FIELD_NAME = "definition";
public static final String SERVICE_END_POINT_FIELD_NAME = "serviceEndpoint";
}
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataUtils.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataUtils.java
index 537933e..ec5798f 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataUtils.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataUtils.java
@@ -43,7 +43,6 @@
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.regex.Matcher;
import org.apache.asterix.common.exceptions.AsterixException;
@@ -92,8 +91,12 @@
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.S3ClientBuilder;
+import software.amazon.awssdk.services.s3.model.ListObjectsRequest;
+import software.amazon.awssdk.services.s3.model.ListObjectsResponse;
import software.amazon.awssdk.services.s3.model.ListObjectsV2Request;
import software.amazon.awssdk.services.s3.model.ListObjectsV2Response;
+import software.amazon.awssdk.services.s3.model.S3Exception;
+import software.amazon.awssdk.services.s3.model.S3Response;
public class ExternalDataUtils {
@@ -523,7 +526,7 @@
switch (type) {
case ExternalDataConstants.KEY_ADAPTER_NAME_AWS_S3:
- ExternalDataUtils.AwsS3.validateProperties(configuration, srcLoc, collector);
+ AwsS3.validateProperties(configuration, srcLoc, collector);
break;
case ExternalDataConstants.KEY_ADAPTER_NAME_AZURE_BLOB:
ExternalDataUtils.Azure.validateProperties(configuration, srcLoc, collector);
@@ -644,7 +647,7 @@
* @param configuration configuration
*/
public static String getPrefix(Map<String, String> configuration) {
- String definition = configuration.get(ExternalDataConstants.AzureBlob.DEFINITION_FIELD_NAME);
+ String definition = configuration.get(ExternalDataConstants.DEFINITION_FIELD_NAME);
if (definition != null && !definition.isEmpty()) {
return definition + (!definition.endsWith("/") ? "/" : "");
}
@@ -734,17 +737,7 @@
}
builder.credentialsProvider(StaticCredentialsProvider.create(credentials));
-
- // Validate the region
- List<Region> supportedRegions = S3Client.serviceMetadata().regions();
- Optional<Region> selectedRegion =
- supportedRegions.stream().filter(region -> region.id().equalsIgnoreCase(regionId)).findFirst();
-
- if (!selectedRegion.isPresent()) {
- throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR,
- String.format("region %s is not supported", regionId));
- }
- builder.region(selectedRegion.get());
+ builder.region(Region.of(regionId));
// Validate the service endpoint if present
if (serviceEndpoint != null) {
@@ -781,26 +774,26 @@
validateIncludeExclude(configuration);
// Check if the bucket is present
- S3Client s3Client = null;
+ S3Client s3Client = buildAwsS3Client(configuration);;
+ S3Response response;
+ boolean useOldApi = false;
+ String container = configuration.get(ExternalDataConstants.AwsS3.CONTAINER_NAME_FIELD_NAME);
+ String prefix = getPrefix(configuration);
+
try {
- String container = configuration.get(ExternalDataConstants.AwsS3.CONTAINER_NAME_FIELD_NAME);
- s3Client = buildAwsS3Client(configuration);
- ListObjectsV2Request.Builder listObjectsBuilder = ListObjectsV2Request.builder();
- listObjectsBuilder.prefix(getPrefix(configuration));
-
- ListObjectsV2Response response =
- s3Client.listObjectsV2(listObjectsBuilder.bucket(container).maxKeys(1).build());
-
- if (response.contents().isEmpty() && collector.shouldWarn()) {
- Warning warning =
- WarningUtil.forAsterix(srcLoc, ErrorCode.EXTERNAL_SOURCE_CONFIGURATION_RETURNED_NO_FILES);
- collector.warn(warning);
- }
-
- // Returns 200 only in case the bucket exists, however, otherwise, throws an exception. However, to
- // ensure coverage, check if the result is successful as well and not only catch exceptions
- if (!response.sdkHttpResponse().isSuccessful()) {
- throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_CONTAINER_NOT_FOUND, container);
+ response = isBucketEmpty(s3Client, container, prefix, false);
+ } catch (S3Exception ex) {
+ // Method not implemented, try falling back to old API
+ try {
+ // For error code, see https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html
+ if (ex.awsErrorDetails().errorCode().equals("NotImplemented")) {
+ useOldApi = true;
+ response = isBucketEmpty(s3Client, container, prefix, true);
+ } else {
+ throw ex;
+ }
+ } catch (SdkException ex2) {
+ throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex2.getMessage());
}
} catch (SdkException ex) {
throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_ERROR, ex.getMessage());
@@ -809,6 +802,44 @@
CleanupUtils.close(s3Client, null);
}
}
+
+ boolean isEmpty = useOldApi ? ((ListObjectsResponse) response).contents().isEmpty()
+ : ((ListObjectsV2Response) response).contents().isEmpty();
+ if (isEmpty && collector.shouldWarn()) {
+ Warning warning =
+ WarningUtil.forAsterix(srcLoc, ErrorCode.EXTERNAL_SOURCE_CONFIGURATION_RETURNED_NO_FILES);
+ collector.warn(warning);
+ }
+
+ // Returns 200 only in case the bucket exists, otherwise, throws an exception. However, to
+ // ensure coverage, check if the result is successful as well and not only catch exceptions
+ if (!response.sdkHttpResponse().isSuccessful()) {
+ throw new CompilationException(ErrorCode.EXTERNAL_SOURCE_CONTAINER_NOT_FOUND, container);
+ }
+ }
+
+ /**
+ * Checks for a single object in the specified bucket to determine if the bucket is empty or not.
+ *
+ * @param s3Client s3 client
+ * @param container the container name
+ * @param prefix Prefix to be used
+ * @param useOldApi flag whether to use the old API or not
+ *
+ * @return returns the S3 response
+ */
+ private static S3Response isBucketEmpty(S3Client s3Client, String container, String prefix, boolean useOldApi) {
+ S3Response response;
+ if (useOldApi) {
+ ListObjectsRequest.Builder listObjectsBuilder = ListObjectsRequest.builder();
+ listObjectsBuilder.prefix(prefix);
+ response = s3Client.listObjects(listObjectsBuilder.bucket(container).maxKeys(1).build());
+ } else {
+ ListObjectsV2Request.Builder listObjectsBuilder = ListObjectsV2Request.builder();
+ listObjectsBuilder.prefix(prefix);
+ response = s3Client.listObjectsV2(listObjectsBuilder.bucket(container).maxKeys(1).build());
+ }
+ return response;
}
}
diff --git a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/PartitionReplica.java b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/PartitionReplica.java
index 3226299..6b97306 100644
--- a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/PartitionReplica.java
+++ b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/PartitionReplica.java
@@ -113,10 +113,10 @@
public synchronized void close() {
try {
- if (sc != null) {
+ if (NetworkingUtil.isHealthy(sc)) {
sendGoodBye();
- NetworkUtil.closeQuietly(sc);
}
+ NetworkUtil.closeQuietly(sc);
} finally {
sc = null;
}
diff --git a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/messaging/ReplicaFailedMessage.java b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/messaging/ReplicaFailedMessage.java
new file mode 100644
index 0000000..2a39eaf
--- /dev/null
+++ b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/messaging/ReplicaFailedMessage.java
@@ -0,0 +1,54 @@
+/*
+ * 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.replication.messaging;
+
+import java.net.InetSocketAddress;
+
+import org.apache.asterix.common.api.INcApplicationContext;
+import org.apache.asterix.common.messaging.api.INcAddressedMessage;
+import org.apache.asterix.replication.api.ReplicationDestination;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.util.NetworkUtil;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public class ReplicaFailedMessage implements INcAddressedMessage {
+
+ private static final long serialVersionUID = 1L;
+ private static final Logger LOGGER = LogManager.getLogger();
+ private final InetSocketAddress replicaAddress;
+ private final Exception failure;
+
+ public ReplicaFailedMessage(InetSocketAddress replicaAddress, Exception failure) {
+ this.replicaAddress = replicaAddress;
+ this.failure = failure;
+ }
+
+ @Override
+ public void handle(INcApplicationContext appCtx) throws HyracksDataException, InterruptedException {
+ LOGGER.info("replica at {} failed", replicaAddress);
+ ReplicationDestination dest = ReplicationDestination.at(NetworkUtil.ensureUnresolved(replicaAddress));
+ appCtx.getReplicationManager().notifyFailure(dest, failure);
+ }
+
+ @Override
+ public String toString() {
+ return ReplicaFailedMessage.class.getSimpleName();
+ }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/ClusterStateManager.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/ClusterStateManager.java
index 2c05c53..bf7ca34 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/ClusterStateManager.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/ClusterStateManager.java
@@ -18,6 +18,7 @@
*/
package org.apache.asterix.runtime.utils;
+import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -49,6 +50,7 @@
import org.apache.hyracks.control.common.application.ConfigManagerApplicationConfig;
import org.apache.hyracks.control.common.config.ConfigManager;
import org.apache.hyracks.control.common.controllers.NCConfig;
+import org.apache.hyracks.util.NetworkUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -91,13 +93,13 @@
@Override
public synchronized void notifyNodeFailure(String nodeId) throws HyracksException {
- if (LOGGER.isInfoEnabled()) {
- LOGGER.info("Removing configuration parameters for node id " + nodeId);
- }
+ LOGGER.info("Removing configuration parameters for node id {}", nodeId);
failedNodes.add(nodeId);
+ // before removing the node config, get its replica location
+ InetSocketAddress replicaAddress = getReplicaLocation(this, nodeId);
ncConfigMap.remove(nodeId);
pendingRemoval.remove(nodeId);
- lifecycleCoordinator.notifyNodeFailure(nodeId);
+ lifecycleCoordinator.notifyNodeFailure(nodeId, replicaAddress);
}
@Override
@@ -496,4 +498,17 @@
});
}
+ private static InetSocketAddress getReplicaLocation(IClusterStateManager csm, String nodeId) {
+ final Map<IOption, Object> ncConfig = csm.getActiveNcConfiguration().get(nodeId);
+ if (ncConfig == null) {
+ return null;
+ }
+ Object destIP = ncConfig.get(NCConfig.Option.REPLICATION_PUBLIC_ADDRESS);
+ Object destPort = ncConfig.get(NCConfig.Option.REPLICATION_PUBLIC_PORT);
+ if (destIP == null || destPort == null) {
+ return null;
+ }
+ String replicaLocation = NetworkUtil.toHostPort(String.valueOf(destIP), String.valueOf(destPort));
+ return NetworkUtil.parseInetSocketAddress(replicaLocation);
+ }
}
diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogReader.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogReader.java
index 30caab7..53a2897 100644
--- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogReader.java
+++ b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogReader.java
@@ -163,7 +163,7 @@
*/
private boolean refillLogReadBuffer() {
try {
- if (readLSN % logFileSize == logFile.size()) {
+ if (logFile.size() > 0 && readLSN % logFileSize == logFile.size()) {
readLSN += logFileSize - (readLSN % logFileSize);
getLogFile();
}
diff --git a/asterixdb/pom.xml b/asterixdb/pom.xml
index f8992d5..3cd433c 100644
--- a/asterixdb/pom.xml
+++ b/asterixdb/pom.xml
@@ -1468,6 +1468,11 @@
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
+ <artifactId>aws-core</artifactId>
+ <version>${awsjavasdk.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>software.amazon.awssdk</groupId>
<artifactId>sdk-core</artifactId>
<version>${awsjavasdk.version}</version>
<exclusions>
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/VariableUtilities.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/VariableUtilities.java
index c37e67e..dd7bc34 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/VariableUtilities.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/VariableUtilities.java
@@ -24,6 +24,7 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Objects;
import java.util.Set;
import org.apache.commons.lang3.mutable.Mutable;
@@ -167,7 +168,7 @@
boolean goThroughNts, ITypingContext ctx) throws AlgebricksException {
ILogicalOperatorVisitor<Void, Pair<LogicalVariable, LogicalVariable>> visitor =
new SubstituteVariableVisitor(goThroughNts, ctx);
- op.accept(visitor, new Pair<LogicalVariable, LogicalVariable>(v1, v2));
+ op.accept(visitor, new Pair<>(Objects.requireNonNull(v1), Objects.requireNonNull(v2)));
}
public static <T> boolean varListEqualUnordered(List<T> var, List<T> varArg) {
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/plan/PlanStructureVerifier.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/plan/PlanStructureVerifier.java
index 8495099..eeac87e 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/plan/PlanStructureVerifier.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/plan/PlanStructureVerifier.java
@@ -21,13 +21,20 @@
import java.util.ArrayDeque;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
+import java.util.Comparator;
import java.util.Deque;
+import java.util.HashSet;
import java.util.IdentityHashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.common.utils.Pair;
@@ -35,7 +42,10 @@
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator;
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalPlan;
import org.apache.hyracks.algebricks.core.algebra.base.LogicalExpressionTag;
+import org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable;
+import org.apache.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractOperatorWithNestedPlans;
+import org.apache.hyracks.algebricks.core.algebra.operators.logical.visitors.VariableUtilities;
import org.apache.hyracks.algebricks.core.algebra.prettyprint.IPlanPrettyPrinter;
import org.apache.hyracks.algebricks.core.algebra.typing.ITypingContext;
import org.apache.hyracks.algebricks.core.algebra.util.OperatorPropertiesUtil;
@@ -60,6 +70,13 @@
private static final String ERROR_MESSAGE_TEMPLATE_4 = "missing schema in %s";
+ private static final String ERROR_MESSAGE_TEMPLATE_5 =
+ "produced variables %s that intersect used variables %s on %s in %s";
+
+ private static final String ERROR_MESSAGE_TEMPLATE_6 = "undefined used variables %s in %s";
+
+ public static final Comparator<LogicalVariable> VARIABLE_CMP = Comparator.comparing(LogicalVariable::toString);
+
private final ExpressionReferenceVerifierVisitor exprVisitor = new ExpressionReferenceVerifierVisitor();
private final Map<Mutable<ILogicalOperator>, ILogicalOperator> opRefMap = new IdentityHashMap<>();
@@ -72,6 +89,10 @@
private final Deque<Pair<Mutable<ILogicalOperator>, ILogicalOperator>> workQueue = new ArrayDeque<>();
+ private final Set<LogicalVariable> tmpVarSet1 = new HashSet<>();
+
+ private final Set<LogicalVariable> tmpVarSet2 = new HashSet<>();
+
private final IPlanPrettyPrinter prettyPrinter;
private final ITypingContext typeEnvProvider;
@@ -155,14 +176,9 @@
exprVisitor.setOperator(op);
op.acceptExpressionTransform(exprVisitor);
- if (ensureTypeEnv && typeEnvProvider.getOutputTypeEnvironment(op) == null) {
- throw new AlgebricksException(
- String.format(ERROR_MESSAGE_TEMPLATE_3, PlanStabilityVerifier.printOperator(op, prettyPrinter)));
- }
- if (ensureSchema && op.getSchema() == null) {
- throw new AlgebricksException(
- String.format(ERROR_MESSAGE_TEMPLATE_4, PlanStabilityVerifier.printOperator(op, prettyPrinter)));
- }
+ checkOperatorTypeEnvironment(op);
+ checkOperatorSchema(op);
+ checkOperatorVariables(op);
List<Mutable<ILogicalOperator>> children = op.getInputs();
if (op instanceof AbstractOperatorWithNestedPlans) {
@@ -174,6 +190,77 @@
return children;
}
+ private void checkOperatorTypeEnvironment(ILogicalOperator op) throws AlgebricksException {
+ if (ensureTypeEnv && typeEnvProvider.getOutputTypeEnvironment(op) == null) {
+ throw new AlgebricksException(
+ String.format(ERROR_MESSAGE_TEMPLATE_3, PlanStabilityVerifier.printOperator(op, prettyPrinter)));
+ }
+ }
+
+ private void checkOperatorSchema(ILogicalOperator op) throws AlgebricksException {
+ if (ensureSchema && op.getSchema() == null) {
+ throw new AlgebricksException(
+ String.format(ERROR_MESSAGE_TEMPLATE_4, PlanStabilityVerifier.printOperator(op, prettyPrinter)));
+ }
+ }
+
+ private void checkOperatorVariables(ILogicalOperator op) throws AlgebricksException {
+ if (op instanceof AbstractOperatorWithNestedPlans) {
+ return;
+ }
+
+ tmpVarSet1.clear();
+ VariableUtilities.getUsedVariables(op, tmpVarSet1);
+ if (!tmpVarSet1.isEmpty()) {
+ ensureUsedVarsAreDefined(op, tmpVarSet1);
+ ensureProducedVarsDisjointFromUsedVars(op, tmpVarSet1);
+ }
+ }
+
+ private void ensureUsedVarsAreDefined(ILogicalOperator op, Collection<LogicalVariable> usedVars)
+ throws AlgebricksException {
+ if (!ensureTypeEnv) {
+ return;
+ }
+
+ tmpVarSet2.clear();
+ tmpVarSet2.addAll(usedVars);
+ Set<LogicalVariable> usedVarsCopy = tmpVarSet2;
+
+ for (Mutable<ILogicalOperator> childRef : op.getInputs()) {
+ ILogicalOperator childOp = childRef.getValue();
+ IVariableTypeEnvironment childOpTypeEnv = typeEnvProvider.getOutputTypeEnvironment(childOp);
+ if (childOpTypeEnv == null) {
+ throw new AlgebricksException(String.format(ERROR_MESSAGE_TEMPLATE_3,
+ PlanStabilityVerifier.printOperator(childOp, prettyPrinter)));
+ }
+ for (Iterator<LogicalVariable> i = usedVarsCopy.iterator(); i.hasNext();) {
+ LogicalVariable usedVar = i.next();
+ if (childOpTypeEnv.getVarType(usedVar) != null) {
+ i.remove();
+ }
+ }
+ }
+ if (!usedVarsCopy.isEmpty()) {
+ throw new AlgebricksException(String.format(ERROR_MESSAGE_TEMPLATE_6, sorted(usedVarsCopy, VARIABLE_CMP),
+ PlanStabilityVerifier.printOperator(op, prettyPrinter)));
+ }
+ }
+
+ private void ensureProducedVarsDisjointFromUsedVars(ILogicalOperator op, Set<LogicalVariable> usedVars)
+ throws AlgebricksException {
+ tmpVarSet2.clear();
+ VariableUtilities.getProducedVariables(op, tmpVarSet2);
+ Set<LogicalVariable> producedVars = tmpVarSet2;
+
+ Collection<LogicalVariable> intersection = CollectionUtils.intersection(producedVars, usedVars);
+ if (!intersection.isEmpty()) {
+ throw new AlgebricksException(String.format(ERROR_MESSAGE_TEMPLATE_5, sorted(producedVars, VARIABLE_CMP),
+ sorted(usedVars, VARIABLE_CMP), sorted(intersection, VARIABLE_CMP),
+ PlanStabilityVerifier.printOperator(op, prettyPrinter)));
+ }
+ }
+
private void raiseException(String sharedReferenceKind, String sharedEntity, ILogicalOperator firstOp,
ILogicalOperator secondOp) throws AlgebricksException {
String errorMessage;
@@ -188,6 +275,10 @@
throw new AlgebricksException(errorMessage);
}
+ private <T> List<T> sorted(Collection<T> inColl, Comparator<T> comparator) {
+ return inColl.stream().sorted(comparator).collect(Collectors.toList());
+ }
+
private final class ExpressionReferenceVerifierVisitor implements ILogicalExpressionReferenceTransform {
private ILogicalOperator currentOp;
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/config/AlgebricksConfig.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/config/AlgebricksConfig.java
index 2ed40fd..c99117b 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/config/AlgebricksConfig.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/config/AlgebricksConfig.java
@@ -32,4 +32,5 @@
public static final boolean EXTERNAL_FIELD_PUSHDOWN_DEFAULT = false;
public static final boolean SUBPLAN_MERGE_DEFAULT = true;
public static final boolean SUBPLAN_NESTEDPUSHDOWN_DEFAULT = true;
+ public static final boolean MIN_MEMORY_ALLOCATION_DEFAULT = true;
}
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/PhysicalOptimizationConfig.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/PhysicalOptimizationConfig.java
index bfa4298..92f579c 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/PhysicalOptimizationConfig.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/PhysicalOptimizationConfig.java
@@ -44,8 +44,9 @@
private static final String EXTERNAL_FIELD_PUSHDOWN = "EXTERNAL_FIELD_PUSHDOWN";
private static final String SUBPLAN_MERGE = "SUBPLAN_MERGE";
private static final String SUBPLAN_NESTEDPUSHDOWN = "SUBPLAN_NESTEDPUSHDOWN";
+ private static final String MIN_MEMORY_ALLOCATION = "MIN_MEMORY_ALLOCATION";
- private Properties properties = new Properties();
+ private final Properties properties = new Properties();
public PhysicalOptimizationConfig() {
int frameSize = 32768;
@@ -217,6 +218,14 @@
setBoolean(SUBPLAN_NESTEDPUSHDOWN, value);
}
+ public boolean getMinMemoryAllocation() {
+ return getBoolean(MIN_MEMORY_ALLOCATION, AlgebricksConfig.MIN_MEMORY_ALLOCATION_DEFAULT);
+ }
+
+ public void setMinMemoryAllocation(boolean value) {
+ setBoolean(MIN_MEMORY_ALLOCATION, value);
+ }
+
private void setInt(String property, int value) {
properties.setProperty(property, Integer.toString(value));
}
diff --git a/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/ComplexUnnestToProductRule.java b/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/ComplexUnnestToProductRule.java
index 54fe09d..7edefc7 100644
--- a/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/ComplexUnnestToProductRule.java
+++ b/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/ComplexUnnestToProductRule.java
@@ -86,9 +86,8 @@
// The last operator must be an unnest or join.
AbstractLogicalOperator unnestOrJoin = (AbstractLogicalOperator) outerOps.get(outerOps.size() - 1);
- ILogicalOperator outerRoot = null;
- ILogicalOperator innerRoot = null;
- EmptyTupleSourceOperator ets = new EmptyTupleSourceOperator();
+ ILogicalOperator outerRoot;
+ ILogicalOperator innerRoot;
// If we found a join, simply use it as the outer root.
if (unnestOrJoin.getOperatorTag() != LogicalOperatorTag.INNERJOIN
&& unnestOrJoin.getOperatorTag() != LogicalOperatorTag.LEFTOUTERJOIN) {
@@ -110,6 +109,7 @@
return false;
}
}
+ EmptyTupleSourceOperator ets = new EmptyTupleSourceOperator();
innerRoot = buildOperatorChain(innerOps, ets, context);
context.computeAndSetTypeEnvironmentForOperator(innerRoot);
outerRoot = buildOperatorChain(outerOps, null, context);
@@ -213,6 +213,10 @@
}
}
default: {
+ if (op.getInputs().size() > 1) {
+ return false;
+ }
+
// The inner is trivially independent.
if (!belowSecondUnnest && innerUsedVars.isEmpty()) {
outerOps.add(op);
diff --git a/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/subplan/PushSubplanIntoGroupByRule.java b/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/subplan/PushSubplanIntoGroupByRule.java
index 4113dbd..e8595962 100644
--- a/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/subplan/PushSubplanIntoGroupByRule.java
+++ b/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/subplan/PushSubplanIntoGroupByRule.java
@@ -166,7 +166,10 @@
loop_dest_op_nested_plans: for (ILogicalPlan originalDestOpNestedPlan : destOp.getNestedPlans()) {
for (Mutable<ILogicalOperator> originalDestOpNestedPlanRootRef : originalDestOpNestedPlan
.getRoots()) {
- if (downToNts(originalDestOpNestedPlanRootRef) == null) {
+ boolean nestedPlanShapeOk = originalDestOpNestedPlanRootRef.getValue()
+ .getOperatorTag() == LogicalOperatorTag.AGGREGATE
+ && downToNts(originalDestOpNestedPlanRootRef) != null;
+ if (!nestedPlanShapeOk) {
continue;
}
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/io/IODeviceHandle.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/io/IODeviceHandle.java
index a2d28e1..c826c2f 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/io/IODeviceHandle.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/io/IODeviceHandle.java
@@ -20,6 +20,7 @@
import java.io.File;
import java.io.Serializable;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
@@ -80,7 +81,7 @@
public static List<IODeviceHandle> getDevices(String[] ioDevices) {
List<IODeviceHandle> devices = new ArrayList<>();
for (String ioDevice : ioDevices) {
- String devPath = ioDevice.trim();
+ String devPath = Paths.get(ioDevice.trim()).toAbsolutePath().normalize().toString();
devices.add(new IODeviceHandle(new File(devPath), "."));
}
return devices;
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/config/OptionTypes.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/config/OptionTypes.java
index f9d9995..d4c17e4 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/config/OptionTypes.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/config/OptionTypes.java
@@ -35,66 +35,11 @@
public class OptionTypes {
- public static final IOptionType<Integer> INTEGER_BYTE_UNIT = new IOptionType<Integer>() {
- @Override
- public Integer parse(String s) {
- if (s == null) {
- return null;
- }
- long result1 = StorageUtil.getByteValue(s);
- if (result1 > Integer.MAX_VALUE || result1 < Integer.MIN_VALUE) {
- throw new IllegalArgumentException("The given value: " + result1 + " is not within the int range.");
- }
- return (int) result1;
- }
+ public static final IOptionType<Integer> INTEGER_BYTE_UNIT = new IntegerByteUnit();
+ public static final IOptionType<Integer> POSITIVE_INTEGER_BYTE_UNIT = new IntegerByteUnit(1, Integer.MAX_VALUE);
- @Override
- public Integer parse(JsonNode node) {
- return node.isNull() ? null : parse(node.asText());
- }
-
- @Override
- public Class<Integer> targetType() {
- return Integer.class;
- }
-
- @Override
- public String serializeToHumanReadable(Object value) {
- return value + " (" + StorageUtil.toHumanReadableSize((int) value) + ")";
- }
-
- @Override
- public void serializeJSONField(String fieldName, Object value, ObjectNode node) {
- node.put(fieldName, (int) value);
- }
- };
-
- public static final IOptionType<Long> LONG_BYTE_UNIT = new IOptionType<Long>() {
- @Override
- public Long parse(String s) {
- return s == null ? null : StorageUtil.getByteValue(s);
- }
-
- @Override
- public Long parse(JsonNode node) {
- return node.isNull() ? null : parse(node.asText());
- }
-
- @Override
- public Class<Long> targetType() {
- return Long.class;
- }
-
- @Override
- public String serializeToHumanReadable(Object value) {
- return value + " (" + StorageUtil.toHumanReadableSize((long) value) + ")";
- }
-
- @Override
- public void serializeJSONField(String fieldName, Object value, ObjectNode node) {
- node.put(fieldName, (long) value);
- }
- };
+ public static final IOptionType<Long> LONG_BYTE_UNIT = new LongByteUnit();
+ public static final IOptionType<Long> POSITIVE_LONG_BYTE_UNIT = new LongByteUnit(1, Long.MAX_VALUE);
public static final IOptionType<Short> SHORT = new IOptionType<Short>() {
@Override
@@ -172,27 +117,7 @@
}
};
- public static final IOptionType<Long> LONG = new IOptionType<Long>() {
- @Override
- public Long parse(String s) {
- return Long.parseLong(s);
- }
-
- @Override
- public Long parse(JsonNode node) {
- return node.isNull() ? null : node.asLong();
- }
-
- @Override
- public Class<Long> targetType() {
- return Long.class;
- }
-
- @Override
- public void serializeJSONField(String fieldName, Object value, ObjectNode node) {
- node.put(fieldName, (long) value);
- }
- };
+ public static final IOptionType<Long> LONG = new LongOptionType();
public static final IOptionType<Boolean> BOOLEAN = new IOptionType<Boolean>() {
@Override
@@ -269,7 +194,7 @@
List<String> strings = new ArrayList<>();
if (node instanceof ArrayNode) {
node.elements().forEachRemaining(n -> strings.add(n.asText()));
- return strings.toArray(new String[strings.size()]);
+ return strings.toArray(new String[0]);
} else {
return parse(node.asText());
}
@@ -332,26 +257,7 @@
}
public static IOptionType<Integer> getRangedIntegerType(final int minValueInclusive, final int maxValueInclusive) {
- return new IntegerOptionType() {
- @Override
- public Integer parse(String value) {
- int intValue = super.parse(value);
- if (intValue < minValueInclusive || intValue > maxValueInclusive) {
- if (maxValueInclusive == Integer.MAX_VALUE) {
- if (minValueInclusive == 0) {
- throw new IllegalArgumentException(
- "integer value must not be negative, but was " + intValue);
- } else if (minValueInclusive == 1) {
- throw new IllegalArgumentException(
- "integer value must be greater than zero, but was " + intValue);
- }
- }
- throw new IllegalArgumentException("integer value must be between " + minValueInclusive + "-"
- + maxValueInclusive + " (inclusive)");
- }
- return intValue;
- }
- };
+ return new RangedIntegerOptionType(minValueInclusive, maxValueInclusive);
}
public static class IntegerOptionType implements IOptionType<Integer> {
@@ -375,4 +281,154 @@
node.put(fieldName, (int) value);
}
}
+
+ private static class RangedIntegerOptionType extends IntegerOptionType {
+ private final int minValue;
+ private final int maxValue;
+
+ RangedIntegerOptionType(int minValue, int maxValue) {
+ this.minValue = minValue;
+ this.maxValue = maxValue;
+ }
+
+ @Override
+ public Integer parse(String value) {
+ int intValue = super.parse(value);
+ rangeCheck(intValue);
+ return intValue;
+ }
+
+ void rangeCheck(long intValue) {
+ if (intValue < minValue || intValue > maxValue) {
+ if (maxValue == Integer.MAX_VALUE) {
+ if (minValue == 0) {
+ throw new IllegalArgumentException("integer value must not be negative, but was " + intValue);
+ } else if (minValue == 1) {
+ throw new IllegalArgumentException(
+ "integer value must be greater than zero, but was " + intValue);
+ }
+ }
+ throw new IllegalArgumentException(
+ "integer value must be between " + minValue + "-" + maxValue + " (inclusive)");
+ }
+ }
+ }
+
+ private static class IntegerByteUnit extends RangedIntegerOptionType {
+
+ IntegerByteUnit() {
+ this(Integer.MIN_VALUE, Integer.MAX_VALUE);
+ }
+
+ IntegerByteUnit(int minValue, int maxValue) {
+ super(minValue, maxValue);
+ }
+
+ @Override
+ public Integer parse(String s) {
+ if (s == null) {
+ return null;
+ }
+ long result = StorageUtil.getByteValue(s);
+ rangeCheck(result);
+ return (int) result;
+ }
+
+ @Override
+ public Integer parse(JsonNode node) {
+ // TODO: we accept human readable sizes from json- why not emit human readable sizes?
+ return node.isNull() ? null : parse(node.asText());
+ }
+
+ @Override
+ public String serializeToHumanReadable(Object value) {
+ return value + " (" + StorageUtil.toHumanReadableSize((int) value) + ")";
+ }
+ }
+
+ private static class RangedLongOptionType extends LongOptionType {
+ private final long minValue;
+ private final long maxValue;
+
+ RangedLongOptionType(long minValue, long maxValue) {
+ this.minValue = minValue;
+ this.maxValue = maxValue;
+ }
+
+ @Override
+ public Long parse(String value) {
+ long longValue = super.parse(value);
+ rangeCheck(longValue);
+ return longValue;
+ }
+
+ void rangeCheck(long longValue) {
+ if (longValue < minValue || longValue > maxValue) {
+ if (maxValue == Long.MAX_VALUE) {
+ if (minValue == 0) {
+ throw new IllegalArgumentException("long value must not be negative, but was " + longValue);
+ } else if (minValue == 1) {
+ throw new IllegalArgumentException(
+ "long value must be greater than zero, but was " + longValue);
+ }
+ }
+ throw new IllegalArgumentException(
+ "long value must be between " + minValue + "-" + maxValue + " (inclusive)");
+ }
+ }
+ }
+
+ private static class LongByteUnit extends RangedLongOptionType {
+
+ LongByteUnit() {
+ this(Long.MIN_VALUE, Long.MAX_VALUE);
+ }
+
+ LongByteUnit(long minValue, long maxValue) {
+ super(minValue, maxValue);
+ }
+
+ @Override
+ public Long parse(String s) {
+ if (s == null) {
+ return null;
+ }
+ long result = StorageUtil.getByteValue(s);
+ rangeCheck(result);
+ return result;
+ }
+
+ @Override
+ public Long parse(JsonNode node) {
+ // TODO: we accept human readable sizes from json- why not emit human readable sizes?
+ return node.isNull() ? null : parse(node.asText());
+ }
+
+ @Override
+ public String serializeToHumanReadable(Object value) {
+ return value + " (" + StorageUtil.toHumanReadableSize((long) value) + ")";
+ }
+ }
+
+ private static class LongOptionType implements IOptionType<Long> {
+ @Override
+ public Long parse(String s) {
+ return Long.parseLong(s);
+ }
+
+ @Override
+ public Long parse(JsonNode node) {
+ return node.isNull() ? null : node.asLong();
+ }
+
+ @Override
+ public Class<Long> targetType() {
+ return Long.class;
+ }
+
+ @Override
+ public void serializeJSONField(String fieldName, Object value, ObjectNode node) {
+ node.put(fieldName, (long) value);
+ }
+ }
}
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 da78a0d..dee61a4 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
@@ -414,9 +414,9 @@
}
public IODeviceHandle getDevice(String fullPath) {
- Path full = Paths.get(fullPath);
+ Path full = Paths.get(fullPath).normalize();
for (IODeviceHandle d : ioDevices) {
- if (full.startsWith(Paths.get(d.getMount().getAbsolutePath()))) {
+ if (full.startsWith(Paths.get(d.getMount().getAbsolutePath()).normalize())) {
return d;
}
}
diff --git a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/sockets/SslSocketChannel.java b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/sockets/SslSocketChannel.java
index 02a1a02..74deefe 100644
--- a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/sockets/SslSocketChannel.java
+++ b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/sockets/SslSocketChannel.java
@@ -20,6 +20,7 @@
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.nio.channels.ClosedChannelException;
import java.nio.channels.SocketChannel;
import javax.net.ssl.SSLEngine;
@@ -142,6 +143,9 @@
while (src.hasRemaining()) {
// chunk src to encrypted ssl records of pocket size
outEncryptedData.clear();
+ if (!socketChannel.isConnected()) {
+ throw new ClosedChannelException();
+ }
final SSLEngineResult result = engine.wrap(src, outEncryptedData);
switch (result.getStatus()) {
case OK:
@@ -186,8 +190,11 @@
public synchronized void close() throws IOException {
if (socketChannel.isOpen()) {
engine.closeOutbound();
- new SslHandshake(this).handshake();
- socketChannel.close();
+ try {
+ new SslHandshake(this).handshake();
+ } finally {
+ socketChannel.close();
+ }
}
}