diff --git a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/node/AbstractNodeWrapper.java b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/node/AbstractNodeWrapper.java index cbcf4ca3fd59e..14ef8b36ef7a6 100644 --- a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/node/AbstractNodeWrapper.java +++ b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/node/AbstractNodeWrapper.java @@ -57,6 +57,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; +import java.nio.file.StandardOpenOption; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Arrays; @@ -834,4 +835,18 @@ public Process getInstance() { public int[] getPortList() { return portList; } + + public void clearLogContent() throws IOException { + Files.newOutputStream(Paths.get(getLogPath()), StandardOpenOption.TRUNCATE_EXISTING).close(); + } + + public boolean logContains(String content) throws IOException { + List lines = Files.readAllLines(Paths.get(getLogPath()), StandardCharsets.UTF_8); + for (String line : lines) { + if (line.contains(content)) { + return true; + } + } + return false; + } } diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBDebugQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBDebugQueryIT.java new file mode 100644 index 0000000000000..2885b62f676d2 --- /dev/null +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBDebugQueryIT.java @@ -0,0 +1,105 @@ +/* + * 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.iotdb.relational.it.query.recent; + +import org.apache.iotdb.it.env.EnvFactory; +import org.apache.iotdb.it.env.cluster.node.DataNodeWrapper; +import org.apache.iotdb.it.framework.IoTDBTestRunner; +import org.apache.iotdb.itbase.category.TableLocalStandaloneIT; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; + +import java.io.IOException; + +import static org.apache.iotdb.db.it.utils.TestUtils.prepareData; +import static org.apache.iotdb.db.it.utils.TestUtils.prepareTableData; +import static org.apache.iotdb.db.it.utils.TestUtils.resultSetEqualTest; +import static org.apache.iotdb.db.it.utils.TestUtils.tableResultSetEqualTest; +import static org.junit.Assert.assertTrue; + +@RunWith(IoTDBTestRunner.class) +@Category({TableLocalStandaloneIT.class}) +public class IoTDBDebugQueryIT { + private static final String DATABASE_NAME = "test_db"; + private static final String[] createTableSqls = + new String[] { + "CREATE DATABASE " + DATABASE_NAME, + "USE " + DATABASE_NAME, + "create table table1(device string tag, value int32 field)", + "insert into table1(time,device,value) values(2020-01-01 00:00:01.000,'d1',1)", + "FLUSH", + }; + private static final String[] createTreeSqls = + new String[] { + "create timeseries root.test.departments.department_id TEXT", + "create timeseries root.test.departments.dep_name TEXT", + "insert into root.test.departments(time, department_id, dep_name) values(1, 'D001', '研发部')", + "FLUSH", + }; + private static DataNodeWrapper dataNodeWrapper; + + @BeforeClass + public static void setUp() throws Exception { + EnvFactory.getEnv().initClusterEnvironment(); + dataNodeWrapper = EnvFactory.getEnv().getDataNodeWrapperList().get(0); + prepareTableData(createTableSqls); + prepareData(createTreeSqls); + } + + @AfterClass + public static void tearDown() throws Exception { + EnvFactory.getEnv().cleanClusterEnvironment(); + } + + @Test + public void tableTest() throws IOException { + // clear log content to reduce lines spanned in logContains check + dataNodeWrapper.clearLogContent(); + + String[] expectedHeader = new String[] {"time", "device", "value"}; + String[] retArray = new String[] {"2020-01-01T00:00:01.000Z,d1,1,"}; + tableResultSetEqualTest( + "debug select time,device,value from table1", expectedHeader, retArray, DATABASE_NAME); + + assertTrue(dataNodeWrapper.logContains("Cache miss: table1.d1")); + } + + @Test + public void treeTest() throws IOException { + // clear log content to reduce lines spanned in logContains check + dataNodeWrapper.clearLogContent(); + + String[] expectedHeader = + new String[] { + "Time", "root.test.departments.department_id", "root.test.departments.dep_name" + }; + String[] retArray = new String[] {"1,D001,研发部,"}; + resultSetEqualTest( + "debug select department_id, dep_name from root.test.departments", + expectedHeader, + retArray); + + assertTrue(dataNodeWrapper.logContains("Cache miss: root.test.departments")); + } +} diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/legacy/IoTDBLegacyPipeReceiverAgent.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/legacy/IoTDBLegacyPipeReceiverAgent.java index 2c45c42a45582..ea7baae792775 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/legacy/IoTDBLegacyPipeReceiverAgent.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/legacy/IoTDBLegacyPipeReceiverAgent.java @@ -165,6 +165,7 @@ private boolean registerDatabase( partitionFetcher, schemaFetcher, IoTDBDescriptor.getInstance().getConfig().getQueryTimeoutThreshold(), + false, false); if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode() && result.status.code != TSStatusCode.DATABASE_ALREADY_EXISTS.getStatusCode() diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/legacy/loader/DeletionLoader.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/legacy/loader/DeletionLoader.java index 244ec579206b6..56875a840ed36 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/legacy/loader/DeletionLoader.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/legacy/loader/DeletionLoader.java @@ -76,7 +76,8 @@ public void load() throws PipeException { PARTITION_FETCHER, SCHEMA_FETCHER, IoTDBDescriptor.getInstance().getConfig().getQueryTimeoutThreshold(), - false); + false, + statement.isDebug()); if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { LOGGER.error("Delete {} error, statement: {}.", deletion, statement); LOGGER.error("Delete result status : {}.", result.status); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/legacy/loader/TsFileLoader.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/legacy/loader/TsFileLoader.java index d3698e97d0797..e4a1c079a2146 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/legacy/loader/TsFileLoader.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/legacy/loader/TsFileLoader.java @@ -79,7 +79,8 @@ public void load() { PARTITION_FETCHER, SCHEMA_FETCHER, IoTDBDescriptor.getInstance().getConfig().getQueryTimeoutThreshold(), - false); + false, + statement.isDebug()); if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { LOGGER.error("Load TsFile {} error, statement: {}.", tsFile.getPath(), statement); LOGGER.error("Load TsFile result status : {}.", result.status); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.java index f0796a3b1a038..4670d7eac2a83 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.java @@ -1050,7 +1050,8 @@ private TSStatus executeStatementForTreeModel(final Statement statement) { ClusterPartitionFetcher.getInstance(), ClusterSchemaFetcher.getInstance(), IoTDBDescriptor.getInstance().getConfig().getQueryTimeoutThreshold(), - false) + false, + statement.isDebug()) .status; } @@ -1075,7 +1076,8 @@ private TSStatus executeStatementForTableModelWithPermissionCheck( "", LocalExecutionPlanner.getInstance().metadata, IoTDBDescriptor.getInstance().getConfig().getQueryTimeoutThreshold(), - false) + false, + statement.isDebug()) .status; // Delete data & Update device attribute is itself idempotent diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/writeback/WriteBackSink.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/writeback/WriteBackSink.java index c47e00ff92e52..9d476c542941b 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/writeback/WriteBackSink.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/writeback/WriteBackSink.java @@ -512,7 +512,8 @@ private TSStatus executeStatementForTreeModel(final Statement statement, final S ClusterPartitionFetcher.getInstance(), ClusterSchemaFetcher.getInstance(), IoTDBDescriptor.getInstance().getConfig().getQueryTimeoutThreshold(), - false) + false, + statement.isDebug()) .status; } catch (final IoTDBRuntimeException e) { if (e.getErrorCode() == TSStatusCode.NO_PERMISSION.getStatusCode()) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java index 89cf198a68858..9f6efb3fbfcdf 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java @@ -362,7 +362,8 @@ private TSExecuteStatementResp executeStatementInternal( statement, LocalExecutionPlanner.getInstance().metadata, config.getQueryTimeoutThreshold(), - false); + false, + s.isDebug()); } else { // permission check TSStatus status = @@ -406,7 +407,8 @@ private TSExecuteStatementResp executeStatementInternal( partitionFetcher, schemaFetcher, request.getTimeout(), - true); + true, + s.isDebug()); } } } else { @@ -453,7 +455,8 @@ private TSExecuteStatementResp executeStatementInternal( statement, metadata, request.getTimeout(), - true); + true, + s.isDebug()); } } @@ -757,7 +760,8 @@ private TSExecuteStatementResp executeRawDataQueryInternal( partitionFetcher, schemaFetcher, req.getTimeout(), - true); + true, + s.isDebug()); if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { finished = true; @@ -852,7 +856,8 @@ private TSExecuteStatementResp executeLastDataQueryInternal( partitionFetcher, schemaFetcher, req.getTimeout(), - true); + true, + s.isDebug()); if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { finished = true; @@ -949,7 +954,8 @@ private TSExecuteStatementResp executeAggregationQueryInternal( partitionFetcher, schemaFetcher, req.getTimeout(), - true); + true, + s.isDebug()); if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { finished = true; @@ -1408,7 +1414,8 @@ public TSExecuteStatementResp executeFastLastDataQueryForOneDeviceV2( partitionFetcher, schemaFetcher, req.getTimeout(), - true); + true, + s.isDebug()); if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { finished = true; @@ -2106,7 +2113,8 @@ public TSStatus executeBatchStatement(TSExecuteBatchStatementReq req) { statement, LocalExecutionPlanner.getInstance().metadata, config.getQueryTimeoutThreshold(), - false); + false, + s.isDebug()); } else { // permission check TSStatus status = @@ -2151,7 +2159,8 @@ public TSStatus executeBatchStatement(TSExecuteBatchStatementReq req) { partitionFetcher, schemaFetcher, config.getQueryTimeoutThreshold(), - false); + false, + s.isDebug()); } } } else { @@ -2197,7 +2206,8 @@ public TSStatus executeBatchStatement(TSExecuteBatchStatementReq req) { statement, metadata, config.getQueryTimeoutThreshold(), - false); + false, + s.isDebug()); } } @@ -3119,7 +3129,8 @@ private TSQueryTemplateResp executeTemplateQueryStatement( partitionFetcher, schemaFetcher, config.getQueryTimeoutThreshold(), - true); + true, + statement.isDebug()); if (executionResult.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode() && executionResult.status.code != TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) { @@ -3529,6 +3540,7 @@ private ExecutionResult executeBatchStatement( ExecutionResult result = null; final List subStatements = statement.getSubStatements(); final int totalSubStatements = subStatements.size(); + boolean debug = statement.isDebug(); LOGGER.info( "Start batch executing {} sub-statement(s) in tree model, queryId: {}", @@ -3553,7 +3565,8 @@ private ExecutionResult executeBatchStatement( partitionFetcher, schemaFetcher, timeoutMs, - userQuery); + userQuery, + debug); // Exit early if any sub-statement execution fails if (result != null @@ -3643,7 +3656,8 @@ private ExecutionResult executeBatchTableStatement( statementStr, metadata, timeoutMs, - userQuery); + userQuery, + statement.isDebug()); // Exit early if any sub-statement execution fails if (result != null diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java index 00403b8f9ac35..42929be741819 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java @@ -1685,6 +1685,7 @@ public TSStatus executeCQ(TExecuteCQ req) { partitionFetcher, schemaFetcher, req.getTimeout(), + false, false); if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode() diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/MPPQueryContext.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/MPPQueryContext.java index fac3afff8b0b0..3bd1f28e6ba6e 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/MPPQueryContext.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/MPPQueryContext.java @@ -125,6 +125,8 @@ public enum ExplainType { private boolean userQuery = false; + private boolean debug = false; + private Map, Query> cteQueries = new HashMap<>(); // Stores the EXPLAIN/EXPLAIN ANALYZE results for Common Table Expressions (CTEs) @@ -503,6 +505,14 @@ public void setUserQuery(boolean userQuery) { this.userQuery = userQuery; } + public boolean isDebug() { + return debug; + } + + public void setDebug(boolean debug) { + this.debug = debug; + } + public boolean isInnerTriggeredQuery() { return innerTriggeredQuery; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FakedFragmentInstanceContext.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FakedFragmentInstanceContext.java index 26bfb723917ff..bdebbc9f28964 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FakedFragmentInstanceContext.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FakedFragmentInstanceContext.java @@ -35,7 +35,7 @@ public class FakedFragmentInstanceContext extends FragmentInstanceContext { public FakedFragmentInstanceContext(Filter timeFilter, DataRegion dataRegion) { - super(0, new FakedMemoryReservationManager(), timeFilter, dataRegion); + super(0, new FakedMemoryReservationManager(), timeFilter, dataRegion, false); } public QueryDataSource getSharedQueryDataSource(IFullPath sourcePath) diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java index 1a1b426006a11..bb16bf73c16f5 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java @@ -163,9 +163,12 @@ public class FragmentInstanceContext extends QueryContext { private long closedUnseqFileNum = 0; public static FragmentInstanceContext createFragmentInstanceContext( - FragmentInstanceId id, FragmentInstanceStateMachine stateMachine, SessionInfo sessionInfo) { + FragmentInstanceId id, + FragmentInstanceStateMachine stateMachine, + SessionInfo sessionInfo, + boolean debug) { FragmentInstanceContext instanceContext = - new FragmentInstanceContext(id, stateMachine, sessionInfo); + new FragmentInstanceContext(id, stateMachine, sessionInfo, debug); instanceContext.initialize(); instanceContext.start(); return instanceContext; @@ -177,9 +180,10 @@ public static FragmentInstanceContext createFragmentInstanceContext( FragmentInstanceStateMachine stateMachine, SessionInfo sessionInfo, IDataRegionForQuery dataRegion, - Filter timeFilter) { + Filter timeFilter, + boolean debug) { FragmentInstanceContext instanceContext = - new FragmentInstanceContext(id, stateMachine, sessionInfo, dataRegion, timeFilter); + new FragmentInstanceContext(id, stateMachine, sessionInfo, dataRegion, timeFilter, debug); instanceContext.initialize(); instanceContext.start(); return instanceContext; @@ -191,7 +195,8 @@ public static FragmentInstanceContext createFragmentInstanceContext( SessionInfo sessionInfo, IDataRegionForQuery dataRegion, TimePredicate globalTimePredicate, - Map dataNodeQueryContextMap) { + Map dataNodeQueryContextMap, + boolean debug) { FragmentInstanceContext instanceContext = new FragmentInstanceContext( id, @@ -199,14 +204,15 @@ public static FragmentInstanceContext createFragmentInstanceContext( sessionInfo, dataRegion, globalTimePredicate, - dataNodeQueryContextMap); + dataNodeQueryContextMap, + debug); instanceContext.initialize(); instanceContext.start(); return instanceContext; } public static FragmentInstanceContext createFragmentInstanceContextForCompaction(long queryId) { - return new FragmentInstanceContext(queryId, null, null, null); + return new FragmentInstanceContext(queryId, null, null, null, false); } public void setQueryDataSourceType(QueryDataSourceType queryDataSourceType) { @@ -220,7 +226,8 @@ public static FragmentInstanceContext createFragmentInstanceContext( new FragmentInstanceContext( id, stateMachine, - new SessionInfo(1, new UserEntity(666, "test", "127.0.0.1"), ZoneId.systemDefault())); + new SessionInfo(1, new UserEntity(666, "test", "127.0.0.1"), ZoneId.systemDefault()), + false); instanceContext.initialize(); instanceContext.start(); return instanceContext; @@ -236,7 +243,8 @@ public static FragmentInstanceContext createFragmentInstanceContext( id, stateMachine, new SessionInfo(1, new UserEntity(666, "test", "127.0.0.1"), ZoneId.systemDefault()), - memoryReservationManager); + memoryReservationManager, + false); instanceContext.initialize(); instanceContext.start(); return instanceContext; @@ -248,7 +256,9 @@ private FragmentInstanceContext( SessionInfo sessionInfo, IDataRegionForQuery dataRegion, TimePredicate globalTimePredicate, - Map dataNodeQueryContextMap) { + Map dataNodeQueryContextMap, + boolean debug) { + super(debug); this.id = id; this.stateMachine = stateMachine; this.executionEndTime.set(END_TIME_INITIAL_VALUE); @@ -266,7 +276,11 @@ private FragmentInstanceContext( } private FragmentInstanceContext( - FragmentInstanceId id, FragmentInstanceStateMachine stateMachine, SessionInfo sessionInfo) { + FragmentInstanceId id, + FragmentInstanceStateMachine stateMachine, + SessionInfo sessionInfo, + boolean debug) { + super(debug); this.id = id; this.stateMachine = stateMachine; this.executionEndTime.set(END_TIME_INITIAL_VALUE); @@ -281,7 +295,9 @@ private FragmentInstanceContext( FragmentInstanceId id, FragmentInstanceStateMachine stateMachine, SessionInfo sessionInfo, - MemoryReservationManager memoryReservationManager) { + MemoryReservationManager memoryReservationManager, + boolean debug) { + super(debug); this.id = id; this.stateMachine = stateMachine; this.executionEndTime.set(END_TIME_INITIAL_VALUE); @@ -296,7 +312,9 @@ private FragmentInstanceContext( FragmentInstanceStateMachine stateMachine, SessionInfo sessionInfo, IDataRegionForQuery dataRegion, - Filter globalTimeFilter) { + Filter globalTimeFilter, + boolean debug) { + super(debug); this.id = id; this.stateMachine = stateMachine; this.executionEndTime.set(END_TIME_INITIAL_VALUE); @@ -318,7 +336,9 @@ protected FragmentInstanceContext( long queryId, MemoryReservationManager memoryReservationManager, Filter timeFilter, - DataRegion dataRegion) { + DataRegion dataRegion, + boolean debug) { + super(debug); this.queryId = queryId; this.id = null; this.stateMachine = null; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceManager.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceManager.java index 82ec29cc77c54..7b5fbe3757140 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceManager.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceManager.java @@ -159,7 +159,8 @@ public FragmentInstanceInfo execDataQueryFragmentInstance( instance.getSessionInfo(), dataRegion, instance.getGlobalTimePredicate(), - dataNodeQueryContextMap)); + dataNodeQueryContextMap, + instance.isDebug())); try { List driverFactories = @@ -269,7 +270,10 @@ public FragmentInstanceInfo execSchemaQueryFragmentInstance( instanceId, fragmentInstanceId -> createFragmentInstanceContext( - fragmentInstanceId, stateMachine, instance.getSessionInfo())); + fragmentInstanceId, + stateMachine, + instance.getSessionInfo(), + instance.isDebug())); try { List driverFactories = diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/QueryContext.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/QueryContext.java index 2abb5ac517932..f165db769e99f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/QueryContext.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/QueryContext.java @@ -63,7 +63,7 @@ public class QueryContext { protected long queryId; - private boolean debug; + private final boolean debug; private long startTime; private long timeout; @@ -79,10 +79,12 @@ public class QueryContext { protected Set tables; - public QueryContext() {} + public QueryContext(boolean debug) { + this.debug = debug; + } - public QueryContext(long queryId) { - this(queryId, false, System.currentTimeMillis(), 0); + public QueryContext(long queryId, boolean debug) { + this(queryId, debug, System.currentTimeMillis(), 0); } /** Every time we generate the queryContext, register it to queryTimeManager. */ diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/Coordinator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/Coordinator.java index 23241995ad1de..531cfb1e369d8 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/Coordinator.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/Coordinator.java @@ -297,6 +297,7 @@ private ExecutionResult execution( SessionInfo session, String sql, boolean userQuery, + boolean debug, BiFunction iQueryExecutionFactory) { long startTime = System.currentTimeMillis(); QueryId globalQueryId = queryIdGenerator.createNextQueryId(); @@ -314,6 +315,7 @@ private ExecutionResult execution( DataNodeEndPoints.LOCAL_HOST_DATA_BLOCK_ENDPOINT, DataNodeEndPoints.LOCAL_HOST_INTERNAL_ENDPOINT); queryContext.setUserQuery(userQuery); + queryContext.setDebug(debug); IQueryExecution execution = iQueryExecutionFactory.apply(queryContext, startTime); if (execution.isQuery()) { queryExecutionMap.put(queryId, execution); @@ -345,7 +347,15 @@ public ExecutionResult executeForTreeModel( IPartitionFetcher partitionFetcher, ISchemaFetcher schemaFetcher) { return executeForTreeModel( - statement, queryId, session, sql, partitionFetcher, schemaFetcher, Long.MAX_VALUE, false); + statement, + queryId, + session, + sql, + partitionFetcher, + schemaFetcher, + Long.MAX_VALUE, + false, + statement.isDebug()); } public ExecutionResult executeForTreeModel( @@ -356,12 +366,14 @@ public ExecutionResult executeForTreeModel( IPartitionFetcher partitionFetcher, ISchemaFetcher schemaFetcher, long timeOut, - boolean userQuery) { + boolean userQuery, + boolean debug) { return execution( queryId, session, sql, userQuery, + debug, ((queryContext, startTime) -> createQueryExecutionForTreeModel( statement, @@ -425,12 +437,14 @@ public ExecutionResult executeForTableModel( Map, Query> cteQueries, ExplainType explainType, long timeOut, - boolean userQuery) { + boolean userQuery, + boolean debug) { return execution( queryId, session, sql, userQuery, + debug, ((queryContext, startTime) -> { queryContext.setInnerTriggeredQuery(true); queryContext.setCteQueries(cteQueries); @@ -455,12 +469,14 @@ public ExecutionResult executeForTableModel( String sql, Metadata metadata, long timeOut, - boolean userQuery) { + boolean userQuery, + boolean debug) { return execution( queryId, session, sql, userQuery, + debug, ((queryContext, startTime) -> createQueryExecutionForTableModel( statement, @@ -472,6 +488,8 @@ public ExecutionResult executeForTableModel( startTime))); } + /** For compatibility of MQTT and REST, this method should never be called. */ + @Deprecated public ExecutionResult executeForTableModel( Statement statement, SqlParser sqlParser, @@ -486,6 +504,7 @@ public ExecutionResult executeForTableModel( session, sql, false, + false, ((queryContext, startTime) -> createQueryExecutionForTableModel( statement, @@ -497,6 +516,54 @@ public ExecutionResult executeForTableModel( startTime))); } + /** For compatibility of MQTT and REST, this method should never be called. */ + @Deprecated + public ExecutionResult executeForTreeModel( + Statement statement, + long queryId, + SessionInfo sessionInfo, + String s, + IPartitionFetcher partitionFetcher, + ISchemaFetcher schemaFetcher, + long queryTimeoutThreshold, + boolean isUserQuery) { + return executeForTreeModel( + statement, + queryId, + sessionInfo, + s, + partitionFetcher, + schemaFetcher, + queryTimeoutThreshold, + isUserQuery, + false); + } + + /** For compatibility of MQTT and REST, this method should never be called. */ + @Deprecated + public ExecutionResult executeForTableModel( + org.apache.iotdb.db.queryengine.plan.relational.sql.ast.Statement statement, + SqlParser sqlParser, + IClientSession currSession, + Long queryId, + SessionInfo sessionInfo, + String sql, + Metadata metadata, + long queryTimeoutThreshold, + boolean isUserQuery) { + return executeForTableModel( + statement, + sqlParser, + currSession, + queryId, + sessionInfo, + sql, + metadata, + queryTimeoutThreshold, + isUserQuery, + false); + } + private IQueryExecution createQueryExecutionForTableModel( Statement statement, SqlParser sqlParser, diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/load/TreeSchemaAutoCreatorAndVerifier.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/load/TreeSchemaAutoCreatorAndVerifier.java index 29d4f1be07b9e..cf2aedc6c19f2 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/load/TreeSchemaAutoCreatorAndVerifier.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/load/TreeSchemaAutoCreatorAndVerifier.java @@ -373,6 +373,7 @@ private void executeSetDatabaseStatement(Statement statement) loadTsFileAnalyzer.partitionFetcher, loadTsFileAnalyzer.schemaFetcher, IoTDBDescriptor.getInstance().getConfig().getQueryTimeoutThreshold(), + false, false); if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode() && result.status.code != TSStatusCode.DATABASE_ALREADY_EXISTS.getStatusCode() diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/AutoCreateSchemaExecutor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/AutoCreateSchemaExecutor.java index ef0ad80306aa1..2c6ed30cd75ec 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/AutoCreateSchemaExecutor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/AutoCreateSchemaExecutor.java @@ -93,6 +93,7 @@ private ExecutionResult executeStatement(Statement statement, MPPQueryContext co schemaFetcher, // Never timeout for write statement Long.MAX_VALUE, + false, false); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetchExecutor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetchExecutor.java index 4f1429d212146..aad9f50aca0d6 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetchExecutor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetchExecutor.java @@ -98,7 +98,8 @@ private ExecutionResult executionStatement( ClusterPartitionFetcher.getInstance(), schemaFetcher, timeout, - false); + false, + statement.isDebug()); } /** diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java index 52c85334c184c..44b730334abe3 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java @@ -3041,6 +3041,7 @@ public SettableFuture renameLogicalView( ClusterPartitionFetcher.getInstance(), ClusterSchemaFetcher.getInstance(), IoTDBDescriptor.getInstance().getConfig().getQueryTimeoutThreshold(), + false, false); if (executionResult.status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { future.setException( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/distribution/SimpleFragmentParallelPlanner.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/distribution/SimpleFragmentParallelPlanner.java index 25f51f88d9eae..ce953ecac9c77 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/distribution/SimpleFragmentParallelPlanner.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/distribution/SimpleFragmentParallelPlanner.java @@ -144,6 +144,7 @@ private void produceFragmentInstance(PlanFragment fragment) { queryContext.getTimeOut() - (System.currentTimeMillis() - queryContext.getStartTime()), queryContext.getSession(), queryContext.isExplainAnalyze(), + queryContext.isDebug(), fragment.isRoot()); selectExecutorAndHost( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/distribution/WriteFragmentParallelPlanner.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/distribution/WriteFragmentParallelPlanner.java index 1e5c0567825c2..a5d4a33cac011 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/distribution/WriteFragmentParallelPlanner.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/distribution/WriteFragmentParallelPlanner.java @@ -81,7 +81,8 @@ public List parallelPlan() { queryContext.getQueryType(), // Never timeout for write Long.MAX_VALUE, - queryContext.getSession()); + queryContext.getSession(), + false); if (split.getRegionReplicaSet() != null) { final TRegionReplicaSet validSet = topology.getValidatedReplicaSet(split.getRegionReplicaSet()); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/FragmentInstance.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/FragmentInstance.java index 69d2a77fe3e0c..6bf584145cf81 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/FragmentInstance.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/FragmentInstance.java @@ -79,6 +79,8 @@ public class FragmentInstance implements IConsensusRequest { // We need to cache and calculate the statistics of this FragmentInstance if it is. private boolean isExplainAnalyze = false; + private final boolean debug; + // We can add some more params for a specific FragmentInstance // So that we can make different FragmentInstance owns different data range. @@ -88,7 +90,8 @@ public FragmentInstance( TimePredicate globalTimePredicate, QueryType type, long timeOut, - SessionInfo sessionInfo) { + SessionInfo sessionInfo, + boolean debug) { this.fragment = fragment; this.globalTimePredicate = globalTimePredicate; this.id = id; @@ -96,6 +99,7 @@ public FragmentInstance( this.timeOut = timeOut > 0 ? timeOut : CONFIG.getQueryTimeoutThreshold(); this.isRoot = false; this.sessionInfo = sessionInfo; + this.debug = debug; } public FragmentInstance( @@ -106,8 +110,9 @@ public FragmentInstance( long timeOut, SessionInfo sessionInfo, boolean isExplainAnalyze, + boolean debug, boolean isRoot) { - this(fragment, id, globalTimePredicate, type, timeOut, sessionInfo); + this(fragment, id, globalTimePredicate, type, timeOut, sessionInfo, debug); this.isRoot = isRoot; this.isExplainAnalyze = isExplainAnalyze; } @@ -119,8 +124,9 @@ public FragmentInstance( long timeOut, SessionInfo sessionInfo, boolean isExplainAnalyze, + boolean debug, boolean isRoot) { - this(fragment, id, null, type, timeOut, sessionInfo); + this(fragment, id, null, type, timeOut, sessionInfo, debug); this.isRoot = isRoot; this.isExplainAnalyze = isExplainAnalyze; } @@ -132,8 +138,9 @@ public FragmentInstance( QueryType type, long timeOut, SessionInfo sessionInfo, - int dataNodeFINum) { - this(fragment, id, globalTimePredicate, type, timeOut, sessionInfo); + int dataNodeFINum, + boolean debug) { + this(fragment, id, globalTimePredicate, type, timeOut, sessionInfo, debug); this.dataNodeFINum = dataNodeFINum; } @@ -200,6 +207,10 @@ public void setDataNodeFINum(int dataNodeFINum) { this.dataNodeFINum = dataNodeFINum; } + public boolean isDebug() { + return debug; + } + public String toString() { StringBuilder ret = new StringBuilder(); ret.append(String.format("FragmentInstance-%s:", getId())); @@ -229,9 +240,17 @@ public static FragmentInstance deserializeFrom(ByteBuffer buffer) { TimePredicate globalTimePredicate = hasTimePredicate ? TimePredicate.deserialize(buffer) : null; QueryType queryType = QueryType.values()[ReadWriteIOUtils.readInt(buffer)]; int dataNodeFINum = ReadWriteIOUtils.readInt(buffer); + boolean debug = ReadWriteIOUtils.readBool(buffer); FragmentInstance fragmentInstance = new FragmentInstance( - planFragment, id, globalTimePredicate, queryType, timeOut, sessionInfo, dataNodeFINum); + planFragment, + id, + globalTimePredicate, + queryType, + timeOut, + sessionInfo, + dataNodeFINum, + debug); boolean hasHostDataNode = ReadWriteIOUtils.readBool(buffer); fragmentInstance.hostDataNode = hasHostDataNode ? ThriftCommonsSerDeUtils.deserializeTDataNodeLocation(buffer) : null; @@ -255,6 +274,7 @@ public ByteBuffer serializeToByteBuffer() { } ReadWriteIOUtils.write(type.ordinal(), outputStream); ReadWriteIOUtils.write(dataNodeFINum, outputStream); + ReadWriteIOUtils.write(debug, outputStream); ReadWriteIOUtils.write(hostDataNode != null, outputStream); if (hostDataNode != null) { ThriftCommonsSerDeUtils.serializeTDataNodeLocation(hostDataNode, outputStream); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableDeviceSchemaFetcher.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableDeviceSchemaFetcher.java index 638580b50f8e9..c910c8ac6683d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableDeviceSchemaFetcher.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableDeviceSchemaFetcher.java @@ -135,6 +135,7 @@ Map> fetchMissingDeviceSchemaForDataInsertion( LocalExecutionPlanner.getInstance().metadata, // Never timeout for insert Long.MAX_VALUE, + false, false); if (executionResult.status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { @@ -502,7 +503,8 @@ private void fetchMissingDeviceSchemaForQuery( LocalExecutionPlanner.getInstance().metadata, mppQueryContext.getTimeOut() - (System.currentTimeMillis() - mppQueryContext.getStartTime()), - false); + false, + mppQueryContext.isDebug()); if (executionResult.status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { throw new IoTDBRuntimeException( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableDeviceSchemaValidator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableDeviceSchemaValidator.java index 122d352d33293..2331d0e4ffcc4 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableDeviceSchemaValidator.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableDeviceSchemaValidator.java @@ -242,6 +242,7 @@ private void autoCreateOrUpdateDeviceSchema( LocalExecutionPlanner.getInstance().metadata, // Never timeout for write statement Long.MAX_VALUE, + false, false); if (executionResult.status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { throw new IoTDBRuntimeException( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/CteMaterializer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/CteMaterializer.java index 72d231bd60439..4f26c9ada04a0 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/CteMaterializer.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/CteMaterializer.java @@ -142,7 +142,8 @@ public CteDataStore fetchCteQueryResult( context.getCteQueries(), context.getExplainType(), context.getTimeOut(), - false); + false, + context.isDebug()); if (executionResult.status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { return null; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/TableModelQueryFragmentPlanner.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/TableModelQueryFragmentPlanner.java index 40ed57a7fa25a..8a5ce92714031 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/TableModelQueryFragmentPlanner.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/TableModelQueryFragmentPlanner.java @@ -183,6 +183,7 @@ private void produceFragmentInstance( queryContext.getTimeOut() - (System.currentTimeMillis() - queryContext.getStartTime()), queryContext.getSession(), queryContext.isExplainAnalyze(), + queryContext.isDebug(), fragment.isRoot()); selectExecutorAndHost( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/ir/PredicateWithUncorrelatedScalarSubqueryReconstructor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/ir/PredicateWithUncorrelatedScalarSubqueryReconstructor.java index 268de07bdbc55..17bc451c74245 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/ir/PredicateWithUncorrelatedScalarSubqueryReconstructor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/ir/PredicateWithUncorrelatedScalarSubqueryReconstructor.java @@ -153,7 +153,8 @@ public Optional fetchUncorrelatedSubqueryResultForPredicate( context.getCteQueries(), ExplainType.NONE, context.getTimeOut(), - false); + false, + q.isDebug()); // This may occur when the subquery cannot be executed in advance (for example, with // correlated scalar subqueries). diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/Statement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/Statement.java index 7ba19b972a29d..6548748f7c159 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/Statement.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/Statement.java @@ -25,6 +25,7 @@ import java.util.List; public abstract class Statement extends Node { + private boolean debug; protected Statement(final @Nullable NodeLocation location) { super(location); @@ -56,4 +57,12 @@ public boolean shouldSplit() { public List getSubStatements() { return Collections.emptyList(); } + + public void setDebug(boolean debug) { + this.debug = debug; + } + + public boolean isDebug() { + return debug; + } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/parser/AstBuilder.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/parser/AstBuilder.java index 83105468a0204..f46b356423ddc 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/parser/AstBuilder.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/parser/AstBuilder.java @@ -354,7 +354,9 @@ public class AstBuilder extends RelationalSqlBaseVisitor { @Override public Node visitSingleStatement(RelationalSqlParser.SingleStatementContext ctx) { - return visit(ctx.statement()); + Statement statement = (Statement) visit(ctx.statement()); + statement.setDebug(ctx.DEBUG() != null); + return statement; } @Override diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/load/LoadTsFileScheduler.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/load/LoadTsFileScheduler.java index cf7ab8faeddaf..98d683284119c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/load/LoadTsFileScheduler.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/load/LoadTsFileScheduler.java @@ -347,7 +347,8 @@ private boolean dispatchOnePieceNode( null, queryContext.getQueryType(), queryContext.getTimeOut() - (System.currentTimeMillis() - queryContext.getStartTime()), - queryContext.getSession()); + queryContext.getSession(), + queryContext.isDebug()); instance.setExecutorAndHost(new StorageExecutor(replicaSet)); Future dispatchResultFuture = dispatcher.dispatch(null, Collections.singletonList(instance)); @@ -500,7 +501,8 @@ private boolean loadLocally(LoadSingleTsFileNode node) throws IoTDBException { queryContext.getQueryType(), queryContext.getTimeOut() - (System.currentTimeMillis() - queryContext.getStartTime()), - queryContext.getSession()); + queryContext.getSession(), + queryContext.isDebug()); instance.setExecutorAndHost(new StorageExecutor(node.getLocalRegionReplicaSet())); dispatcher.dispatchLocally(instance); } catch (FragmentInstanceDispatchException e) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/active/ActiveLoadTsFileLoader.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/active/ActiveLoadTsFileLoader.java index 0e565afd70cd3..d0be2ead5cb22 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/active/ActiveLoadTsFileLoader.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/active/ActiveLoadTsFileLoader.java @@ -257,7 +257,8 @@ private TSStatus executeStatement(final Statement statement, final IClientSessio ClusterPartitionFetcher.getInstance(), ClusterSchemaFetcher.getInstance(), IOTDB_CONFIG.getQueryTimeoutThreshold(), - false) + false, + statement.isDebug()) .status; } finally { SESSION_MANAGER.removeCurrSession(); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/converter/LoadTsFileDataTypeConverter.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/converter/LoadTsFileDataTypeConverter.java index b45c05a3f3077..383ac4a306497 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/converter/LoadTsFileDataTypeConverter.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/converter/LoadTsFileDataTypeConverter.java @@ -178,6 +178,7 @@ private TSStatus executeForTreeModel(final Statement statement) { ClusterPartitionFetcher.getInstance(), ClusterSchemaFetcher.getInstance(), IoTDBDescriptor.getInstance().getConfig().getQueryTimeoutThreshold(), + false, false) .status; } finally { diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/FragmentInstanceSerdeTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/FragmentInstanceSerdeTest.java index 711e67682ca1f..3596ea550c774 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/FragmentInstanceSerdeTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/FragmentInstanceSerdeTest.java @@ -76,7 +76,8 @@ public void testSerializeAndDeserializeForTree1() throws IllegalPathException { new TreeModelTimePredicate(ExpressionFactory.groupByTime(1, 2, 3, 4)), QueryType.READ, config.getQueryTimeoutThreshold(), - sessionInfo); + sessionInfo, + false); // test FI with StorageExecutor TRegionReplicaSet regionReplicaSet = new TRegionReplicaSet( @@ -118,7 +119,8 @@ public void testSerializeAndDeserializeWithNullFilter() throws IllegalPathExcept null, QueryType.READ, config.getQueryTimeoutThreshold(), - sessionInfo); + sessionInfo, + false); TRegionReplicaSet regionReplicaSet = new TRegionReplicaSet( new TConsensusGroupId(TConsensusGroupType.DataRegion, 1), diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/planner/CteMaterializerTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/planner/CteMaterializerTest.java index 3394b1fbb58cc..3ea888057ccb7 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/planner/CteMaterializerTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/planner/CteMaterializerTest.java @@ -116,7 +116,8 @@ public static void prepareEnv() { Mockito.anyMap(), // Map, CteDataStore> Mockito.any(), // ExplainType Mockito.anyLong(), // timeOut - Mockito.anyBoolean())) // userQuery + Mockito.anyBoolean(), // userQuery + Mockito.anyBoolean())) // debug .thenReturn(mockResult); } diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/planner/CteSubqueryTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/planner/CteSubqueryTest.java index bff1d7c93dd02..25b00fd66acdf 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/planner/CteSubqueryTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/planner/CteSubqueryTest.java @@ -139,7 +139,8 @@ private void mockExecuteForTableModel() throws IoTDBException { Mockito.anyMap(), // Map, CteDataStore> Mockito.any(), // ExplainType Mockito.anyLong(), // timeOut - Mockito.anyBoolean())) // userQuery + Mockito.anyBoolean(), // userQuery + Mockito.anyBoolean())) // debug .thenReturn(mockResult); // Create QueryExecution mock diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/MemChunkDeserializeTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/MemChunkDeserializeTest.java index d0edfdab33002..e043da9125134 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/MemChunkDeserializeTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/MemChunkDeserializeTest.java @@ -301,7 +301,7 @@ private ReadOnlyMemChunk getReadOnlyChunk(WritableMemChunk memChunk, TSDataType memTableMap.put(deviceID, memChunkGroup); IMemTable memTable = new PrimitiveMemTable(storageGroup, dataRegionId, memTableMap); - QueryContext context = new QueryContext(); + QueryContext context = new QueryContext(false); NonAlignedFullPath nonAlignedFullPath = new NonAlignedFullPath( deviceID, @@ -325,7 +325,7 @@ private ReadOnlyMemChunk getAlignedReadOnlyChunk( memTableMap.put(deviceID, memChunkGroup); IMemTable memTable = new PrimitiveMemTable(storageGroup, dataRegionId, memTableMap); - QueryContext context = new QueryContext(); + QueryContext context = new QueryContext(false); AlignedFullPath alignedFullPath = new AlignedFullPath(deviceID, measurementList, schemaList); return memTable.query(context, alignedFullPath, Long.MIN_VALUE, null, null); } diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/PrimitiveMemTableTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/PrimitiveMemTableTest.java index b16e20d4f857b..7e77abca29e18 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/PrimitiveMemTableTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/PrimitiveMemTableTest.java @@ -142,7 +142,7 @@ public void memSeriesSortIteratorTest() throws IOException, QueryProcessExceptio tvListQueryMap.put(series.getWorkingTVList(), series.getWorkingTVList().rowCount()); ReadOnlyMemChunk readableChunk = new ReadOnlyMemChunk( - new QueryContext(), "s1", dataType, TSEncoding.PLAIN, tvListQueryMap, null, null); + new QueryContext(false), "s1", dataType, TSEncoding.PLAIN, tvListQueryMap, null, null); IPointReader it = readableChunk.getPointReader(); int i = 0; while (it.hasNextTimeValuePair()) { @@ -190,7 +190,7 @@ public void testWriteDuringPrepareTVListAndActualQueryExecution() measurementSchemas)); ReadOnlyMemChunk readOnlyMemChunk = resourcesByPathUtils.getReadOnlyMemChunkFromMemTable( - new QueryContext(1), memTable, null, Long.MAX_VALUE, null); + new QueryContext(1, false), memTable, null, Long.MAX_VALUE, null); for (int i = 1; i <= 50; i++) { memTable.writeAlignedRow( @@ -259,7 +259,7 @@ public void simpleTest() throws IOException, QueryProcessException, MetadataExce } ReadOnlyMemChunk memChunk = - memTable.query(new QueryContext(), nonAlignedFullPath, Long.MIN_VALUE, null, null); + memTable.query(new QueryContext(false), nonAlignedFullPath, Long.MIN_VALUE, null, null); IPointReader iterator = memChunk.getPointReader(); for (int i = 0; i < dataSize; i++) { iterator.hasNextTimeValuePair(); @@ -355,7 +355,7 @@ public void queryWithDeletionTest() throws IOException, QueryProcessException, M modsToMemtable.add(new Pair<>(deletion, memTable)); ReadOnlyMemChunk memChunk = memTable.query( - new QueryContext(), nonAlignedFullPath, Long.MIN_VALUE, modsToMemtable, null); + new QueryContext(false), nonAlignedFullPath, Long.MIN_VALUE, modsToMemtable, null); IPointReader iterator = memChunk.getPointReader(); int cnt = 0; while (iterator.hasNextTimeValuePair()) { @@ -400,7 +400,8 @@ public void queryAlignChuckWithDeletionTest() new TreeDeletionEntry(new MeasurementPath(deviceID, measurementId[0]), 10, dataSize); modsToMemtable.add(new Pair<>(deletion, memTable)); ReadOnlyMemChunk memChunk = - memTable.query(new QueryContext(), alignedFullPath, Long.MIN_VALUE, modsToMemtable, null); + memTable.query( + new QueryContext(false), alignedFullPath, Long.MIN_VALUE, modsToMemtable, null); IPointReader iterator = memChunk.getPointReader(); int cnt = 0; while (iterator.hasNextTimeValuePair()) { @@ -439,7 +440,9 @@ private void write( CompressionType.UNCOMPRESSED, Collections.emptyMap())); IPointReader tvPair = - memTable.query(new QueryContext(), fullPath, Long.MIN_VALUE, null, null).getPointReader(); + memTable + .query(new QueryContext(false), fullPath, Long.MIN_VALUE, null, null) + .getPointReader(); Arrays.sort(ret); TimeValuePair last = null; for (int i = 0; i < ret.length; i++) { @@ -488,7 +491,7 @@ private void writeVector(IMemTable memTable) Collections.emptyMap()))); IPointReader tvPair = memTable - .query(new QueryContext(), tmpAlignedFullPath, Long.MIN_VALUE, null, null) + .query(new QueryContext(false), tmpAlignedFullPath, Long.MIN_VALUE, null, null) .getPointReader(); for (int i = 0; i < 100; i++) { tvPair.hasNextTimeValuePair(); @@ -517,7 +520,7 @@ private void writeVector(IMemTable memTable) tvPair = memTable - .query(new QueryContext(), tmpAlignedFullPath, Long.MIN_VALUE, null, null) + .query(new QueryContext(false), tmpAlignedFullPath, Long.MIN_VALUE, null, null) .getPointReader(); for (int i = 0; i < 100; i++) { tvPair.hasNextTimeValuePair(); diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/chunk/MemAlignedChunkLoaderTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/chunk/MemAlignedChunkLoaderTest.java index e8d16912896dc..72406a2e4a74b 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/chunk/MemAlignedChunkLoaderTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/chunk/MemAlignedChunkLoaderTest.java @@ -63,7 +63,7 @@ public class MemAlignedChunkLoaderTest { public void testMemAlignedChunkLoader() throws IOException { AlignedReadOnlyMemChunk chunk = Mockito.mock(AlignedReadOnlyMemChunk.class); ChunkMetadata chunkMetadata = Mockito.mock(ChunkMetadata.class); - QueryContext ctx = new QueryContext(); + QueryContext ctx = new QueryContext(false); MemAlignedChunkLoader memAlignedChunkLoader = new MemAlignedChunkLoader(ctx, chunk); try { diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/chunk/MemChunkLoaderTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/chunk/MemChunkLoaderTest.java index 1a3ccc21bcc77..986b88ec11269 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/chunk/MemChunkLoaderTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/chunk/MemChunkLoaderTest.java @@ -75,7 +75,7 @@ public void testBooleanMemChunkLoader() throws IOException { Mockito.when(chunk.getMemPointIterator()).thenReturn(timeValuePairIterator); ChunkMetadata chunkMetadata = Mockito.mock(ChunkMetadata.class); - MemChunkLoader memChunkLoader = new MemChunkLoader(new QueryContext(), chunk); + MemChunkLoader memChunkLoader = new MemChunkLoader(new QueryContext(false), chunk); try { memChunkLoader.loadChunk(chunkMetadata); fail(); @@ -155,7 +155,7 @@ public void testInt32MemChunkLoader() throws IOException { Mockito.when(chunk.getMemPointIterator()).thenReturn(timeValuePairIterator); ChunkMetadata chunkMetadata = Mockito.mock(ChunkMetadata.class); - MemChunkLoader memChunkLoader = new MemChunkLoader(new QueryContext(), chunk); + MemChunkLoader memChunkLoader = new MemChunkLoader(new QueryContext(false), chunk); try { memChunkLoader.loadChunk(chunkMetadata); fail(); @@ -235,7 +235,7 @@ public void testInt64MemChunkLoader() throws IOException { Mockito.when(chunk.getMemPointIterator()).thenReturn(timeValuePairIterator); ChunkMetadata chunkMetadata = Mockito.mock(ChunkMetadata.class); - MemChunkLoader memChunkLoader = new MemChunkLoader(new QueryContext(), chunk); + MemChunkLoader memChunkLoader = new MemChunkLoader(new QueryContext(false), chunk); try { memChunkLoader.loadChunk(chunkMetadata); fail(); @@ -315,7 +315,7 @@ public void testFloatMemChunkLoader() throws IOException { Mockito.when(chunk.getMemPointIterator()).thenReturn(timeValuePairIterator); ChunkMetadata chunkMetadata = Mockito.mock(ChunkMetadata.class); - MemChunkLoader memChunkLoader = new MemChunkLoader(new QueryContext(), chunk); + MemChunkLoader memChunkLoader = new MemChunkLoader(new QueryContext(false), chunk); try { memChunkLoader.loadChunk(chunkMetadata); fail(); @@ -395,7 +395,7 @@ public void testDoubleMemChunkLoader() throws IOException { Mockito.when(chunk.getMemPointIterator()).thenReturn(timeValuePairIterator); ChunkMetadata chunkMetadata = Mockito.mock(ChunkMetadata.class); - MemChunkLoader memChunkLoader = new MemChunkLoader(new QueryContext(), chunk); + MemChunkLoader memChunkLoader = new MemChunkLoader(new QueryContext(false), chunk); try { memChunkLoader.loadChunk(chunkMetadata); fail(); @@ -475,7 +475,7 @@ public void testTextMemChunkLoader() throws IOException { Mockito.when(chunk.getMemPointIterator()).thenReturn(timeValuePairIterator); ChunkMetadata chunkMetadata = Mockito.mock(ChunkMetadata.class); - MemChunkLoader memChunkLoader = new MemChunkLoader(new QueryContext(), chunk); + MemChunkLoader memChunkLoader = new MemChunkLoader(new QueryContext(false), chunk); try { memChunkLoader.loadChunk(chunkMetadata); fail(); diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/file/TsFilePlanRedoerTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/file/TsFilePlanRedoerTest.java index 6c02cc4ba1885..a86f814041afd 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/file/TsFilePlanRedoerTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/file/TsFilePlanRedoerTest.java @@ -162,7 +162,7 @@ public void testRedoInsertRowPlan() throws Exception { new NonAlignedFullPath( DEVICE2_NAME, new MeasurementSchema("s1", TSDataType.FLOAT, TSEncoding.RLE)); ReadOnlyMemChunk memChunk = - recoveryMemTable.query(new QueryContext(), fullPath, Long.MIN_VALUE, null, null); + recoveryMemTable.query(new QueryContext(false), fullPath, Long.MIN_VALUE, null, null); IPointReader iterator = memChunk.getPointReader(); time = 5; while (iterator.hasNextTimeValuePair()) { @@ -176,7 +176,8 @@ public void testRedoInsertRowPlan() throws Exception { fullPath = new NonAlignedFullPath( DEVICE2_NAME, new MeasurementSchema("s2", TSDataType.DOUBLE, TSEncoding.RLE)); - memChunk = recoveryMemTable.query(new QueryContext(), fullPath, Long.MIN_VALUE, null, null); + memChunk = + recoveryMemTable.query(new QueryContext(false), fullPath, Long.MIN_VALUE, null, null); iterator = memChunk.getPointReader(); time = 5; while (iterator.hasNextTimeValuePair()) { @@ -262,7 +263,7 @@ public void testRedoInsertAlignedRowPlan() throws Exception { new MeasurementSchema("s4", TSDataType.FLOAT, TSEncoding.RLE), new MeasurementSchema("s5", TSDataType.TEXT, TSEncoding.PLAIN))); ReadOnlyMemChunk memChunk = - recoveryMemTable.query(new QueryContext(), fullPath, Long.MIN_VALUE, null, null); + recoveryMemTable.query(new QueryContext(false), fullPath, Long.MIN_VALUE, null, null); IPointReader iterator = memChunk.getPointReader(); int time = 6; while (iterator.hasNextTimeValuePair()) { @@ -342,7 +343,7 @@ public void testRedoInsertTabletPlan() throws Exception { new NonAlignedFullPath( DEVICE1_NAME, new MeasurementSchema("s1", TSDataType.INT32, TSEncoding.RLE)); ReadOnlyMemChunk memChunk = - recoveryMemTable.query(new QueryContext(), fullPath, Long.MIN_VALUE, null, null); + recoveryMemTable.query(new QueryContext(false), fullPath, Long.MIN_VALUE, null, null); IPointReader iterator = memChunk.getPointReader(); int time = 5; while (iterator.hasNextTimeValuePair()) { @@ -356,7 +357,8 @@ public void testRedoInsertTabletPlan() throws Exception { fullPath = new NonAlignedFullPath( DEVICE1_NAME, new MeasurementSchema("s2", TSDataType.INT64, TSEncoding.RLE)); - memChunk = recoveryMemTable.query(new QueryContext(), fullPath, Long.MIN_VALUE, null, null); + memChunk = + recoveryMemTable.query(new QueryContext(false), fullPath, Long.MIN_VALUE, null, null); iterator = memChunk.getPointReader(); time = 5; while (iterator.hasNextTimeValuePair()) { @@ -455,7 +457,7 @@ public void testRedoInsertAlignedTabletPlan() throws Exception { new MeasurementSchema("s4", TSDataType.FLOAT, TSEncoding.RLE), new MeasurementSchema("s5", TSDataType.TEXT, TSEncoding.PLAIN))); ReadOnlyMemChunk memChunk = - recoveryMemTable.query(new QueryContext(), fullPath, Long.MIN_VALUE, null, null); + recoveryMemTable.query(new QueryContext(false), fullPath, Long.MIN_VALUE, null, null); IPointReader iterator = memChunk.getPointReader(); int time = 6; while (iterator.hasNextTimeValuePair()) { @@ -577,13 +579,14 @@ public void testRedoOverLapPlanIntoUnseqFile() throws Exception { new NonAlignedFullPath( DEVICE1_NAME, new MeasurementSchema("s1", TSDataType.INT32, TSEncoding.RLE)); ReadOnlyMemChunk memChunk = - recoveryMemTable.query(new QueryContext(), fullPath, Long.MIN_VALUE, null, null); + recoveryMemTable.query(new QueryContext(false), fullPath, Long.MIN_VALUE, null, null); assertTrue(memChunk == null || memChunk.isEmpty()); // check d1.s2 fullPath = new NonAlignedFullPath( DEVICE1_NAME, new MeasurementSchema("s2", TSDataType.INT64, TSEncoding.RLE)); - memChunk = recoveryMemTable.query(new QueryContext(), fullPath, Long.MIN_VALUE, null, null); + memChunk = + recoveryMemTable.query(new QueryContext(false), fullPath, Long.MIN_VALUE, null, null); assertTrue(memChunk == null || memChunk.isEmpty()); } @@ -788,7 +791,7 @@ public void testRedoAlignedInsertAfterDeleteTimeseries() throws Exception { new MeasurementSchema("s4", TSDataType.FLOAT, TSEncoding.RLE), new MeasurementSchema("s5", TSDataType.TEXT, TSEncoding.PLAIN))); ReadOnlyMemChunk memChunk = - recoveryMemTable.query(new QueryContext(), fullPath, Long.MIN_VALUE, null, null); + recoveryMemTable.query(new QueryContext(false), fullPath, Long.MIN_VALUE, null, null); IPointReader iterator = memChunk.getPointReader(); time = 6; while (iterator.hasNextTimeValuePair()) { diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java index ebd4d3b7ae036..91149d027fb9d 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java @@ -84,7 +84,7 @@ public class EnvironmentUtils { private static final TierManager tierManager = TierManager.getInstance(); public static long TEST_QUERY_JOB_ID = 1; - public static QueryContext TEST_QUERY_CONTEXT = new QueryContext(TEST_QUERY_JOB_ID); + public static QueryContext TEST_QUERY_CONTEXT = new QueryContext(TEST_QUERY_JOB_ID, false); public static FragmentInstanceContext TEST_QUERY_FI_CONTEXT = FragmentInstanceContext.createFragmentInstanceContextForCompaction(TEST_QUERY_JOB_ID); @@ -278,7 +278,7 @@ public static void envSetUp() { } TEST_QUERY_JOB_ID = QueryResourceManager.getInstance().assignQueryId(); - TEST_QUERY_CONTEXT = new QueryContext(TEST_QUERY_JOB_ID); + TEST_QUERY_CONTEXT = new QueryContext(TEST_QUERY_JOB_ID, false); } private static void createAllDir() { diff --git a/iotdb-core/relational-grammar/src/main/antlr4/org/apache/iotdb/db/relational/grammar/sql/RelationalSql.g4 b/iotdb-core/relational-grammar/src/main/antlr4/org/apache/iotdb/db/relational/grammar/sql/RelationalSql.g4 index 07186fd422219..08a8b4c2e82a1 100644 --- a/iotdb-core/relational-grammar/src/main/antlr4/org/apache/iotdb/db/relational/grammar/sql/RelationalSql.g4 +++ b/iotdb-core/relational-grammar/src/main/antlr4/org/apache/iotdb/db/relational/grammar/sql/RelationalSql.g4 @@ -26,7 +26,7 @@ tokens { } singleStatement - : statement EOF + : DEBUG? statement EOF ; @@ -1454,7 +1454,7 @@ nonReserved : ABSENT | ADD | ADMIN | AFTER | ALL | ANALYZE | ANY | ARRAY | ASC | AT | ATTRIBUTE | AUDIT | AUTHORIZATION | AVAILABLE | BEGIN | BERNOULLI | BOTH | CACHE | CALL | CALLED | CASCADE | CATALOG | CATALOGS | CHAR | CHARACTER | CHARSET | CLEAR | CLUSTER | CLUSTERID | COLUMN | COLUMNS | COMMENT | COMMIT | COMMITTED | CONDITION | CONDITIONAL | CONFIGNODES | CONFIGNODE | CONFIGURATION | CONNECTOR | CONSTANT | COPARTITION | COUNT | CURRENT - | DATA | DATABASE | DATABASES | DATANODE | DATANODES | DATASET | DATE | DAY | DECLARE | DEFAULT | DEFINE | DEFINER | DENY | DESC | DESCRIPTOR | DETAILS| DETERMINISTIC | DEVICES | DISTRIBUTED | DO | DOUBLE + | DATA | DATABASE | DATABASES | DATANODE | DATANODES | DATASET | DATE | DAY | DEBUG | DECLARE | DEFAULT | DEFINE | DEFINER | DENY | DESC | DESCRIPTOR | DETAILS| DETERMINISTIC | DEVICES | DISTRIBUTED | DO | DOUBLE | ELSEIF | EMPTY | ENCODING | ERROR | EXCLUDING | EXPLAIN | EXTRACTOR | FETCH | FIELD | FILTER | FINAL | FIRST | FLUSH | FOLLOWING | FORCEDLY | FORMAT | FUNCTION | FUNCTIONS | GRACE | GRANT | GRANTED | GRANTS | GRAPHVIZ | GROUPS @@ -1561,6 +1561,7 @@ DATE_BIN: 'DATE_BIN'; DATE_BIN_GAPFILL: 'DATE_BIN_GAPFILL'; DAY: 'DAY' | 'D'; DEALLOCATE: 'DEALLOCATE'; +DEBUG: 'DEBUG'; DECLARE: 'DECLARE'; DEFAULT: 'DEFAULT'; DEFINE: 'DEFINE';