[GitHub] [incubator-iotdb] jt2594838 commented on a change in pull request #738: [IOTDB-396] New query clause: disable align

2020-01-14 Thread GitBox
jt2594838 commented on a change in pull request #738: [IOTDB-396] New query 
clause: disable align
URL: https://github.com/apache/incubator-iotdb/pull/738#discussion_r366273177
 
 

 ##
 File path: 
jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBNonAlignQueryResultSet.java
 ##
 @@ -0,0 +1,1289 @@
+/*
+ * 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.jdbc;
+
+import org.apache.iotdb.rpc.IoTDBRPCException;
+import org.apache.iotdb.rpc.RpcUtils;
+import org.apache.iotdb.service.rpc.thrift.*;
+import org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.utils.BytesUtils;
+import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
+import org.apache.thrift.TException;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.net.URL;
+import java.nio.ByteBuffer;
+import java.sql.Date;
+import java.sql.*;
+import java.util.*;
+
+public class IoTDBNonAlignQueryResultSet implements ResultSet {
+
+  private static final String TIMESTAMP_STR = "Time";
+  private static final int TIMESTAMP_STR_LENGTH = 4;
+  private static final int START_INDEX = 2;
+  private static final String VALUE_IS_NULL = "The value got by %s (column 
name) is NULL.";
+  private static final String EMPTY_STR = "";
+  private Statement statement = null;
+  private String sql;
+  private SQLWarning warningChain = null;
+  private boolean isClosed = false;
+  private TSIService.Iface client = null;
+  private List columnInfoList; // no deduplication
+  private List columnTypeList; // no deduplication
+  private Map columnInfoMap; // used because the server 
returns deduplicated columns
+  private List columnTypeDeduplicatedList; // deduplicated from 
columnTypeList
+  private int fetchSize;
+  private boolean emptyResultSet = false;
+
+  private TSQueryNonAlignDataSet tsQueryNonAlignDataSet = null;
+  private byte[][] times; // used for disable align
+  private byte[][] values; // used to cache the current row record value
+
+  private long sessionId;
+  private long queryId;
+  private boolean ignoreTimeStamp = false;
+
+  public IoTDBNonAlignQueryResultSet() {
+// do nothing
+  }
+
+  // for disable align clause
+  public IoTDBNonAlignQueryResultSet(Statement statement, List 
columnNameList,
+ List columnTypeList, boolean 
ignoreTimeStamp, TSIService.Iface client,
+ String sql, long queryId, long sessionId, 
TSQueryNonAlignDataSet dataset)
+  throws SQLException {
+this.statement = statement;
+this.fetchSize = statement.getFetchSize();
+this.columnTypeList = columnTypeList;
+
+times = new byte[columnNameList.size()][Long.BYTES];
+values = new byte[columnNameList.size()][];
+
+this.columnInfoList = new ArrayList<>();
+// deduplicate and map
+this.columnInfoMap = new HashMap<>();
+this.columnInfoMap.put(TIMESTAMP_STR, 1);
+this.columnTypeDeduplicatedList = new ArrayList<>();
+int index = START_INDEX;
+for (int i = 0; i < columnNameList.size(); i++) {
+  String name = columnNameList.get(i);
+  columnInfoList.add(TIMESTAMP_STR + name);
+  columnInfoList.add(name);
+  if (!columnInfoMap.containsKey(name)) {
+columnInfoMap.put(name, index++);
+columnTypeDeduplicatedList.add(columnTypeList.get(i));
+  }
+}
+
+this.ignoreTimeStamp = ignoreTimeStamp;
+this.client = client;
+this.sql = sql;
+this.queryId = queryId;
+this.tsQueryNonAlignDataSet = dataset;
+this.sessionId = sessionId;
+  }
+
+  @Override
+  public boolean isWrapperFor(Class iface) throws SQLException {
+throw new SQLException(Constant.METHOD_NOT_SUPPORTED);
+  }
+
+  @Override
+  public  T unwrap(Class iface) throws SQLException {
+throw new SQLException(Constant.METHOD_NOT_SUPPORTED);
+  }
+
+  @Override
+  public boolean absolute(int arg0) throws SQLException {
+throw new SQLException(Constant.METHOD_NOT_SUPPORTED);
+  }
+
+  @Override
+  public void afterLast() throws SQLException {
+throw new 

[GitHub] [incubator-iotdb] jt2594838 commented on a change in pull request #738: [IOTDB-396] New query clause: disable align

2020-01-14 Thread GitBox
jt2594838 commented on a change in pull request #738: [IOTDB-396] New query 
clause: disable align
URL: https://github.com/apache/incubator-iotdb/pull/738#discussion_r366224122
 
 

 ##
 File path: example/jdbc/src/main/java/org/apache/iotdb/JDBCExample.java
 ##
 @@ -1,21 +1,3 @@
-/*
- * 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;
 
 Review comment:
   Why remove the license?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-iotdb] jt2594838 commented on a change in pull request #738: [IOTDB-396] New query clause: disable align

2020-01-14 Thread GitBox
jt2594838 commented on a change in pull request #738: [IOTDB-396] New query 
clause: disable align
URL: https://github.com/apache/incubator-iotdb/pull/738#discussion_r366227391
 
 

 ##
 File path: 
jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBNonAlignQueryResultSet.java
 ##
 @@ -0,0 +1,1289 @@
+/*
+ * 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.jdbc;
+
+import org.apache.iotdb.rpc.IoTDBRPCException;
+import org.apache.iotdb.rpc.RpcUtils;
+import org.apache.iotdb.service.rpc.thrift.*;
+import org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.utils.BytesUtils;
+import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
+import org.apache.thrift.TException;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.net.URL;
+import java.nio.ByteBuffer;
+import java.sql.Date;
+import java.sql.*;
+import java.util.*;
+
+public class IoTDBNonAlignQueryResultSet implements ResultSet {
+
+  private static final String TIMESTAMP_STR = "Time";
+  private static final int TIMESTAMP_STR_LENGTH = 4;
+  private static final int START_INDEX = 2;
+  private static final String VALUE_IS_NULL = "The value got by %s (column 
name) is NULL.";
+  private static final String EMPTY_STR = "";
+  private Statement statement = null;
+  private String sql;
+  private SQLWarning warningChain = null;
+  private boolean isClosed = false;
+  private TSIService.Iface client = null;
+  private List columnInfoList; // no deduplication
+  private List columnTypeList; // no deduplication
+  private Map columnInfoMap; // used because the server 
returns deduplicated columns
 
 Review comment:
   It would be more clear to call it "columnBufferPositionMap" or 
"columnOrdinalMap" or something else.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-iotdb] jt2594838 commented on a change in pull request #738: [IOTDB-396] New query clause: disable align

2020-01-14 Thread GitBox
jt2594838 commented on a change in pull request #738: [IOTDB-396] New query 
clause: disable align
URL: https://github.com/apache/incubator-iotdb/pull/738#discussion_r366295291
 
 

 ##
 File path: server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
 ##
 @@ -802,23 +781,44 @@ public TSFetchResultsResp fetchResults(TSFetchResultsReq 
req) {
 
   if (!queryId2DataSet.containsKey(req.queryId)) {
 return getTSFetchResultsResp(
-getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR, "Has not executed 
query"));
+getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR, "Has not 
executed query"));
   }
 
   QueryDataSet queryDataSet = queryId2DataSet.get(req.queryId);
-  TSQueryDataSet result = fillRpcReturnData(req.fetchSize, queryDataSet,
-  sessionIdUsernameMap.get(req.sessionId));
-
-  boolean hasResultSet = result.bufferForTime().limit() != 0;
-  if (!hasResultSet) {
-queryId2DataSet.remove(req.queryId);
+  if (req.isAlign) {
+TSQueryDataSet result = fillRpcReturnData(req.fetchSize, queryDataSet,
+sessionIdUsernameMap.get(req.sessionId));
+boolean hasResultSet = result.bufferForTime().limit() != 0;
+if (!hasResultSet) {
+  queryId2DataSet.remove(req.queryId);
 
 Review comment:
   It may be better to also end this query in case anyone forgets to close the 
resultset.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-iotdb] jt2594838 commented on a change in pull request #738: [IOTDB-396] New query clause: disable align

2020-01-14 Thread GitBox
jt2594838 commented on a change in pull request #738: [IOTDB-396] New query 
clause: disable align
URL: https://github.com/apache/incubator-iotdb/pull/738#discussion_r366219463
 
 

 ##
 File path: client/src/main/java/org/apache/iotdb/client/AbstractClient.java
 ##
 @@ -297,13 +324,24 @@ private static void printColumnData(ResultSetMetaData 
resultSetMetaData, ResultS
 printf(formatValue, "null");
 handleException(e);
   }
-} else {
+} 
+else if (align) {
   if (i == 2 && 
resultSetMetaData.getColumnName(2).equals(GROUPBY_DEVICE_COLUMN_NAME)) {
 printf("%" + deviceColumnLength + "s|", res.getString(i));
   } else {
 printf(formatValue, res.getString(i));
   }
 }
+// for disable align clause
+else {
+  if (res.getString(i * 2 - 2) == null) {
 
 Review comment:
   These "2"s appear frequently, I suggest replace them with a constant and add 
a comment for the constant to explain what column is skipped.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-iotdb] jt2594838 commented on a change in pull request #738: [IOTDB-396] New query clause: disable align

2020-01-14 Thread GitBox
jt2594838 commented on a change in pull request #738: [IOTDB-396] New query 
clause: disable align
URL: https://github.com/apache/incubator-iotdb/pull/738#discussion_r366229362
 
 

 ##
 File path: 
jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBNonAlignQueryResultSet.java
 ##
 @@ -0,0 +1,1289 @@
+/*
+ * 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.jdbc;
+
+import org.apache.iotdb.rpc.IoTDBRPCException;
+import org.apache.iotdb.rpc.RpcUtils;
+import org.apache.iotdb.service.rpc.thrift.*;
+import org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.utils.BytesUtils;
+import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
+import org.apache.thrift.TException;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.net.URL;
+import java.nio.ByteBuffer;
+import java.sql.Date;
+import java.sql.*;
+import java.util.*;
+
+public class IoTDBNonAlignQueryResultSet implements ResultSet {
+
+  private static final String TIMESTAMP_STR = "Time";
+  private static final int TIMESTAMP_STR_LENGTH = 4;
+  private static final int START_INDEX = 2;
+  private static final String VALUE_IS_NULL = "The value got by %s (column 
name) is NULL.";
+  private static final String EMPTY_STR = "";
+  private Statement statement = null;
+  private String sql;
+  private SQLWarning warningChain = null;
+  private boolean isClosed = false;
+  private TSIService.Iface client = null;
+  private List columnInfoList; // no deduplication
+  private List columnTypeList; // no deduplication
+  private Map columnInfoMap; // used because the server 
returns deduplicated columns
+  private List columnTypeDeduplicatedList; // deduplicated from 
columnTypeList
+  private int fetchSize;
+  private boolean emptyResultSet = false;
+
+  private TSQueryNonAlignDataSet tsQueryNonAlignDataSet = null;
+  private byte[][] times; // used for disable align
+  private byte[][] values; // used to cache the current row record value
+
+  private long sessionId;
+  private long queryId;
+  private boolean ignoreTimeStamp = false;
+
+  public IoTDBNonAlignQueryResultSet() {
+// do nothing
+  }
+
+  // for disable align clause
+  public IoTDBNonAlignQueryResultSet(Statement statement, List 
columnNameList,
+ List columnTypeList, boolean 
ignoreTimeStamp, TSIService.Iface client,
+ String sql, long queryId, long sessionId, 
TSQueryNonAlignDataSet dataset)
+  throws SQLException {
+this.statement = statement;
+this.fetchSize = statement.getFetchSize();
+this.columnTypeList = columnTypeList;
+
+times = new byte[columnNameList.size()][Long.BYTES];
+values = new byte[columnNameList.size()][];
+
+this.columnInfoList = new ArrayList<>();
+// deduplicate and map
+this.columnInfoMap = new HashMap<>();
+this.columnInfoMap.put(TIMESTAMP_STR, 1);
+this.columnTypeDeduplicatedList = new ArrayList<>();
+int index = START_INDEX;
+for (int i = 0; i < columnNameList.size(); i++) {
+  String name = columnNameList.get(i);
+  columnInfoList.add(TIMESTAMP_STR + name);
+  columnInfoList.add(name);
+  if (!columnInfoMap.containsKey(name)) {
+columnInfoMap.put(name, index++);
+columnTypeDeduplicatedList.add(columnTypeList.get(i));
+  }
+}
+
+this.ignoreTimeStamp = ignoreTimeStamp;
+this.client = client;
+this.sql = sql;
+this.queryId = queryId;
+this.tsQueryNonAlignDataSet = dataset;
+this.sessionId = sessionId;
+  }
+
+  @Override
+  public boolean isWrapperFor(Class iface) throws SQLException {
+throw new SQLException(Constant.METHOD_NOT_SUPPORTED);
+  }
+
+  @Override
+  public  T unwrap(Class iface) throws SQLException {
+throw new SQLException(Constant.METHOD_NOT_SUPPORTED);
+  }
+
+  @Override
+  public boolean absolute(int arg0) throws SQLException {
+throw new SQLException(Constant.METHOD_NOT_SUPPORTED);
+  }
+
+  @Override
+  public void afterLast() throws SQLException {
+throw new 

[GitHub] [incubator-iotdb] jt2594838 commented on a change in pull request #738: [IOTDB-396] New query clause: disable align

2020-01-14 Thread GitBox
jt2594838 commented on a change in pull request #738: [IOTDB-396] New query 
clause: disable align
URL: https://github.com/apache/incubator-iotdb/pull/738#discussion_r366289729
 
 

 ##
 File path: 
server/src/main/java/org/apache/iotdb/db/query/dataset/NonAlignEngineDataSet.java
 ##
 @@ -0,0 +1,354 @@
+/*
+ * 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.db.query.dataset;
+
+import org.apache.iotdb.db.query.pool.QueryTaskPoolManager;
+import org.apache.iotdb.db.query.reader.ManagedSeriesReader;
+import org.apache.iotdb.db.tools.watermark.WatermarkEncoder;
+import org.apache.iotdb.service.rpc.thrift.TSQueryNonAlignDataSet;
+import org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.read.common.BatchData;
+import org.apache.iotdb.tsfile.read.common.Path;
+import org.apache.iotdb.tsfile.read.common.RowRecord;
+import org.apache.iotdb.tsfile.read.query.dataset.QueryDataSet;
+import org.apache.iotdb.tsfile.utils.Pair;
+import org.apache.iotdb.tsfile.utils.PublicBAOS;
+import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.atomic.AtomicIntegerArray;
+
+public class NonAlignEngineDataSet extends QueryDataSet {
+
+  private static class ReadTask implements Runnable {
+
+private final ManagedSeriesReader reader;
+private BlockingQueue> blockingQueue;
+private WatermarkEncoder encoder;
+NonAlignEngineDataSet dataSet;
+private int index;
+
+
+public ReadTask(ManagedSeriesReader reader,
+BlockingQueue> blockingQueue,
+WatermarkEncoder encoder, NonAlignEngineDataSet dataSet, 
int index) {
+  this.reader = reader;
+  this.blockingQueue = blockingQueue;
+  this.encoder = encoder;
+  this.dataSet = dataSet;
+  this.index = index;
+}
+
+@Override
+public void run() {
+  PublicBAOS timeBAOS = new PublicBAOS();
+  PublicBAOS valueBAOS = new PublicBAOS();
+  try {
+synchronized (reader) {
+  // if the task is submitted, there must be free space in the queue
+  // so here we don't need to check whether the queue has free space
+  // the reader has next batch
+  if ((dataSet.cachedBatchData[index] != null && 
dataSet.cachedBatchData[index].hasCurrent())
+  || reader.hasNextBatch()) {
+BatchData batchData;
+if (dataSet.cachedBatchData[index] != null && 
dataSet.cachedBatchData[index].hasCurrent())
+  batchData = dataSet.cachedBatchData[index];
+else
+  batchData = reader.nextBatch();
+
+int rowCount = 0;
+while (rowCount < dataSet.fetchSize) {
+
+  if ((dataSet.limit > 0 && 
dataSet.alreadyReturnedRowNumArray.get(index) >= dataSet.limit)) {
+break;
+  }
+
+  if (batchData != null && batchData.hasCurrent()) {
+if (dataSet.offsetArray.get(index) == 0) {
+  long time = batchData.currentTime();
+  ReadWriteIOUtils.write(time, timeBAOS);
+  TSDataType type = batchData.getDataType();
+  switch (type) {
+case INT32:
+  int intValue = batchData.getInt();
+  if (encoder != null && encoder.needEncode(time)) {
+intValue = encoder.encodeInt(intValue, time);
+  }
+  ReadWriteIOUtils.write(intValue, valueBAOS);
+  break;
+case INT64:
+  long longValue = batchData.getLong();
+  if (encoder != null && encoder.needEncode(time)) {
+longValue = encoder.encodeLong(longValue, time);
+  }
+   

[GitHub] [incubator-iotdb] jt2594838 commented on a change in pull request #738: [IOTDB-396] New query clause: disable align

2020-01-14 Thread GitBox
jt2594838 commented on a change in pull request #738: [IOTDB-396] New query 
clause: disable align
URL: https://github.com/apache/incubator-iotdb/pull/738#discussion_r366225892
 
 

 ##
 File path: 
jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBNonAlignQueryResultSet.java
 ##
 @@ -0,0 +1,1289 @@
+/*
+ * 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.jdbc;
+
+import org.apache.iotdb.rpc.IoTDBRPCException;
+import org.apache.iotdb.rpc.RpcUtils;
+import org.apache.iotdb.service.rpc.thrift.*;
+import org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.utils.BytesUtils;
+import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
+import org.apache.thrift.TException;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.net.URL;
+import java.nio.ByteBuffer;
+import java.sql.Date;
+import java.sql.*;
+import java.util.*;
+
+public class IoTDBNonAlignQueryResultSet implements ResultSet {
+
+  private static final String TIMESTAMP_STR = "Time";
+  private static final int TIMESTAMP_STR_LENGTH = 4;
+  private static final int START_INDEX = 2;
+  private static final String VALUE_IS_NULL = "The value got by %s (column 
name) is NULL.";
+  private static final String EMPTY_STR = "";
+  private Statement statement = null;
+  private String sql;
+  private SQLWarning warningChain = null;
+  private boolean isClosed = false;
+  private TSIService.Iface client = null;
+  private List columnInfoList; // no deduplication
+  private List columnTypeList; // no deduplication
+  private Map columnInfoMap; // used because the server 
returns deduplicated columns
+  private List columnTypeDeduplicatedList; // deduplicated from 
columnTypeList
 
 Review comment:
   It would be better if you just make it a List of TsDataType, it is 
unnecessary to convert a string to TsDataType every time.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-iotdb] jt2594838 commented on a change in pull request #738: [IOTDB-396] New query clause: disable align

2020-01-14 Thread GitBox
jt2594838 commented on a change in pull request #738: [IOTDB-396] New query 
clause: disable align
URL: https://github.com/apache/incubator-iotdb/pull/738#discussion_r366266157
 
 

 ##
 File path: 
jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBNonAlignQueryResultSet.java
 ##
 @@ -0,0 +1,1289 @@
+/*
+ * 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.jdbc;
+
+import org.apache.iotdb.rpc.IoTDBRPCException;
+import org.apache.iotdb.rpc.RpcUtils;
+import org.apache.iotdb.service.rpc.thrift.*;
+import org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.utils.BytesUtils;
+import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
+import org.apache.thrift.TException;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.net.URL;
+import java.nio.ByteBuffer;
+import java.sql.Date;
+import java.sql.*;
+import java.util.*;
+
+public class IoTDBNonAlignQueryResultSet implements ResultSet {
+
+  private static final String TIMESTAMP_STR = "Time";
+  private static final int TIMESTAMP_STR_LENGTH = 4;
+  private static final int START_INDEX = 2;
+  private static final String VALUE_IS_NULL = "The value got by %s (column 
name) is NULL.";
+  private static final String EMPTY_STR = "";
+  private Statement statement = null;
+  private String sql;
+  private SQLWarning warningChain = null;
+  private boolean isClosed = false;
+  private TSIService.Iface client = null;
+  private List columnInfoList; // no deduplication
+  private List columnTypeList; // no deduplication
+  private Map columnInfoMap; // used because the server 
returns deduplicated columns
+  private List columnTypeDeduplicatedList; // deduplicated from 
columnTypeList
+  private int fetchSize;
+  private boolean emptyResultSet = false;
+
+  private TSQueryNonAlignDataSet tsQueryNonAlignDataSet = null;
+  private byte[][] times; // used for disable align
+  private byte[][] values; // used to cache the current row record value
+
+  private long sessionId;
+  private long queryId;
+  private boolean ignoreTimeStamp = false;
+
+  public IoTDBNonAlignQueryResultSet() {
+// do nothing
+  }
+
+  // for disable align clause
+  public IoTDBNonAlignQueryResultSet(Statement statement, List 
columnNameList,
+ List columnTypeList, boolean 
ignoreTimeStamp, TSIService.Iface client,
+ String sql, long queryId, long sessionId, 
TSQueryNonAlignDataSet dataset)
+  throws SQLException {
+this.statement = statement;
+this.fetchSize = statement.getFetchSize();
+this.columnTypeList = columnTypeList;
+
+times = new byte[columnNameList.size()][Long.BYTES];
+values = new byte[columnNameList.size()][];
+
+this.columnInfoList = new ArrayList<>();
+// deduplicate and map
+this.columnInfoMap = new HashMap<>();
+this.columnInfoMap.put(TIMESTAMP_STR, 1);
+this.columnTypeDeduplicatedList = new ArrayList<>();
+int index = START_INDEX;
+for (int i = 0; i < columnNameList.size(); i++) {
+  String name = columnNameList.get(i);
+  columnInfoList.add(TIMESTAMP_STR + name);
+  columnInfoList.add(name);
+  if (!columnInfoMap.containsKey(name)) {
+columnInfoMap.put(name, index++);
+columnTypeDeduplicatedList.add(columnTypeList.get(i));
+  }
+}
+
+this.ignoreTimeStamp = ignoreTimeStamp;
+this.client = client;
+this.sql = sql;
+this.queryId = queryId;
+this.tsQueryNonAlignDataSet = dataset;
+this.sessionId = sessionId;
+  }
+
+  @Override
+  public boolean isWrapperFor(Class iface) throws SQLException {
+throw new SQLException(Constant.METHOD_NOT_SUPPORTED);
+  }
+
+  @Override
+  public  T unwrap(Class iface) throws SQLException {
+throw new SQLException(Constant.METHOD_NOT_SUPPORTED);
+  }
+
+  @Override
+  public boolean absolute(int arg0) throws SQLException {
+throw new SQLException(Constant.METHOD_NOT_SUPPORTED);
+  }
+
+  @Override
+  public void afterLast() throws SQLException {
+throw new 

[GitHub] [incubator-iotdb] jt2594838 commented on a change in pull request #738: [IOTDB-396] New query clause: disable align

2020-01-14 Thread GitBox
jt2594838 commented on a change in pull request #738: [IOTDB-396] New query 
clause: disable align
URL: https://github.com/apache/incubator-iotdb/pull/738#discussion_r366280738
 
 

 ##
 File path: 
server/src/main/java/org/apache/iotdb/db/query/dataset/NonAlignEngineDataSet.java
 ##
 @@ -0,0 +1,354 @@
+/*
+ * 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.db.query.dataset;
+
+import org.apache.iotdb.db.query.pool.QueryTaskPoolManager;
+import org.apache.iotdb.db.query.reader.ManagedSeriesReader;
+import org.apache.iotdb.db.tools.watermark.WatermarkEncoder;
+import org.apache.iotdb.service.rpc.thrift.TSQueryNonAlignDataSet;
+import org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.read.common.BatchData;
+import org.apache.iotdb.tsfile.read.common.Path;
+import org.apache.iotdb.tsfile.read.common.RowRecord;
+import org.apache.iotdb.tsfile.read.query.dataset.QueryDataSet;
+import org.apache.iotdb.tsfile.utils.Pair;
+import org.apache.iotdb.tsfile.utils.PublicBAOS;
+import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.atomic.AtomicIntegerArray;
+
+public class NonAlignEngineDataSet extends QueryDataSet {
+
+  private static class ReadTask implements Runnable {
+
+private final ManagedSeriesReader reader;
+private BlockingQueue> blockingQueue;
+private WatermarkEncoder encoder;
+NonAlignEngineDataSet dataSet;
+private int index;
+
+
+public ReadTask(ManagedSeriesReader reader,
+BlockingQueue> blockingQueue,
+WatermarkEncoder encoder, NonAlignEngineDataSet dataSet, 
int index) {
+  this.reader = reader;
+  this.blockingQueue = blockingQueue;
+  this.encoder = encoder;
+  this.dataSet = dataSet;
+  this.index = index;
+}
+
+@Override
+public void run() {
+  PublicBAOS timeBAOS = new PublicBAOS();
+  PublicBAOS valueBAOS = new PublicBAOS();
+  try {
+synchronized (reader) {
+  // if the task is submitted, there must be free space in the queue
+  // so here we don't need to check whether the queue has free space
+  // the reader has next batch
+  if ((dataSet.cachedBatchData[index] != null && 
dataSet.cachedBatchData[index].hasCurrent())
+  || reader.hasNextBatch()) {
+BatchData batchData;
+if (dataSet.cachedBatchData[index] != null && 
dataSet.cachedBatchData[index].hasCurrent())
+  batchData = dataSet.cachedBatchData[index];
+else
+  batchData = reader.nextBatch();
+
+int rowCount = 0;
+while (rowCount < dataSet.fetchSize) {
+
+  if ((dataSet.limit > 0 && 
dataSet.alreadyReturnedRowNumArray.get(index) >= dataSet.limit)) {
+break;
+  }
+
+  if (batchData != null && batchData.hasCurrent()) {
+if (dataSet.offsetArray.get(index) == 0) {
+  long time = batchData.currentTime();
+  ReadWriteIOUtils.write(time, timeBAOS);
+  TSDataType type = batchData.getDataType();
+  switch (type) {
+case INT32:
+  int intValue = batchData.getInt();
+  if (encoder != null && encoder.needEncode(time)) {
+intValue = encoder.encodeInt(intValue, time);
+  }
+  ReadWriteIOUtils.write(intValue, valueBAOS);
+  break;
+case INT64:
+  long longValue = batchData.getLong();
+  if (encoder != null && encoder.needEncode(time)) {
+longValue = encoder.encodeLong(longValue, time);
+  }
+   

[GitHub] [incubator-iotdb] jt2594838 commented on a change in pull request #738: [IOTDB-396] New query clause: disable align

2020-01-14 Thread GitBox
jt2594838 commented on a change in pull request #738: [IOTDB-396] New query 
clause: disable align
URL: https://github.com/apache/incubator-iotdb/pull/738#discussion_r366276562
 
 

 ##
 File path: 
server/src/main/java/org/apache/iotdb/db/query/dataset/NonAlignEngineDataSet.java
 ##
 @@ -0,0 +1,354 @@
+/*
+ * 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.db.query.dataset;
+
+import org.apache.iotdb.db.query.pool.QueryTaskPoolManager;
+import org.apache.iotdb.db.query.reader.ManagedSeriesReader;
+import org.apache.iotdb.db.tools.watermark.WatermarkEncoder;
+import org.apache.iotdb.service.rpc.thrift.TSQueryNonAlignDataSet;
+import org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.read.common.BatchData;
+import org.apache.iotdb.tsfile.read.common.Path;
+import org.apache.iotdb.tsfile.read.common.RowRecord;
+import org.apache.iotdb.tsfile.read.query.dataset.QueryDataSet;
+import org.apache.iotdb.tsfile.utils.Pair;
+import org.apache.iotdb.tsfile.utils.PublicBAOS;
+import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.atomic.AtomicIntegerArray;
+
+public class NonAlignEngineDataSet extends QueryDataSet {
+
+  private static class ReadTask implements Runnable {
+
+private final ManagedSeriesReader reader;
+private BlockingQueue> blockingQueue;
+private WatermarkEncoder encoder;
+NonAlignEngineDataSet dataSet;
+private int index;
+
+
+public ReadTask(ManagedSeriesReader reader,
+BlockingQueue> blockingQueue,
+WatermarkEncoder encoder, NonAlignEngineDataSet dataSet, 
int index) {
+  this.reader = reader;
+  this.blockingQueue = blockingQueue;
+  this.encoder = encoder;
+  this.dataSet = dataSet;
+  this.index = index;
+}
+
+@Override
+public void run() {
+  PublicBAOS timeBAOS = new PublicBAOS();
+  PublicBAOS valueBAOS = new PublicBAOS();
+  try {
+synchronized (reader) {
+  // if the task is submitted, there must be free space in the queue
+  // so here we don't need to check whether the queue has free space
+  // the reader has next batch
+  if ((dataSet.cachedBatchData[index] != null && 
dataSet.cachedBatchData[index].hasCurrent())
+  || reader.hasNextBatch()) {
+BatchData batchData;
+if (dataSet.cachedBatchData[index] != null && 
dataSet.cachedBatchData[index].hasCurrent())
+  batchData = dataSet.cachedBatchData[index];
+else
+  batchData = reader.nextBatch();
 
 Review comment:
   Always use "{}" for code blocks (even if it only contains a single line), as 
we obey the google code-style.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-iotdb] jt2594838 commented on a change in pull request #738: [IOTDB-396] New query clause: disable align

2020-01-14 Thread GitBox
jt2594838 commented on a change in pull request #738: [IOTDB-396] New query 
clause: disable align
URL: https://github.com/apache/incubator-iotdb/pull/738#discussion_r366279675
 
 

 ##
 File path: 
server/src/main/java/org/apache/iotdb/db/query/dataset/NonAlignEngineDataSet.java
 ##
 @@ -0,0 +1,354 @@
+/*
+ * 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.db.query.dataset;
+
+import org.apache.iotdb.db.query.pool.QueryTaskPoolManager;
+import org.apache.iotdb.db.query.reader.ManagedSeriesReader;
+import org.apache.iotdb.db.tools.watermark.WatermarkEncoder;
+import org.apache.iotdb.service.rpc.thrift.TSQueryNonAlignDataSet;
+import org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.read.common.BatchData;
+import org.apache.iotdb.tsfile.read.common.Path;
+import org.apache.iotdb.tsfile.read.common.RowRecord;
+import org.apache.iotdb.tsfile.read.query.dataset.QueryDataSet;
+import org.apache.iotdb.tsfile.utils.Pair;
+import org.apache.iotdb.tsfile.utils.PublicBAOS;
+import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.atomic.AtomicIntegerArray;
+
+public class NonAlignEngineDataSet extends QueryDataSet {
+
+  private static class ReadTask implements Runnable {
+
+private final ManagedSeriesReader reader;
+private BlockingQueue> blockingQueue;
+private WatermarkEncoder encoder;
+NonAlignEngineDataSet dataSet;
 
 Review comment:
   This field is not necessary if you make ReadTask a non-static class.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-iotdb] jt2594838 commented on a change in pull request #738: [IOTDB-396] New query clause: disable align

2020-01-14 Thread GitBox
jt2594838 commented on a change in pull request #738: [IOTDB-396] New query 
clause: disable align
URL: https://github.com/apache/incubator-iotdb/pull/738#discussion_r366226547
 
 

 ##
 File path: 
jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBNonAlignQueryResultSet.java
 ##
 @@ -0,0 +1,1289 @@
+/*
+ * 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.jdbc;
+
+import org.apache.iotdb.rpc.IoTDBRPCException;
+import org.apache.iotdb.rpc.RpcUtils;
+import org.apache.iotdb.service.rpc.thrift.*;
+import org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.utils.BytesUtils;
+import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
+import org.apache.thrift.TException;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.net.URL;
+import java.nio.ByteBuffer;
+import java.sql.Date;
+import java.sql.*;
+import java.util.*;
+
+public class IoTDBNonAlignQueryResultSet implements ResultSet {
+
+  private static final String TIMESTAMP_STR = "Time";
+  private static final int TIMESTAMP_STR_LENGTH = 4;
+  private static final int START_INDEX = 2;
+  private static final String VALUE_IS_NULL = "The value got by %s (column 
name) is NULL.";
+  private static final String EMPTY_STR = "";
+  private Statement statement = null;
+  private String sql;
+  private SQLWarning warningChain = null;
+  private boolean isClosed = false;
+  private TSIService.Iface client = null;
+  private List columnInfoList; // no deduplication
 
 Review comment:
   "Info" is too ambiguous, just call it "columnName".


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-iotdb] jt2594838 commented on a change in pull request #738: [IOTDB-396] New query clause: disable align

2020-01-14 Thread GitBox
jt2594838 commented on a change in pull request #738: [IOTDB-396] New query 
clause: disable align
URL: https://github.com/apache/incubator-iotdb/pull/738#discussion_r366224728
 
 

 ##
 File path: example/jdbc/src/main/java/org/apache/iotdb/JDBCExample.java
 ##
 @@ -31,23 +13,11 @@ public static void main(String[] args) throws 
ClassNotFoundException, SQLExcepti
 Class.forName("org.apache.iotdb.jdbc.IoTDBDriver");
 try (Connection connection = 
DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
  Statement statement = connection.createStatement()) {
-  statement.execute("SET STORAGE GROUP TO root.sg1");
-  statement.execute("CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT64, 
ENCODING=RLE");
-  statement.execute("CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=INT64, 
ENCODING=RLE");
-  statement.execute("CREATE TIMESERIES root.sg1.d1.s3 WITH DATATYPE=INT64, 
ENCODING=RLE");
-
-  for (int i = 0; i <= 100; i++) {
-statement.addBatch("insert into root.sg1.d1(timestamp, s1, s2, s3) 
values("+ i + "," + 1 + "," + 1 + "," + 1 + ")");
-  }
-  statement.executeBatch();
-  statement.clearBatch();
-
-  ResultSet resultSet = statement.executeQuery("select * from root where 
time <= 10");
-  outputResult(resultSet);
-  resultSet = statement.executeQuery("select count(*) from root");
-  outputResult(resultSet);
-  resultSet = statement.executeQuery("select count(*) from root where time 
>= 1 and time <= 100 group by ([0, 100], 20ms, 20ms)");
+  long startTime = System.currentTimeMillis();
+  ResultSet resultSet = statement.executeQuery("select * from root where 
time < 1 disable align");
   outputResult(resultSet);
+  long endTime = System.currentTimeMillis();
+  System.out.println("Cost Time: " + (endTime - startTime));
 
 Review comment:
   I don't think you should remove the old examples unless they are incorrect, 
you should only add the new ones.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-iotdb] jt2594838 commented on a change in pull request #738: [IOTDB-396] New query clause: disable align

2020-01-14 Thread GitBox
jt2594838 commented on a change in pull request #738: [IOTDB-396] New query 
clause: disable align
URL: https://github.com/apache/incubator-iotdb/pull/738#discussion_r366296983
 
 

 ##
 File path: service-rpc/rpc-changelist.md
 ##
 @@ -107,9 +107,11 @@ Last Updated on November 12th, 2019 by Tian Jiang.
 | Latest Changes   | Related 
Committers |
 |  | 
-- |
 | Add parameter sessionId in getTimeZone, getProperties, setStorageGroup, 
createTimeseries... | Tian Jiang|
+| Add struct TSQueryNonAlignDataSet| Haonan Hou|
 
 ## 3. Update
 
 | Latest Changes   | Related 
Committers |
 |  | 
-- |
-| Replace TS_SessionHandles with SessionIds, TSOperationHandle with queryIds  
| Tian Jiang  |
\ No newline at end of file
+| Replace TS_SessionHandles with SessionIds, TSOperationHandle with queryIds  
| Tian Jiang  |
+| Add optional TSQueryNonAlignDataSet in TSExecuteStatementResp, 
TSFetchResultsResp  | Haonan Hou |
 
 Review comment:
   And the field "isAlign".


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services