[GitHub] kr11 opened a new pull request #31: Fix sonar

2019-01-25 Thread GitBox
kr11 opened a new pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31
 
 
   these 2 commit covers the sonar issue 1610-1839 modified by kang rong.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


Re: Apply for adding code quality checking on one more branch (dev branch)

2019-01-25 Thread Xiangdong Huang
Thanks Chirs,

I tried to add as a SonarQube server in IDEA but failed, and the error
message is  "please upgrade them in SonarQube.java ... minimum: 5.1...".
But it is ok, I think it is not a big deal. I can still repair code smells
by using the default setting of SonarLint  plugin in IDEA.

Best,
---
Xiangdong Huang
School of Software, Tsinghua University

 黄向东
清华大学 软件学院


Christofer Dutz  于2019年1月25日周五 下午2:30写道:

> Hi Xiangdong,
>
> The problem would be that we would be getting sort of a race condition, if
> we ran the analysis on more than one branch. The UI would always show the
> results of the last build and there would be no continued stats.
>
> However there are ide plugins, that allow a local analysis using the
> settings of the Apache Sonar server.
>
> Maybe that helps?
>
> Chris
>
> Outlook für Android herunterladen
>
> 
> From: Xiangdong Huang 
> Sent: Friday, January 25, 2019 3:09:22 AM
> To: dev@iotdb.apache.org
> Subject: Apply for adding code quality checking on one more branch (dev
> branch)
>
> Hi,
>
> Thanks Chris setting the code quality checking on Master branch in Jenkins
> Pipeline.
>
> When I wanted to check how many vulnerabilities and code smells left after
> 2-days work, I found that only the master branch can trigger the code
> quality checking. The checking step is skipped on all other branch in the
> Jenkins Pipeline.  As a result, I had to merge the modified codes into the
> master branch (though we have not finished all the vulnerabilities) in a
> rush for code quality checking, and then leaded to a build failure on the
> Master Branch...
>
> I think two long-term alive branches are needed: one is master, which
> always keeps stable; the other one is dev, which can ingest some
> in-progress PRs.
> And, both the two branches need UTs, ITs, Code Quality checking..
>
> I have pushed a new branch called `dev`, can someone add a code quality
> checking step for it?
>
> By the way: After 2-days work, there are only ~1/3 vulnerabilities and code
> smells left now. Let's take all of them out quickly. :D
>
> Best,
>
> ---
> Xiangdong Huang
> School of Software, Tsinghua University
>
>  黄向东
> 清华大学 软件学院
>


Scrum or Kanban Board on JIRA

2019-01-25 Thread Xiangdong Huang
Hi all,

I opened a ticket to apply for create a board for IoTDB. Now I have the
permission.

My question is: Which one do you want? Scrum or Kanban Board?

Best,
---
Xiangdong Huang
School of Software, Tsinghua University

 黄向东
清华大学 软件学院


[GitHub] jt2594838 opened a new pull request #32: fix sonar issues

2019-01-25 Thread GitBox
jt2594838 opened a new pull request #32: fix sonar issues
URL: https://github.com/apache/incubator-iotdb/pull/32
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes opened a new pull request #33: Fix sonar problems

2019-01-25 Thread GitBox
Beyyes opened a new pull request #33: Fix sonar problems
URL: https://github.com/apache/incubator-iotdb/pull/33
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


Re: Apply for adding code quality checking on one more branch (dev branch)

2019-01-25 Thread Christofer Dutz
Hi,

I whas sort of thinging most of you were using Eclipse ... yeah ... seen that 
before ;-/
I opened a Jira on this:

https://issues.apache.org/jira/browse/INFRA-17218

Please feel free to monitor it.

Or ask Justin how he's doing it as I know that he usually does local Sonar 
analysis (Maybe uses a local Sonar instance)

Chris 


Am 25.01.19, 12:24 schrieb "Xiangdong Huang" :

Thanks Chirs,

I tried to add as a SonarQube server in IDEA but failed, and the error
message is  "please upgrade them in SonarQube.java ... minimum: 5.1...".
But it is ok, I think it is not a big deal. I can still repair code smells
by using the default setting of SonarLint  plugin in IDEA.

Best,
---
Xiangdong Huang
School of Software, Tsinghua University

 黄向东
清华大学 软件学院


Christofer Dutz  于2019年1月25日周五 下午2:30写道:

> Hi Xiangdong,
>
> The problem would be that we would be getting sort of a race condition, if
> we ran the analysis on more than one branch. The UI would always show the
> results of the last build and there would be no continued stats.
>
> However there are ide plugins, that allow a local analysis using the
> settings of the Apache Sonar server.
>
> Maybe that helps?
>
> Chris
>
> Outlook für Android herunterladen
>
> 
> From: Xiangdong Huang 
> Sent: Friday, January 25, 2019 3:09:22 AM
> To: dev@iotdb.apache.org
> Subject: Apply for adding code quality checking on one more branch (dev
> branch)
>
> Hi,
>
> Thanks Chris setting the code quality checking on Master branch in Jenkins
> Pipeline.
>
> When I wanted to check how many vulnerabilities and code smells left after
> 2-days work, I found that only the master branch can trigger the code
> quality checking. The checking step is skipped on all other branch in the
> Jenkins Pipeline.  As a result, I had to merge the modified codes into the
> master branch (though we have not finished all the vulnerabilities) in a
> rush for code quality checking, and then leaded to a build failure on the
> Master Branch...
>
> I think two long-term alive branches are needed: one is master, which
> always keeps stable; the other one is dev, which can ingest some
> in-progress PRs.
> And, both the two branches need UTs, ITs, Code Quality checking..
>
> I have pushed a new branch called `dev`, can someone add a code quality
> checking step for it?
>
> By the way: After 2-days work, there are only ~1/3 vulnerabilities and 
code
> smells left now. Let's take all of them out quickly. :D
>
> Best,
>
> ---
> Xiangdong Huang
> School of Software, Tsinghua University
>
>  黄向东
> 清华大学 软件学院
>




Re: How to prevent GitBox from sending too many commit notifications

2019-01-25 Thread Xiangdong Huang
Hi all,

I find another project has the similar problem, and finally they send all
code-reviews to the reviews@  (see [1]).

I think that it also fits us. As for the dev@, we can discuss about the
issues about Infrastructures (e.g., how to use CI, how to keep code
quality), new features, bugs, performance problems etc. These contents are
more valuable.

If someone wants to keep tracking with code-reviews or freshman, he can
subscribe the reviews@ mail list.

For experienced programmers,  they can focus on the contents on dev@

If all of you agree with it, I will try to open a ticket on JIRA INFRA.

Reference:
[1]
https://issues.apache.org/jira/browse/INFRA-12404?jql=text%20~%20%22github%20review%22%20AND%20%20project%20%20%3D%20Infrastructure

Best,
---
Xiangdong Huang
School of Software, Tsinghua University

 黄向东
清华大学 软件学院


江天  于2019年1月25日周五 上午10:34写道:

> I like the idea of being highly transparent, but we hope to know some
> tricks of doing this. Do we have to paste the code in the mails or just
> tell someone what problem which line in which file has? Both of these seem
> tiring.
>
> > 在 2019年1月25日,上午1:08,Justin Mclean  写道:
> >
> > Hi,
> >
> >> No matter what you guys decide to do, I would strongly suggest to take
> discussions here to the list and not do discussions in the Github
> code-review tool.
> >
> > A very big +1 to this, discussion works best for the whole community if
> it is on the list.
> >
> > Thanks,
> > Justin
>
>
>


Re: How to prevent GitBox from sending too many commit notifications

2019-01-25 Thread Gaofei Cao
+1
I think this way is better

Xiangdong Huang  于2019年1月25日周五 下午9:11写道:

> Hi all,
>
> I find another project has the similar problem, and finally they send all
> code-reviews to the reviews@  (see [1]).
>
> I think that it also fits us. As for the dev@, we can discuss about the
> issues about Infrastructures (e.g., how to use CI, how to keep code
> quality), new features, bugs, performance problems etc. These contents are
> more valuable.
>
> If someone wants to keep tracking with code-reviews or freshman, he can
> subscribe the reviews@ mail list.
>
> For experienced programmers,  they can focus on the contents on dev@
>
> If all of you agree with it, I will try to open a ticket on JIRA INFRA.
>
> Reference:
> [1]
>
> https://issues.apache.org/jira/browse/INFRA-12404?jql=text%20~%20%22github%20review%22%20AND%20%20project%20%20%3D%20Infrastructure
>
> Best,
> ---
> Xiangdong Huang
> School of Software, Tsinghua University
>
>  黄向东
> 清华大学 软件学院
>
>
> 江天  于2019年1月25日周五 上午10:34写道:
>
> > I like the idea of being highly transparent, but we hope to know some
> > tricks of doing this. Do we have to paste the code in the mails or just
> > tell someone what problem which line in which file has? Both of these
> seem
> > tiring.
> >
> > > 在 2019年1月25日,上午1:08,Justin Mclean  写道:
> > >
> > > Hi,
> > >
> > >> No matter what you guys decide to do, I would strongly suggest to take
> > discussions here to the list and not do discussions in the Github
> > code-review tool.
> > >
> > > A very big +1 to this, discussion works best for the whole community if
> > it is on the list.
> > >
> > > Thanks,
> > > Justin
> >
> >
> >
>


[GitHub] jixuan1989 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jixuan1989 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r250989278
 
 

 ##
 File path: 
iotdb/src/test/java/org/apache/iotdb/db/postback/sender/IoTDBSingleClientPostBackTest.java
 ##
 @@ -287,7 +274,7 @@ public void testPostback() {
   dataReceiver.add(res.getString("Time") + 
res.getString("root.vehicle.d0.s0")
   + res.getString("root.vehicle.d0.s1") + 
res.getString("root.vehicle.d1.s2")
   + res.getString("root.vehicle.d1.s3"));
-  System.out.println(res.getString("Time") + " | " + 
res.getString("root.vehicle.d0.s0")
+  LOGGER.info(res.getString("Time") + " | " + 
res.getString("root.vehicle.d0.s0")
 
 Review comment:
   Reconsider which are logger.info and which are logger.debug in a UT file.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jixuan1989 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jixuan1989 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r250983683
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/postback/conf/PostBackSenderDescriptor.java
 ##
 @@ -87,46 +83,42 @@ private void loadProps() {
 try {
   properties.load(inputStream);
 
-  conf.serverIp = properties.getProperty("server_ip", conf.serverIp);
-  conf.serverPort = Integer
-  .parseInt(properties.getProperty("server_port", conf.serverPort + 
""));
+  conf.setServerIp(properties.getProperty("server_ip", 
conf.getServerIp()));
+  conf.setServerPort(Integer
+  .parseInt(properties.getProperty("server_port", conf.getServerPort() 
+ "")));
 
 Review comment:
   int+"" is inefficient comparing with String.valueOf()


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jixuan1989 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jixuan1989 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r250988465
 
 

 ##
 File path: 
iotdb/src/test/java/org/apache/iotdb/db/postback/sender/FileManagerTest.java
 ##
 @@ -229,46 +228,46 @@ public void testGetNowLocalFileList() throws IOException 
{
 if (!file.getParentFile().exists()) {
   file.getParentFile().mkdirs();
 }
-if (!file.exists()) {
-  file.createNewFile();
+if (!file.exists() && !file.createNewFile()) {
+  LOGGER.error("Can not create new file {}", file.getAbsoluteFile());
 }
   }
 }
-manager.setNowLocalFiles(new HashMap<>());
-manager.getNowLocalFileList(new String[]{SENDER_FILE_PATH_TEST});
-fileList = manager.getNowLocalFiles();
+manager.setCurrentLocalFiles(new HashMap<>());
+manager.getCurrentLocalFileList(new String[]{SENDER_FILE_PATH_TEST});
+fileList = manager.getCurrentLocalFiles();
 assert (allFileList.size() == fileList.size());
 for (Entry> entry : fileList.entrySet()) {
   assert (allFileList.containsKey(entry.getKey()));
-  System.out.println("allFileList");
+  LOGGER.info("allFileList");
 
 Review comment:
   how about change these to Logger.debug() level?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jixuan1989 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jixuan1989 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r250982069
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/postback/conf/PostBackSenderConfig.java
 ##
 @@ -1,19 +1,15 @@
 /**
- * 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
+ * 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
+ * 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
+ * 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
 
 Review comment:
   Do not format the ASF header.. 
   If you use auto-format function of IDEA, do not select all the codes.
   PostBackSenderDescriptor.java has the similar problem.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jixuan1989 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jixuan1989 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r250971966
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/auth/role/LocalFileRoleAccessor.java
 ##
 @@ -100,24 +100,25 @@ public Role loadRole(String rolename) throws IOException 
{
   public void saveRole(Role role) throws IOException {
 File roleProfile = new File(
 roleDirPath + File.separator + role.getName() + 
IoTDBConstant.PROFILE_SUFFIX + TEMP_SUFFIX);
-BufferedOutputStream outputStream = new BufferedOutputStream(new 
FileOutputStream(roleProfile));
-try {
-  IOUtils.writeString(outputStream, role.getName(), STRING_ENCODING, 
encodingBufferLocal);
-
-  role.getPrivilegeList().sort(PathPrivilege.referenceDescentSorter);
-  int privilegeNum = role.getPrivilegeList().size();
-  IOUtils.writeInt(outputStream, privilegeNum, encodingBufferLocal);
-  for (int i = 0; i < privilegeNum; i++) {
-PathPrivilege pathPrivilege = role.getPrivilegeList().get(i);
-IOUtils
-.writePathPrivilege(outputStream, pathPrivilege, STRING_ENCODING, 
encodingBufferLocal);
+try (BufferedOutputStream outputStream = new BufferedOutputStream(new 
FileOutputStream(roleProfile))) {
+  try {
+IOUtils.writeString(outputStream, role.getName(), STRING_ENCODING, 
encodingBufferLocal);
+
+role.getPrivilegeList().sort(PathPrivilege.referenceDescentSorter);
+int privilegeNum = role.getPrivilegeList().size();
+IOUtils.writeInt(outputStream, privilegeNum, encodingBufferLocal);
+for (int i = 0; i < privilegeNum; i++) {
+  PathPrivilege pathPrivilege = role.getPrivilegeList().get(i);
+  IOUtils
+  .writePathPrivilege(outputStream, pathPrivilege, STRING_ENCODING,
+  encodingBufferLocal);
+}
+
+  } catch (Exception e) {
+throw new IOException(e.getMessage());
+  } finally {
+outputStream.flush();
 
 Review comment:
   put the flush() operation in try{ } rather than finally{}. 
   And `LocalFileUserAccessor.java` has the same problem.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jixuan1989 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jixuan1989 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r250984585
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/postback/conf/PostBackSenderDescriptor.java
 ##
 @@ -87,46 +83,42 @@ private void loadProps() {
 try {
 
 Review comment:
   why not using try(inputstream)?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jixuan1989 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jixuan1989 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r250988686
 
 

 ##
 File path: 
iotdb/src/test/java/org/apache/iotdb/db/postback/sender/FileManagerTest.java
 ##
 @@ -368,7 +364,7 @@ public void testGetSendingFileList() throws IOException {
 
   private boolean isEmpty(Map> sendingFileList) {
 for (Entry> entry : sendingFileList.entrySet()) {
-  if (entry.getValue().size() != 0) {
+  if (entry.getValue().isEmpty()) {
 
 Review comment:
   the correct one is: if(!entry.getValue().isEmpty())


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jixuan1989 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jixuan1989 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r250988069
 
 

 ##
 File path: 
iotdb/src/test/java/org/apache/iotdb/db/postback/sender/FileManagerTest.java
 ##
 @@ -55,20 +56,19 @@ public void setUp() throws Exception {
   }
 
   @After
-  public void tearDown() throws Exception {
+  public void tearDown() throws IOException, InterruptedException {
 Thread.sleep(1000);
-delete(new File(POST_BACK_DIRECTORY_TEST));
-new File(POST_BACK_DIRECTORY_TEST).delete();
+Files.deleteIfExists((java.nio.file.Path) new 
Path(POST_BACK_DIRECTORY_TEST));
   }
 
-  public void delete(File file) {
+  public void delete(File file) throws IOException {
 if (file.isFile() || file.list().length == 0) {
-  file.delete();
+  Files.deleteIfExists((java.nio.file.Path) new 
Path(file.getAbsolutePath()));
 
 Review comment:
   why not using import java.nio.file.Path..


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


Re: Scrum or Kanban Board on JIRA

2019-01-25 Thread Gaofei Cao
I prefer Kanban Board.

I think the model and roles of Scrum is a bit complicated which is not fit
for our team.

Best,
---
Gaofei Cao
School of Software, Tsinghua University


Xiangdong Huang  于2019年1月25日周五 下午7:26写道:

> Hi all,
>
> I opened a ticket to apply for create a board for IoTDB. Now I have the
> permission.
>
> My question is: Which one do you want? Scrum or Kanban Board?
>
> Best,
> ---
> Xiangdong Huang
> School of Software, Tsinghua University
>
>  黄向东
> 清华大学 软件学院
>


Re: How to prevent GitBox from sending too many commit notifications

2019-01-25 Thread 毛东方
+1, appreciate.

> 在 2019年1月25日,下午9:11,Xiangdong Huang  写道:
> 
> Hi all,
> 
> I find another project has the similar problem, and finally they send all
> code-reviews to the reviews@  (see [1]).
> 
> I think that it also fits us. As for the dev@, we can discuss about the
> issues about Infrastructures (e.g., how to use CI, how to keep code
> quality), new features, bugs, performance problems etc. These contents are
> more valuable.
> 
> If someone wants to keep tracking with code-reviews or freshman, he can
> subscribe the reviews@ mail list.
> 
> For experienced programmers,  they can focus on the contents on dev@
> 
> If all of you agree with it, I will try to open a ticket on JIRA INFRA.
> 
> Reference:
> [1]
> https://issues.apache.org/jira/browse/INFRA-12404?jql=text%20~%20%22github%20review%22%20AND%20%20project%20%20%3D%20Infrastructure
> 
> Best,
> ---
> Xiangdong Huang
> School of Software, Tsinghua University
> 
> 黄向东
> 清华大学 软件学院
> 
> 
> 江天  于2019年1月25日周五 上午10:34写道:
> 
>> I like the idea of being highly transparent, but we hope to know some
>> tricks of doing this. Do we have to paste the code in the mails or just
>> tell someone what problem which line in which file has? Both of these seem
>> tiring.
>> 
>>> 在 2019年1月25日,上午1:08,Justin Mclean  写道:
>>> 
>>> Hi,
>>> 
 No matter what you guys decide to do, I would strongly suggest to take
>> discussions here to the list and not do discussions in the Github
>> code-review tool.
>>> 
>>> A very big +1 to this, discussion works best for the whole community if
>> it is on the list.
>>> 
>>> Thanks,
>>> Justin
>> 
>> 
>> 



[GitHub] mdf369 commented on a change in pull request #33: Fix sonar problems

2019-01-25 Thread GitBox
mdf369 commented on a change in pull request #33: Fix sonar problems
URL: https://github.com/apache/incubator-iotdb/pull/33#discussion_r251004522
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/auth/authorizer/BasicAuthorizer.java
 ##
 @@ -238,6 +240,7 @@ public void start() throws StartupException {
 try {
   init();
 } catch (AuthException e) {
+  logger.error(e.getMessage());
 
 Review comment:
   I suggest to add some simple info about this error, instead of just 
e.getMessage()


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251008904
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/query/executor/EngineExecutorWithTimeGenerator.java
 ##
 @@ -59,18 +59,24 @@
* @throws IOException IOException
* @throws FileNodeManagerException FileNodeManagerException
*/
-  public QueryDataSet execute() throws IOException, FileNodeManagerException {
+  public QueryDataSet execute() throws FileNodeManagerException {
 
 QueryTokenManager.getInstance()
 .beginQueryOfGivenQueryPaths(jobId, 
queryExpression.getSelectedSeries());
 QueryTokenManager.getInstance()
 .beginQueryOfGivenExpression(jobId, queryExpression.getExpression());
 
-EngineTimeGenerator timestampGenerator = new EngineTimeGenerator(jobId,
-queryExpression.getExpression());
+EngineTimeGenerator timestampGenerator = null;
+List readersOfSelectedSeries = null;
+try {
+   timestampGenerator = new EngineTimeGenerator(jobId,
+  queryExpression.getExpression());
 
-List readersOfSelectedSeries = 
getReadersOfSelectedPaths(
-queryExpression.getSelectedSeries());
+   readersOfSelectedSeries = getReadersOfSelectedPaths(
+  queryExpression.getSelectedSeries());
+} catch (IOException ex){
 
 Review comment:
   format


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251005199
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java
 ##
 @@ -59,29 +61,39 @@ public Operator transform(Operator operator) throws 
LogicalOptimizeException {
 SFWOperator sfwOperator = (SFWOperator) operator;
 FromOperator from = sfwOperator.getFromOperator();
 List prefixPaths;
-if (from == null || (prefixPaths = from.getPrefixPaths()).isEmpty()) {
+if (from == null){
 
 Review comment:
   format


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251016949
 
 

 ##
 File path: iotdb/src/main/java/org/apache/iotdb/db/service/Utils.java
 ##
 @@ -1,19 +1,15 @@
 /**
- * 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
+ * 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
+ * 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
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
 
 Review comment:
   can be changed?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251001363
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/postback/utils/CreateDataSender1.java
 ##
 @@ -53,6 +58,7 @@
   private static final int MAX_FLOAT = 30;
   private static final int STRING_LENGTH = 5;
   private static final int BATCH_SQL = 1;
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(CreateDataSender1.class);
 
 Review comment:
   logger


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251000793
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/postback/conf/PostBackSenderDescriptor.java
 ##
 @@ -87,46 +87,42 @@ private void loadProps() {
 try {
   properties.load(inputStream);
 
-  conf.serverIp = properties.getProperty("server_ip", conf.serverIp);
-  conf.serverPort = Integer
-  .parseInt(properties.getProperty("server_port", conf.serverPort + 
""));
+  conf.setServerIp(properties.getProperty("server_ip", 
conf.getServerIp()));
+  conf.setServerPort(Integer
+  .parseInt(properties.getProperty("server_port", conf.getServerPort() 
+ "")));
 
-  conf.clientPort = Integer
-  .parseInt(properties.getProperty("client_port", conf.clientPort + 
""));
-  conf.uploadCycleInSeconds = Integer
-  .parseInt(
-  properties.getProperty("upload_cycle_in_seconds", 
conf.uploadCycleInSeconds + ""));
-  conf.schemaPath = properties.getProperty("iotdb_schema_directory", 
conf.schemaPath);
-  conf.isClearEnable = Boolean
-  .parseBoolean(properties.getProperty("is_clear_enable", 
conf.isClearEnable + ""));
-  conf.uuidPath = conf.dataDirectory + "postback" + File.separator + 
"uuid.txt";
-  conf.lastFileInfo =
-  conf.dataDirectory + "postback" + File.separator + 
"lastLocalFileList.txt";
-
-  String[] snapshots = new String[conf.iotdbBufferwriteDirectory.length];
-  for (int i = 0; i < conf.iotdbBufferwriteDirectory.length; i++) {
-conf.iotdbBufferwriteDirectory[i] = new 
File(conf.iotdbBufferwriteDirectory[i])
-.getAbsolutePath();
-if (!conf.iotdbBufferwriteDirectory[i].endsWith(File.separator)) {
-  conf.iotdbBufferwriteDirectory[i] = 
conf.iotdbBufferwriteDirectory[i] + File.separator;
+  conf.setClientPort(Integer
+  .parseInt(properties.getProperty("client_port", conf.getClientPort() 
+ "")));
 
 Review comment:
   +1
   I seen the comment of xd...


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251017828
 
 

 ##
 File path: iotdb/src/main/java/org/apache/iotdb/db/utils/LoadDataUtils.java
 ##
 @@ -133,7 +133,7 @@ private void loadOneRecordLine(String line) {
 try {
   nsPath = mmanager.getFileNameByPath(record.deviceId);
 } catch (PathErrorException e) {
-  LOG.error("given seriesPath not found.{}", e.getMessage());
+  logger.error("given seriesPath not found, given deviceId:{} ", 
record.deviceId, e);
 
 Review comment:
   only one `{}` ??
   same as below.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251007159
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/IFilterOptimizer.java
 ##
 @@ -24,6 +24,7 @@
 /**
  * provide a filter operator, optimize it.
  */
+@FunctionalInterface
 
 Review comment:
   Is this annotation necessary?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251008541
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/query/control/FileReaderManager.java
 ##
 @@ -87,7 +87,7 @@ private void clearUnUsedFilesInFixTime() {
 try {
   reader.close();
 } catch (IOException e) {
-  LOGGER.error("Can not close TsFileSequenceReader {} !", 
reader.getFileName());
+  LOGGER.error("Can not close TsFileSequenceReader {} !", 
reader.getFileName() + ": " + e);
 
 Review comment:
   No need to use ":"
   use `{}` in logger is better.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251015627
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/query/reader/merge/PriorityMergeReader.java
 ##
 @@ -126,5 +126,22 @@ public int compareTo(Element o) {
 
   return o.priority.compareTo(this.priority);
 }
+
+@Override
+public boolean equals(Object o){
+  if (o instanceof Element){
+Element element = (Element) o;
+if (this.timeValuePair.getTimestamp() == 
element.timeValuePair.getTimestamp()
+&& this.priority.equals(element.priority)){
+  return true;
+}
+  }
+  return false;
+}
+
+@Override
+public int hashCode(){
+  return (int) (timeValuePair.getTimestamp() * 37 + priority.hashCode());
 
 Review comment:
   int is ok??
   timeValuePair.getTimestamp() is long type.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251006108
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/DnfFilterOptimizer.java
 ##
 @@ -40,6 +40,15 @@ public FilterOperator optimize(FilterOperator filter) 
throws LogicalOptimizeExce
 return getDnf(filter);
   }
 
+  private void dealWithLeftAndRightAndChildren(List 
leftAndChildren, List rightAndChildren, List 
newChildrenList) throws LogicalOptimizeException {
 
 Review comment:
   too long


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251008680
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/query/control/QueryTokenManager.java
 ##
 @@ -169,5 +169,7 @@ private void putQueryTokenForCurrentRequestThread(long 
jobId, String deviceId, i
 
   private static class QueryTokenManagerHelper {
 private static final QueryTokenManager INSTANCE = new QueryTokenManager();
+
+private QueryTokenManagerHelper(){}
 
 Review comment:
   format


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251016383
 
 

 ##
 File path: iotdb/src/main/java/org/apache/iotdb/db/service/IoTDB.java
 ##
 @@ -168,6 +169,8 @@ private void systemDataRecovery() throws RecoverException {
   private static class IoTDBHolder {
 
 private static final IoTDB INSTANCE = new IoTDB();
+
+private IoTDBHolder(){}
 
 Review comment:
   format


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251016098
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/query/reader/sequence/SealedTsFilesReader.java
 ##
 @@ -90,22 +91,22 @@ public boolean hasNext() throws IOException {
   hasCachedData = true;
   return true;
 } else {
-  continue;
+  flag = true;
 }
   }
 
   // try to get next batch data from next reader
-  while (usedIntervalFileIndex < sealedTsFiles.size()) {
+  while (!flag && usedIntervalFileIndex < sealedTsFiles.size()) {
 // init until reach a satisfied reader
 if (seriesReader == null || !seriesReader.hasNextBatch()) {
   IntervalFileNode fileNode = 
sealedTsFiles.get(usedIntervalFileIndex++);
   if (singleTsFileSatisfied(fileNode)) {
 initSingleTsFileReader(fileNode);
   } else {
-continue;
+flag = true;
 
 Review comment:
   This code is no need!


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251016873
 
 

 ##
 File path: iotdb/src/main/java/org/apache/iotdb/db/service/Utils.java
 ##
 @@ -1,19 +1,15 @@
 /**
- * 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
+ * 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
+ * http://www.apache.org/licenses/LICENSE-2.0
 
 Review comment:
   apache license


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251008631
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/query/control/OpenedFilePathsManager.java
 ##
 @@ -110,5 +110,7 @@ public void addFilePathToMap(long jobId, String filePath) {
 
   private static class OpenedFilePathsManagerHelper {
 private static final OpenedFilePathsManager INSTANCE = new 
OpenedFilePathsManager();
+
+private OpenedFilePathsManagerHelper(){}
 
 Review comment:
   format


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251017485
 
 

 ##
 File path: iotdb/src/main/java/org/apache/iotdb/db/utils/AuthUtils.java
 ##
 @@ -28,16 +28,22 @@
 import org.apache.iotdb.db.auth.entity.PathPrivilege;
 import org.apache.iotdb.db.auth.entity.PrivilegeType;
 import org.apache.iotdb.db.conf.IoTDBConstant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class AuthUtils {
 
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(AuthUtils.class);
+
   private static final int MIN_PASSWORD_LENGTH = 4;
   private static final int MIN_USERNAME_LENGTH = 4;
   private static final int MIN_ROLENAME_LENGTH = 4;
   private static final String ROOT_PREFIX = IoTDBConstant.PATH_ROOT;
   private static final String ENCRYPT_ALGORITHM = "MD5";
   private static final String STRING_ENCODING = "utf-8";
 
+  private AuthUtils(){}
 
 Review comment:
   format


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251005770
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java
 ##
 @@ -59,29 +61,39 @@ public Operator transform(Operator operator) throws 
LogicalOptimizeException {
 SFWOperator sfwOperator = (SFWOperator) operator;
 FromOperator from = sfwOperator.getFromOperator();
 List prefixPaths;
-if (from == null || (prefixPaths = from.getPrefixPaths()).isEmpty()) {
+if (from == null){
   LOG.warn("given SFWOperator doesn't have prefix paths, cannot concat 
seriesPath");
   return operator;
+} else {
+  prefixPaths = from.getPrefixPaths();
+  if (prefixPaths.isEmpty()) {
+LOG.warn("given SFWOperator doesn't have prefix paths, cannot concat 
seriesPath");
+return operator;
+  }
 }
 SelectOperator select = sfwOperator.getSelectOperator();
 List initialSuffixPaths;
-if (select == null || (initialSuffixPaths = 
select.getSuffixPaths()).isEmpty()) {
-  LOG.warn("given SFWOperator doesn't have suffix paths, cannot concat 
seriesPath");
+if (select == null){
 
 Review comment:
   format 
   maybe all this class should be formatted


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251017671
 
 

 ##
 File path: iotdb/src/main/java/org/apache/iotdb/db/utils/FileUtils.java
 ##
 @@ -28,6 +28,8 @@
  */
 public class FileUtils {
 
+  private FileUtils(){}
 
 Review comment:
   format, and all other classed.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r250999389
 
 

 ##
 File path: iotdb/pom.xml
 ##
 @@ -53,33 +53,6 @@
 ${project.version}
 test
 
-
-cn.edu.fudan.dsm
-kvmatch-iotdb
-1.0.3
-
-
-org.slf4j
-slf4j-api
-
-
-org.slf4j
-slf4j-log4j12
-
-
-org.slf4j
-slf4j-log4j12
-
-
-log4j
-log4j
-
-
-org.apache.iotdb
-tsfile
-
-
-
 
 org.apache.commons
 
 Review comment:
   what's the indent size of xml file?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251000916
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/postback/conf/PostBackSenderDescriptor.java
 ##
 @@ -87,46 +87,42 @@ private void loadProps() {
 try {
   properties.load(inputStream);
 
-  conf.serverIp = properties.getProperty("server_ip", conf.serverIp);
-  conf.serverPort = Integer
-  .parseInt(properties.getProperty("server_port", conf.serverPort + 
""));
+  conf.setServerIp(properties.getProperty("server_ip", 
conf.getServerIp()));
+  conf.setServerPort(Integer
+  .parseInt(properties.getProperty("server_port", conf.getServerPort() 
+ "")));
 
-  conf.clientPort = Integer
-  .parseInt(properties.getProperty("client_port", conf.clientPort + 
""));
-  conf.uploadCycleInSeconds = Integer
-  .parseInt(
-  properties.getProperty("upload_cycle_in_seconds", 
conf.uploadCycleInSeconds + ""));
-  conf.schemaPath = properties.getProperty("iotdb_schema_directory", 
conf.schemaPath);
-  conf.isClearEnable = Boolean
-  .parseBoolean(properties.getProperty("is_clear_enable", 
conf.isClearEnable + ""));
-  conf.uuidPath = conf.dataDirectory + "postback" + File.separator + 
"uuid.txt";
-  conf.lastFileInfo =
-  conf.dataDirectory + "postback" + File.separator + 
"lastLocalFileList.txt";
-
-  String[] snapshots = new String[conf.iotdbBufferwriteDirectory.length];
-  for (int i = 0; i < conf.iotdbBufferwriteDirectory.length; i++) {
-conf.iotdbBufferwriteDirectory[i] = new 
File(conf.iotdbBufferwriteDirectory[i])
-.getAbsolutePath();
-if (!conf.iotdbBufferwriteDirectory[i].endsWith(File.separator)) {
-  conf.iotdbBufferwriteDirectory[i] = 
conf.iotdbBufferwriteDirectory[i] + File.separator;
+  conf.setClientPort(Integer
+  .parseInt(properties.getProperty("client_port", conf.getClientPort() 
+ "")));
+  conf.setUploadCycleInSeconds(Integer.parseInt(properties
+  .getProperty("upload_cycle_in_seconds", 
conf.getUploadCycleInSeconds() + "")));
+  conf.setSchemaPath(properties.getProperty("iotdb_schema_directory", 
conf.getSchemaPath()));
+  conf.setClearEnable(Boolean
+  .parseBoolean(properties.getProperty("is_clear_enable", 
conf.getClearEnable() + "")));
+  conf.setUuidPath(conf.getDataDirectory() + POSTBACK + File.separator + 
"uuid.txt");
+  conf.setLastFileInfo(
+  conf.getDataDirectory() + POSTBACK + File.separator + 
"lastLocalFileList.txt");
+  String[] iotdbBufferwriteDirectory = conf.getIotdbBufferwriteDirectory();
+  String[] snapshots = new 
String[conf.getIotdbBufferwriteDirectory().length];
+  for (int i = 0; i < conf.getIotdbBufferwriteDirectory().length; i++) {
+iotdbBufferwriteDirectory[i] = new 
File(iotdbBufferwriteDirectory[i]).getAbsolutePath();
+if (!iotdbBufferwriteDirectory[i].endsWith(File.separator)) {
+  iotdbBufferwriteDirectory[i] = iotdbBufferwriteDirectory[i] + 
File.separator;
 }
-snapshots[i] =
-conf.iotdbBufferwriteDirectory[i] + "postback" + File.separator + 
"dataSnapshot"
-+ File.separator;
+snapshots[i] = iotdbBufferwriteDirectory[i] + POSTBACK + 
File.separator + "dataSnapshot"
++ File.separator;
   }
-  conf.snapshotPaths = snapshots;
+  conf.setIotdbBufferwriteDirectory(iotdbBufferwriteDirectory);
+  conf.setSnapshotPaths(snapshots);
 } catch (IOException e) {
   LOGGER.warn("Cannot load config file because {}, use default 
configuration", e.getMessage());
 } catch (Exception e) {
   LOGGER.warn("Error format in config file because {}, use default 
configuration",
   e.getMessage());
 } finally {
-  if (inputStream != null) {
-try {
-  inputStream.close();
-} catch (IOException e) {
-  LOGGER.error("Fail to close config file input stream because {}", 
e.getMessage());
-}
+  try {
+inputStream.close();
+  } catch (IOException e) {
+LOGGER.error("Fail to close config file input stream because {}", 
e.getMessage());
 
 Review comment:
   e.getMessage or e ?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251017259
 
 

 ##
 File path: iotdb/src/main/java/org/apache/iotdb/db/sql/parse/AstErrorNode.java
 ##
 @@ -26,7 +26,7 @@
 public class AstErrorNode extends AstNode {
 
   private static final long serialVersionUID = 1L;
-  CommonErrorNode delegate;
+  transient CommonErrorNode delegate;
 
 Review comment:
   add comment for adding transient


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251007460
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/RemoveNotOptimizer.java
 ##
 @@ -28,9 +28,13 @@
 import org.apache.iotdb.db.qp.constant.SQLConstant;
 import org.apache.iotdb.db.qp.logical.crud.BasicFunctionOperator;
 import org.apache.iotdb.db.qp.logical.crud.FilterOperator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class RemoveNotOptimizer implements IFilterOptimizer {
 
+  private static final Logger LOG = 
LoggerFactory.getLogger(RemoveNotOptimizer.class);
 
 Review comment:
   LOGGER


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251015060
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/query/executor/EngineExecutorWithoutTimeGenerator.java
 ##
 @@ -110,25 +127,43 @@ public QueryDataSet executeWithoutFilter()
   QueryDataSource queryDataSource = 
QueryDataSourceManager.getQueryDataSource(jobId, path);
 
   // add data type
-  dataTypes.add(MManager.getInstance().getSeriesType(path.getFullPath()));
+  try {
+
dataTypes.add(MManager.getInstance().getSeriesType(path.getFullPath()));
+  } catch (PathErrorException e) {
+throw new FileNodeManagerException(e);
+  }
 
   PriorityMergeReader priorityReader = new PriorityMergeReader();
 
   // sequence insert data
-  SequenceDataReader tsFilesReader = new 
SequenceDataReader(queryDataSource.getSeqDataSource(),
-  null);
-  priorityReader.addReaderWithPriority(tsFilesReader, 1);
+  SequenceDataReader tsFilesReader = null;
+  try {
+tsFilesReader = new 
SequenceDataReader(queryDataSource.getSeqDataSource(),
+null);
+priorityReader.addReaderWithPriority(tsFilesReader, 1);
+  } catch (IOException e) {
+throw new FileNodeManagerException(e);
+  }
 
   // unseq insert data
-  PriorityMergeReader unSeqMergeReader = SeriesReaderFactory.getInstance()
-  
.createUnSeqMergeReader(queryDataSource.getOverflowSeriesDataSource(), null);
-  priorityReader.addReaderWithPriority(unSeqMergeReader, 2);
+  PriorityMergeReader unSeqMergeReader = null;
+  try {
+unSeqMergeReader = SeriesReaderFactory.getInstance()
+
.createUnSeqMergeReader(queryDataSource.getOverflowSeriesDataSource(), null);
+priorityReader.addReaderWithPriority(unSeqMergeReader, 2);
+  } catch (IOException e) {
+throw new FileNodeManagerException(e);
+  }
 
   readersOfSelectedSeries.add(priorityReader);
 }
 
-return new 
EngineDataSetWithoutTimeGenerator(queryExpression.getSelectedSeries(), 
dataTypes,
-readersOfSelectedSeries);
+try {
+  return new 
EngineDataSetWithoutTimeGenerator(queryExpression.getSelectedSeries(), 
dataTypes,
 
 Review comment:
   Using `FileNodeManagerException` to encapsulate the `IOException` and 
`PathErrorException` is confusing.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251006247
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/DnfFilterOptimizer.java
 ##
 @@ -40,6 +40,15 @@ public FilterOperator optimize(FilterOperator filter) 
throws LogicalOptimizeExce
 return getDnf(filter);
   }
 
+  private void dealWithLeftAndRightAndChildren(List 
leftAndChildren, List rightAndChildren, List 
newChildrenList) throws LogicalOptimizeException {
+for (FilterOperator laChild : leftAndChildren) {
 
 Review comment:
   laChild? what's the meaning


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251007362
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/MergeSingleFilterOptimizer.java
 ##
 @@ -127,7 +130,11 @@ private Path mergeSamePathFilter(FilterOperator filter) 
throws LogicalOptimizeEx
 ret.add(newFil);
   }
 }
-// add last null children
+// add last null child
+return addLastNullChild(children, ret, filter, i, childPath);
+  }
+
+  private Path addLastNullChild(List children, 
List ret, FilterOperator filter, int i, Path childPath){
 
 Review comment:
   format
   and code too length


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251017001
 
 

 ##
 File path: iotdb/src/main/java/org/apache/iotdb/db/sql/ParseGenerator.java
 ##
 @@ -28,6 +28,8 @@
  */
 public final class ParseGenerator {
 
+  private ParseGenerator(){}
 
 Review comment:
   format


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251008326
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/query/control/FileReaderManager.java
 ##
 @@ -196,5 +197,7 @@ public ServiceType getID() {
 
   private static class FileReaderManagerHelper {
 private static final FileReaderManager INSTANCE = new FileReaderManager();
+
+private FileReaderManagerHelper(){ }
 
 Review comment:
   format


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251015194
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/query/factory/SeriesReaderFactory.java
 ##
 @@ -169,5 +169,7 @@ private IReader createSealedTsFileReaderForMerge(String 
filePath,
 
   private static class SeriesReaderFactoryHelper {
 private static final SeriesReaderFactory INSTANCE = new 
SeriesReaderFactory();
+
+private SeriesReaderFactoryHelper(){}
 
 Review comment:
   format


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Beyyes commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251016544
 
 

 ##
 File path: iotdb/src/main/java/org/apache/iotdb/db/service/JDBCService.java
 ##
 @@ -158,14 +160,16 @@ private synchronized void close() {
   private static class JDBCServiceHolder {
 
 private static final JDBCService INSTANCE = new JDBCService();
+
+private JDBCServiceHolder(){}
 
 Review comment:
   format 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #32: fix sonar issues

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #32: fix sonar issues
URL: https://github.com/apache/incubator-iotdb/pull/32#discussion_r251019250
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/SerializeUtil.java
 ##
 @@ -6,9 +6,9 @@
  * 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
- *
+ * 
 
 Review comment:
   licnse


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #32: fix sonar issues

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #32: fix sonar issues
URL: https://github.com/apache/incubator-iotdb/pull/32#discussion_r251019575
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/engine/memcontrol/BasicMemController.java
 ##
 @@ -6,9 +6,9 @@
  * 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
- *
+ * 
 
 Review comment:
   license


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #32: fix sonar issues

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #32: fix sonar issues
URL: https://github.com/apache/incubator-iotdb/pull/32#discussion_r251009068
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeManager.java
 ##
 @@ -127,57 +126,53 @@ public static FileNodeManager getInstance() {
 
   private void updateStatHashMapWhenFail(TSRecord tsRecord) {
 
statParamsHashMap.get(MonitorConstants.FileNodeManagerStatConstants.TOTAL_REQ_FAIL.name())
-.incrementAndGet();
+.incrementAndGet();
 
statParamsHashMap.get(MonitorConstants.FileNodeManagerStatConstants.TOTAL_POINTS_FAIL.name())
-.addAndGet(tsRecord.dataPointList.size());
+.addAndGet(tsRecord.dataPointList.size());
   }
 
   /**
* get stats parameter hash map.
*
* @return the key represents the params' name, values is AtomicLong type
*/
-  public HashMap getStatParamsHashMap() {
+  @Override
+  public Map getStatParamsHashMap() {
 return statParamsHashMap;
   }
 
   @Override
   public List getAllPathForStatistic() {
 List list = new ArrayList<>();
 for (MonitorConstants.FileNodeManagerStatConstants statConstant :
-MonitorConstants.FileNodeManagerStatConstants.values()) {
+MonitorConstants.FileNodeManagerStatConstants.values()) {
   list.add(
-  statStorageDeltaName + MonitorConstants.MONITOR_PATH_SEPERATOR + 
statConstant.name());
+  statStorageDeltaName + MonitorConstants.MONITOR_PATH_SEPERATOR + 
statConstant.name());
 }
 return list;
   }
 
   @Override
-  public HashMap getAllStatisticsValue() {
+  public Map getAllStatisticsValue() {
 long curTime = System.currentTimeMillis();
 TSRecord tsRecord = StatMonitor
-.convertToTSRecord(getStatParamsHashMap(), statStorageDeltaName, 
curTime);
-return new HashMap() {
-  {
-put(statStorageDeltaName, tsRecord);
-  }
-};
+.convertToTSRecord(getStatParamsHashMap(), statStorageDeltaName, 
curTime);
+HashMap ret = new HashMap<>();
+ret.put(statStorageDeltaName, tsRecord);
+return ret;
   }
 
   /**
* Init Stat MetaDta TODO: Modify the throws operation.
*/
   @Override
   public void registStatMetadata() {
-HashMap hashMap = new HashMap() {
-  {
-for (MonitorConstants.FileNodeManagerStatConstants statConstant :
+HashMap hashMap = new HashMap<>();
 
 Review comment:
   maybe claim a variable with a generic interface?
   Map<> hashMap = new HashMap<>()


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #32: fix sonar issues

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #32: fix sonar issues
URL: https://github.com/apache/incubator-iotdb/pull/32#discussion_r251020548
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/engine/memcontrol/RecordMemController.java
 ##
 @@ -6,9 +6,9 @@
  * 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
- *
+ * 
 
 Review comment:
   license


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #32: fix sonar issues

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #32: fix sonar issues
URL: https://github.com/apache/incubator-iotdb/pull/32#discussion_r251020325
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/engine/memcontrol/MemStatisticThread.java
 ##
 @@ -6,9 +6,9 @@
  * 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
- *
+ * 
 
 Review comment:
   license


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #32: fix sonar issues

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #32: fix sonar issues
URL: https://github.com/apache/incubator-iotdb/pull/32#discussion_r251020502
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/engine/memcontrol/Policy.java
 ##
 @@ -6,9 +6,9 @@
  * 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
- *
+ * 
 
 Review comment:
   license


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #32: fix sonar issues

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #32: fix sonar issues
URL: https://github.com/apache/incubator-iotdb/pull/32#discussion_r251020121
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/engine/memcontrol/JVMMemController.java
 ##
 @@ -6,9 +6,9 @@
  * 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
- *
+ * 
 
 Review comment:
   license


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #32: fix sonar issues

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #32: fix sonar issues
URL: https://github.com/apache/incubator-iotdb/pull/32#discussion_r251007902
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeManager.java
 ##
 @@ -6,9 +6,9 @@
  * 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
- *
+ * 
 
 Review comment:
   don't modify license


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #32: fix sonar issues

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #32: fix sonar issues
URL: https://github.com/apache/incubator-iotdb/pull/32#discussion_r251016931
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeProcessor.java
 ##
 @@ -6,9 +6,9 @@
  * 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
- *
+ * 
 
 Review comment:
   no change license


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #32: fix sonar issues

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #32: fix sonar issues
URL: https://github.com/apache/incubator-iotdb/pull/32#discussion_r251019868
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/engine/memcontrol/FlushPartialPolicy.java
 ##
 @@ -6,9 +6,9 @@
  * 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
- *
+ * 
 
 Review comment:
   license


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #32: fix sonar issues

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #32: fix sonar issues
URL: https://github.com/apache/incubator-iotdb/pull/32#discussion_r251019139
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/IntervalFileNode.java
 ##
 @@ -6,9 +6,9 @@
  * 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
- *
+ * 
 
 Review comment:
   license


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #32: fix sonar issues

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #32: fix sonar issues
URL: https://github.com/apache/incubator-iotdb/pull/32#discussion_r251019986
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/engine/memcontrol/ForceFLushAllPolicy.java
 ##
 @@ -6,9 +6,9 @@
  * 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
- *
+ * 
 
 Review comment:
   license


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251022573
 
 

 ##
 File path: 
iotdb/src/test/java/org/apache/iotdb/db/postback/sender/FileManagerTest.java
 ##
 @@ -229,46 +228,46 @@ public void testGetNowLocalFileList() throws IOException 
{
 if (!file.getParentFile().exists()) {
   file.getParentFile().mkdirs();
 }
-if (!file.exists()) {
-  file.createNewFile();
+if (!file.exists() && !file.createNewFile()) {
+  LOGGER.error("Can not create new file {}", file.getAbsoluteFile());
 }
   }
 }
-manager.setNowLocalFiles(new HashMap<>());
-manager.getNowLocalFileList(new String[]{SENDER_FILE_PATH_TEST});
-fileList = manager.getNowLocalFiles();
+manager.setCurrentLocalFiles(new HashMap<>());
+manager.getCurrentLocalFileList(new String[]{SENDER_FILE_PATH_TEST});
+fileList = manager.getCurrentLocalFiles();
 assert (allFileList.size() == fileList.size());
 for (Entry> entry : fileList.entrySet()) {
   assert (allFileList.containsKey(entry.getKey()));
-  System.out.println("allFileList");
+  LOGGER.info("allFileList");
 
 Review comment:
   good advice


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251024453
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java
 ##
 @@ -59,29 +61,39 @@ public Operator transform(Operator operator) throws 
LogicalOptimizeException {
 SFWOperator sfwOperator = (SFWOperator) operator;
 FromOperator from = sfwOperator.getFromOperator();
 List prefixPaths;
-if (from == null || (prefixPaths = from.getPrefixPaths()).isEmpty()) {
+if (from == null){
   LOG.warn("given SFWOperator doesn't have prefix paths, cannot concat 
seriesPath");
   return operator;
+} else {
+  prefixPaths = from.getPrefixPaths();
+  if (prefixPaths.isEmpty()) {
+LOG.warn("given SFWOperator doesn't have prefix paths, cannot concat 
seriesPath");
+return operator;
+  }
 }
 SelectOperator select = sfwOperator.getSelectOperator();
 List initialSuffixPaths;
-if (select == null || (initialSuffixPaths = 
select.getSuffixPaths()).isEmpty()) {
-  LOG.warn("given SFWOperator doesn't have suffix paths, cannot concat 
seriesPath");
+if (select == null){
 
 Review comment:
   outdated


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251025083
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/DnfFilterOptimizer.java
 ##
 @@ -40,6 +40,15 @@ public FilterOperator optimize(FilterOperator filter) 
throws LogicalOptimizeExce
 return getDnf(filter);
   }
 
+  private void dealWithLeftAndRightAndChildren(List 
leftAndChildren, List rightAndChildren, List 
newChildrenList) throws LogicalOptimizeException {
+for (FilterOperator laChild : leftAndChildren) {
 
 Review comment:
   fixed


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jt2594838 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jt2594838 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251021001
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/query/executor/EngineQueryRouter.java
 ##
 @@ -73,18 +73,14 @@ public QueryDataSet query(QueryExpression queryExpression)
   return engineExecutor.execute();
 }
 
-  } catch (QueryFilterOptimizationException | PathErrorException e) {
-throw new IOException(e);
+  } catch (QueryFilterOptimizationException e) {
+throw new FileNodeManagerException(new IOException(e));
 
 Review comment:
   Why wrapping with an IOException.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jt2594838 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jt2594838 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251008757
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/postback/receiver/ServerServiceImpl.java
 ##
 @@ -320,318 +331,298 @@ public void afterReceiving() {
*/
   @Override
   public void getFileNodeInfo() throws TException {
-// String filePath = postbackPath + uuid.get() + File.separator + "data";
-// File root = new File(filePath);
-// File[] files = root.listFiles();
-// int num = 0;
-// for (File storageGroupPB : files) {
-// List filesPath = new ArrayList<>();
-// File[] filesSG = storageGroupPB.listFiles();
-// for (File fileTF : filesSG) { // fileTF means TsFiles
-// Map startTimeMap = new HashMap<>();
-// Map endTimeMap = new HashMap<>();
-// TsRandomAccessLocalFileReader input = null;
-// try {
-// input = new TsRandomAccessLocalFileReader(fileTF.getAbsolutePath());
-// FileReader reader = new FileReader(input);
-// Map deviceIdMap = 
reader.getFileMetaData().getDeviceMap();
-// Iterator it = deviceIdMap.keySet().iterator();
-// while (it.hasNext()) {
-// String key = it.next().toString(); // key represent device
-// TsDevice deltaObj = deviceIdMap.get(key);
-// startTimeMap.put(key, deltaObj.startTime);
-// endTimeMap.put(key, deltaObj.endTime);
-// }
-// } catch (Exception e) {
-// LOGGER.error("IoTDB post back receiver: unable to read tsfile {} 
because {}",
-// fileTF.getAbsolutePath(), e.getMessage());
-// } finally {
-// try {
-// input.close();
-// } catch (IOException e) {
-// LOGGER.error("IoTDB receiver : Cannot close file stream {} because {}",
-// fileTF.getAbsolutePath(), e.getMessage());
-// }
-// }
-// fileNodeStartTime.get().put(fileTF.getAbsolutePath(), startTimeMap);
-// fileNodeEndTime.get().put(fileTF.getAbsolutePath(), endTimeMap);
-// filesPath.add(fileTF.getAbsolutePath());
-// num++;
-// LOGGER.info("IoTDB receiver : Getting FileNode Info has complete : " + 
num + "/" +
-// fileNum.get());
-// }
-// fileNodeMap.get().put(storageGroupPB.getName(), filesPath);
-// }
+String filePath = postbackPath + uuid.get() + File.separator + "data";
+File root = new File(filePath);
+File[] files = root.listFiles();
+int num = 0;
+for (File storageGroupPB : files) {
+  List filesPath = new ArrayList<>();
+  File[] filesSG = storageGroupPB.listFiles();
+  for (File fileTF : filesSG) { // fileTF means TsFiles
+Map startTimeMap = new HashMap<>();
+Map endTimeMap = new HashMap<>();
+TsFileSequenceReader reader = null;
+try {
+  reader = new TsFileSequenceReader(fileTF.getAbsolutePath());
+  Map deviceIdMap = 
reader.readFileMetadata().getDeviceMap();
+  Iterator it = deviceIdMap.keySet().iterator();
+  while (it.hasNext()) {
+String key = it.next(); // key represent device
+TsDeviceMetadataIndex device = deviceIdMap.get(key);
+startTimeMap.put(key, device.getStartTime());
+endTimeMap.put(key, device.getEndTime());
+  }
+} catch (Exception e) {
+  LOGGER.error("IoTDB post back receiver: unable to read tsfile {} 
because {}",
+  fileTF.getAbsolutePath(), e.getMessage());
+} finally {
+  try {
+if (reader != null) {
+  reader.close();
+}
+  } catch (IOException e) {
+LOGGER.error("IoTDB receiver : Cannot close file stream {} because 
{}",
+fileTF.getAbsolutePath(), e.getMessage());
+  }
+}
+fileNodeStartTime.get().put(fileTF.getAbsolutePath(), startTimeMap);
+fileNodeEndTime.get().put(fileTF.getAbsolutePath(), endTimeMap);
+filesPath.add(fileTF.getAbsolutePath());
+num++;
+LOGGER.info(String
+.format("IoTDB receiver : Getting FileNode Info has complete : 
%d/%d", num,
+fileNum.get()));
+  }
+  fileNodeMap.get().put(storageGroupPB.getName(), filesPath);
+}
   }
 
   /**
* Insert all data in the tsfile into IoTDB.
*/
   @Override
   public void mergeOldData(String filePath) throws TException {
-// Set timeseries = new HashSet<>();
-// TsRandomAccessLocalFileReader input = null;
-// Connection connection = null;
-// Statement statement = null;
-// try {
-// Class.forName(JDBC_DRIVER_NAME);
-// connection = DriverManager.getConnection("jdbc:iotdb://localhost:" +
-// tsfileDBConfig.rpcPort + "/", "root",
-// "root");
-// statement = connection.createStatement();
-// int count = 0;
-//
-// input = new TsRandomAccessLocalFileReader(filePath);
-// FileReader reader = new FileReader(input);
-// Map deviceIdMap = 
reader.getFileMetaData().getDeviceMap();

[GitHub] jt2594838 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jt2594838 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251010380
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/postback/receiver/ServerServiceImpl.java
 ##
 @@ -320,318 +331,298 @@ public void afterReceiving() {
*/
   @Override
   public void getFileNodeInfo() throws TException {
-// String filePath = postbackPath + uuid.get() + File.separator + "data";
-// File root = new File(filePath);
-// File[] files = root.listFiles();
-// int num = 0;
-// for (File storageGroupPB : files) {
-// List filesPath = new ArrayList<>();
-// File[] filesSG = storageGroupPB.listFiles();
-// for (File fileTF : filesSG) { // fileTF means TsFiles
-// Map startTimeMap = new HashMap<>();
-// Map endTimeMap = new HashMap<>();
-// TsRandomAccessLocalFileReader input = null;
-// try {
-// input = new TsRandomAccessLocalFileReader(fileTF.getAbsolutePath());
-// FileReader reader = new FileReader(input);
-// Map deviceIdMap = 
reader.getFileMetaData().getDeviceMap();
-// Iterator it = deviceIdMap.keySet().iterator();
-// while (it.hasNext()) {
-// String key = it.next().toString(); // key represent device
-// TsDevice deltaObj = deviceIdMap.get(key);
-// startTimeMap.put(key, deltaObj.startTime);
-// endTimeMap.put(key, deltaObj.endTime);
-// }
-// } catch (Exception e) {
-// LOGGER.error("IoTDB post back receiver: unable to read tsfile {} 
because {}",
-// fileTF.getAbsolutePath(), e.getMessage());
-// } finally {
-// try {
-// input.close();
-// } catch (IOException e) {
-// LOGGER.error("IoTDB receiver : Cannot close file stream {} because {}",
-// fileTF.getAbsolutePath(), e.getMessage());
-// }
-// }
-// fileNodeStartTime.get().put(fileTF.getAbsolutePath(), startTimeMap);
-// fileNodeEndTime.get().put(fileTF.getAbsolutePath(), endTimeMap);
-// filesPath.add(fileTF.getAbsolutePath());
-// num++;
-// LOGGER.info("IoTDB receiver : Getting FileNode Info has complete : " + 
num + "/" +
-// fileNum.get());
-// }
-// fileNodeMap.get().put(storageGroupPB.getName(), filesPath);
-// }
+String filePath = postbackPath + uuid.get() + File.separator + "data";
+File root = new File(filePath);
+File[] files = root.listFiles();
+int num = 0;
+for (File storageGroupPB : files) {
+  List filesPath = new ArrayList<>();
+  File[] filesSG = storageGroupPB.listFiles();
+  for (File fileTF : filesSG) { // fileTF means TsFiles
+Map startTimeMap = new HashMap<>();
+Map endTimeMap = new HashMap<>();
+TsFileSequenceReader reader = null;
+try {
+  reader = new TsFileSequenceReader(fileTF.getAbsolutePath());
+  Map deviceIdMap = 
reader.readFileMetadata().getDeviceMap();
+  Iterator it = deviceIdMap.keySet().iterator();
+  while (it.hasNext()) {
+String key = it.next(); // key represent device
+TsDeviceMetadataIndex device = deviceIdMap.get(key);
+startTimeMap.put(key, device.getStartTime());
+endTimeMap.put(key, device.getEndTime());
+  }
+} catch (Exception e) {
+  LOGGER.error("IoTDB post back receiver: unable to read tsfile {} 
because {}",
+  fileTF.getAbsolutePath(), e.getMessage());
+} finally {
+  try {
+if (reader != null) {
+  reader.close();
+}
+  } catch (IOException e) {
+LOGGER.error("IoTDB receiver : Cannot close file stream {} because 
{}",
+fileTF.getAbsolutePath(), e.getMessage());
+  }
+}
+fileNodeStartTime.get().put(fileTF.getAbsolutePath(), startTimeMap);
+fileNodeEndTime.get().put(fileTF.getAbsolutePath(), endTimeMap);
+filesPath.add(fileTF.getAbsolutePath());
+num++;
+LOGGER.info(String
+.format("IoTDB receiver : Getting FileNode Info has complete : 
%d/%d", num,
+fileNum.get()));
+  }
+  fileNodeMap.get().put(storageGroupPB.getName(), filesPath);
+}
   }
 
   /**
* Insert all data in the tsfile into IoTDB.
*/
   @Override
   public void mergeOldData(String filePath) throws TException {
-// Set timeseries = new HashSet<>();
-// TsRandomAccessLocalFileReader input = null;
-// Connection connection = null;
-// Statement statement = null;
-// try {
-// Class.forName(JDBC_DRIVER_NAME);
-// connection = DriverManager.getConnection("jdbc:iotdb://localhost:" +
-// tsfileDBConfig.rpcPort + "/", "root",
-// "root");
-// statement = connection.createStatement();
-// int count = 0;
-//
-// input = new TsRandomAccessLocalFileReader(filePath);
-// FileReader reader = new FileReader(input);
-// Map deviceIdMap = 
reader.getFileMetaData().getDeviceMap();

[GitHub] jt2594838 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jt2594838 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251020592
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/query/executor/EngineExecutorWithoutTimeGenerator.java
 ##
 @@ -71,33 +71,50 @@ public QueryDataSet executeWithGlobalTimeFilter()
   QueryDataSource queryDataSource = 
QueryDataSourceManager.getQueryDataSource(jobId, path);
 
   // add data type
-  dataTypes.add(MManager.getInstance().getSeriesType(path.getFullPath()));
+  try {
+
dataTypes.add(MManager.getInstance().getSeriesType(path.getFullPath()));
+  } catch (PathErrorException e) {
+throw new FileNodeManagerException(e);
+  }
 
   PriorityMergeReader priorityReader = new PriorityMergeReader();
 
   // sequence reader for one sealed tsfile
-  SequenceDataReader tsFilesReader = new 
SequenceDataReader(queryDataSource.getSeqDataSource(),
-  timeFilter);
-  priorityReader.addReaderWithPriority(tsFilesReader, 1);
+  SequenceDataReader tsFilesReader = null;
+  try {
+tsFilesReader = new 
SequenceDataReader(queryDataSource.getSeqDataSource(),
+timeFilter);
+priorityReader.addReaderWithPriority(tsFilesReader, 1);
+  } catch (IOException e) {
+throw new FileNodeManagerException(e);
+  }
 
   // unseq reader for all chunk groups in unSeqFile
-  PriorityMergeReader unSeqMergeReader = SeriesReaderFactory.getInstance()
-  
.createUnSeqMergeReader(queryDataSource.getOverflowSeriesDataSource(), 
timeFilter);
-  priorityReader.addReaderWithPriority(unSeqMergeReader, 2);
+  PriorityMergeReader unSeqMergeReader = null;
+  try {
+unSeqMergeReader = SeriesReaderFactory.getInstance()
+
.createUnSeqMergeReader(queryDataSource.getOverflowSeriesDataSource(), 
timeFilter);
+priorityReader.addReaderWithPriority(unSeqMergeReader, 2);
 
 Review comment:
   These 1 and 2 are confusing.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jt2594838 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jt2594838 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251001304
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/postback/receiver/ServerServiceImpl.java
 ##
 @@ -129,13 +142,13 @@ public String startReceiving(String md5OfSender, 
List filePathSplit,
   ByteBuffer dataToReceive, int status) throws TException {
 String md5OfReceiver = "";
 String filePath = "";
-FileOutputStream fos = null;
 FileChannel channel = null;
 for (int i = 0; i < filePathSplit.size(); i++) {
   if (i == filePathSplit.size() - 1) {
-filePath = filePath + filePathSplit.get(i);
+filePath = new 
StringBuilder().append(filePath).append(filePathSplit.get(i)).toString();
   } else {
-filePath = filePath + filePathSplit.get(i) + File.separator;
+filePath = new 
StringBuilder().append(filePath).append(filePathSplit.get(i))
+.append(File.separator).toString();
 
 Review comment:
   This is not how a StringBuilder works. You should initialize a single 
StringBuilder, call append() in the loop and call toString() when the loop ends.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jt2594838 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jt2594838 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251024941
 
 

 ##
 File path: tsfile/src/main/java/org/apache/iotdb/tsfile/read/common/Path.java
 ##
 @@ -216,4 +220,13 @@ public boolean startWith(String prefix) {
   public boolean startWith(Path prefix) {
 return startWith(prefix.fullPath);
   }
+
+  public static void main(String[] args) {
+Logger logger = LoggerFactory.getLogger(Path.class);
+try {
+  throw new IOException("asdasda");
+} catch (IOException e1) {
+  logger.error("read line from inputCsvFileReader failed:{}", ".file", 
"as",e1);
+}
+  }
 
 Review comment:
   What is this main for?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jt2594838 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jt2594838 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251001698
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/postback/receiver/ServerServiceImpl.java
 ##
 @@ -144,40 +157,37 @@ public String startReceiving(String md5OfSender, 
List filePathSplit,
   if (!file.getParentFile().exists()) {
 try {
   file.getParentFile().mkdirs();
-  file.createNewFile();
+  if (file.createNewFile()) {
+LOGGER.error("IoTDB post back receiver: cannot create file {}", 
file.getAbsoluteFile());
+  }
 
 Review comment:
   createNewFile() returns true when the file cannot be created?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251025334
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/MergeSingleFilterOptimizer.java
 ##
 @@ -127,7 +130,11 @@ private Path mergeSamePathFilter(FilterOperator filter) 
throws LogicalOptimizeEx
 ret.add(newFil);
   }
 }
-// add last null children
+// add last null child
+return addLastNullChild(children, ret, filter, i, childPath);
+  }
+
+  private Path addLastNullChild(List children, 
List ret, FilterOperator filter, int i, Path childPath){
 
 Review comment:
   fixed


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251025399
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/RemoveNotOptimizer.java
 ##
 @@ -28,9 +28,13 @@
 import org.apache.iotdb.db.qp.constant.SQLConstant;
 import org.apache.iotdb.db.qp.logical.crud.BasicFunctionOperator;
 import org.apache.iotdb.db.qp.logical.crud.FilterOperator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class RemoveNotOptimizer implements IFilterOptimizer {
 
+  private static final Logger LOG = 
LoggerFactory.getLogger(RemoveNotOptimizer.class);
 
 Review comment:
   unaffected


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jt2594838 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jt2594838 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251022756
 
 

 ##
 File path: iotdb/src/main/java/org/apache/iotdb/db/utils/AuthUtils.java
 ##
 @@ -185,16 +193,12 @@ public static boolean checkPrivilege(String path, int 
privilegeId,
 }
 for (PathPrivilege pathPrivilege : privilegeList) {
   if (path != null) {
-if (pathPrivilege.getPath() != null && AuthUtils.pathBelongsTo(path, 
pathPrivilege.getPath())) {
-  if (pathPrivilege.getPrivileges().contains(privilegeId)) {
-return true;
-  }
+if (pathPrivilege.getPath() != null && AuthUtils.pathBelongsTo(path, 
pathPrivilege.getPath()) && 
pathPrivilege.getPrivileges().contains(privilegeId)) {
 
 Review comment:
   This line is too long.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jt2594838 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jt2594838 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251002597
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/postback/receiver/ServerServiceImpl.java
 ##
 @@ -144,40 +157,37 @@ public String startReceiving(String md5OfSender, 
List filePathSplit,
   if (!file.getParentFile().exists()) {
 try {
   file.getParentFile().mkdirs();
-  file.createNewFile();
+  if (file.createNewFile()) {
+LOGGER.error("IoTDB post back receiver: cannot create file {}", 
file.getAbsoluteFile());
+  }
 } catch (IOException e) {
   LOGGER.error("IoTDB post back receiver: cannot make file because 
{}", e.getMessage());
 }
   }
-  try {
-fos = new FileOutputStream(file, true); // append new data
+  try (FileOutputStream fos = new FileOutputStream(file, true)) {// append 
new data
 channel = fos.getChannel();
 channel.write(dataToReceive);
-channel.close();
-fos.close();
   } catch (Exception e) {
 LOGGER.error("IoTDB post back receiver: cannot write data to file 
because {}",
 e.getMessage());
 
 Review comment:
   Another lost stack trace. 
   Is the use of generic class Exception necessary?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jt2594838 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jt2594838 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251005026
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/postback/receiver/ServerServiceImpl.java
 ##
 @@ -193,32 +203,30 @@ public String startReceiving(String md5OfSender, 
List filePathSplit,
* IoTDB through jdbc status = 1 : the schema file has not received 
completely.
*/
   @Override
-  public void getSchema(ByteBuffer schema, int status) throws TException {
-FileOutputStream fos = null;
-FileChannel channel = null;
+  public void getSchema(ByteBuffer schema, int status) {
+FileOutputStream fos;
+FileChannel channel;
 if (status == 0) {
-  Connection connection = null;
   Statement statement = null;
-  try {
+  try (Connection connection = 
DriverManager.getConnection("jdbc:iotdb://localhost:" +
+  config.rpcPort + "/", "root", "root")) {
 
 Review comment:
   If you intend to use the super-user, you may refer the account and password 
in IoTDBConstant.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jt2594838 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jt2594838 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r250999190
 
 

 ##
 File path: iotdb/src/main/java/org/apache/iotdb/db/metadata/ColumnSchema.java
 ##
 @@ -28,7 +28,11 @@
 
   private static final long serialVersionUID = -8257474930341487207L;
 
-  public String name;
+  public void setName(String name) {
+this.name = name;
+  }
+
+  private String name;
 
 Review comment:
   It seems a bit strange to insert a method between fields.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jt2594838 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jt2594838 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r25134
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/postback/conf/PostBackSenderDescriptor.java
 ##
 @@ -87,46 +87,42 @@ private void loadProps() {
 try {
   properties.load(inputStream);
 
-  conf.serverIp = properties.getProperty("server_ip", conf.serverIp);
-  conf.serverPort = Integer
-  .parseInt(properties.getProperty("server_port", conf.serverPort + 
""));
+  conf.setServerIp(properties.getProperty("server_ip", 
conf.getServerIp()));
+  conf.setServerPort(Integer
+  .parseInt(properties.getProperty("server_port", conf.getServerPort() 
+ "")));
 
-  conf.clientPort = Integer
-  .parseInt(properties.getProperty("client_port", conf.clientPort + 
""));
-  conf.uploadCycleInSeconds = Integer
-  .parseInt(
-  properties.getProperty("upload_cycle_in_seconds", 
conf.uploadCycleInSeconds + ""));
-  conf.schemaPath = properties.getProperty("iotdb_schema_directory", 
conf.schemaPath);
-  conf.isClearEnable = Boolean
-  .parseBoolean(properties.getProperty("is_clear_enable", 
conf.isClearEnable + ""));
-  conf.uuidPath = conf.dataDirectory + "postback" + File.separator + 
"uuid.txt";
-  conf.lastFileInfo =
-  conf.dataDirectory + "postback" + File.separator + 
"lastLocalFileList.txt";
-
-  String[] snapshots = new String[conf.iotdbBufferwriteDirectory.length];
-  for (int i = 0; i < conf.iotdbBufferwriteDirectory.length; i++) {
-conf.iotdbBufferwriteDirectory[i] = new 
File(conf.iotdbBufferwriteDirectory[i])
-.getAbsolutePath();
-if (!conf.iotdbBufferwriteDirectory[i].endsWith(File.separator)) {
-  conf.iotdbBufferwriteDirectory[i] = 
conf.iotdbBufferwriteDirectory[i] + File.separator;
+  conf.setClientPort(Integer
+  .parseInt(properties.getProperty("client_port", conf.getClientPort() 
+ "")));
+  conf.setUploadCycleInSeconds(Integer.parseInt(properties
+  .getProperty("upload_cycle_in_seconds", 
conf.getUploadCycleInSeconds() + "")));
+  conf.setSchemaPath(properties.getProperty("iotdb_schema_directory", 
conf.getSchemaPath()));
+  conf.setClearEnable(Boolean
+  .parseBoolean(properties.getProperty("is_clear_enable", 
conf.getClearEnable() + "")));
+  conf.setUuidPath(conf.getDataDirectory() + POSTBACK + File.separator + 
"uuid.txt");
+  conf.setLastFileInfo(
+  conf.getDataDirectory() + POSTBACK + File.separator + 
"lastLocalFileList.txt");
+  String[] iotdbBufferwriteDirectory = conf.getIotdbBufferwriteDirectory();
+  String[] snapshots = new 
String[conf.getIotdbBufferwriteDirectory().length];
+  for (int i = 0; i < conf.getIotdbBufferwriteDirectory().length; i++) {
+iotdbBufferwriteDirectory[i] = new 
File(iotdbBufferwriteDirectory[i]).getAbsolutePath();
+if (!iotdbBufferwriteDirectory[i].endsWith(File.separator)) {
+  iotdbBufferwriteDirectory[i] = iotdbBufferwriteDirectory[i] + 
File.separator;
 }
-snapshots[i] =
-conf.iotdbBufferwriteDirectory[i] + "postback" + File.separator + 
"dataSnapshot"
-+ File.separator;
+snapshots[i] = iotdbBufferwriteDirectory[i] + POSTBACK + 
File.separator + "dataSnapshot"
++ File.separator;
   }
-  conf.snapshotPaths = snapshots;
+  conf.setIotdbBufferwriteDirectory(iotdbBufferwriteDirectory);
+  conf.setSnapshotPaths(snapshots);
 } catch (IOException e) {
   LOGGER.warn("Cannot load config file because {}, use default 
configuration", e.getMessage());
 } catch (Exception e) {
   LOGGER.warn("Error format in config file because {}, use default 
configuration",
   e.getMessage());
 } finally {
-  if (inputStream != null) {
-try {
-  inputStream.close();
-} catch (IOException e) {
-  LOGGER.error("Fail to close config file input stream because {}", 
e.getMessage());
-}
+  try {
+inputStream.close();
+  } catch (IOException e) {
+LOGGER.error("Fail to close config file input stream because {}", 
e.getMessage());
 
 Review comment:
   The stack trace is lost. Isn't this an issue?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jt2594838 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jt2594838 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251003971
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/postback/receiver/ServerServiceImpl.java
 ##
 @@ -144,40 +157,37 @@ public String startReceiving(String md5OfSender, 
List filePathSplit,
   if (!file.getParentFile().exists()) {
 try {
   file.getParentFile().mkdirs();
-  file.createNewFile();
+  if (file.createNewFile()) {
+LOGGER.error("IoTDB post back receiver: cannot create file {}", 
file.getAbsoluteFile());
+  }
 } catch (IOException e) {
   LOGGER.error("IoTDB post back receiver: cannot make file because 
{}", e.getMessage());
 }
   }
-  try {
-fos = new FileOutputStream(file, true); // append new data
+  try (FileOutputStream fos = new FileOutputStream(file, true)) {// append 
new data
 channel = fos.getChannel();
 channel.write(dataToReceive);
-channel.close();
-fos.close();
   } catch (Exception e) {
 LOGGER.error("IoTDB post back receiver: cannot write data to file 
because {}",
 e.getMessage());
   }
 } else { // all data in the same file has received successfully
-  try {
-FileInputStream fis = new FileInputStream(filePath);
+  try (FileInputStream fis = new FileInputStream(filePath)) {
 MessageDigest md = MessageDigest.getInstance("MD5");
 int mBufferSize = 8 * 1024 * 1024;
 byte[] buffer = new byte[mBufferSize];
 int n;
 while ((n = fis.read(buffer)) != -1) {
   md.update(buffer, 0, n);
 }
-fis.close();
 md5OfReceiver = (new BigInteger(1, md.digest())).toString(16);
 if (md5OfSender.equals(md5OfReceiver)) {
   fileNum.set(fileNum.get() + 1);
   LOGGER.info("IoTDB post back receiver : Receiver has received " + 
fileNum.get()
   + " "
   + "files from sender!");
 } else {
-  new File(filePath).delete();
+  Files.deleteIfExists((java.nio.file.Path) new Path(filePath));
 
 Review comment:
   I consider this problem settled, but I'll still leave a mark here in case 
something is missed.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jt2594838 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
jt2594838 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251005856
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/postback/receiver/ServerServiceImpl.java
 ##
 @@ -193,32 +203,30 @@ public String startReceiving(String md5OfSender, 
List filePathSplit,
* IoTDB through jdbc status = 1 : the schema file has not received 
completely.
*/
   @Override
-  public void getSchema(ByteBuffer schema, int status) throws TException {
-FileOutputStream fos = null;
-FileChannel channel = null;
+  public void getSchema(ByteBuffer schema, int status) {
+FileOutputStream fos;
+FileChannel channel;
 if (status == 0) {
-  Connection connection = null;
   Statement statement = null;
-  try {
+  try (Connection connection = 
DriverManager.getConnection("jdbc:iotdb://localhost:" +
+  config.rpcPort + "/", "root", "root")) {
 Class.forName(JDBC_DRIVER_NAME);
-connection = DriverManager.getConnection("jdbc:iotdb://localhost:" +
-tsfileDBConfig.rpcPort + "/", "root", "root");
 statement = connection.createStatement();
 
-BufferedReader bf;
-try {
-  bf = new BufferedReader(new 
java.io.FileReader(schemaFromSenderPath.get()));
+try (BufferedReader bf = new BufferedReader(
+new java.io.FileReader(schemaFromSenderPath.get( {
   String data;
   statement.clearBatch();
   int count = 0;
   while ((data = bf.readLine()) != null) {
-String item[] = data.split(",");
+String[] item = data.split(",");
 if (item[0].equals("2")) {
-  String sql = "SET STORAGE GROUP TO " + item[1];
+  String sql = String.format("SET STORAGE GROUP TO %s", item[1]);
   statement.addBatch(sql);
 } else if (item[0].equals("0")) {
-  String sql = "CREATE TIMESERIES " + item[1] + " WITH DATATYPE=" 
+ item[2]
-  + "," + " ENCODING=" + item[3];
+  String sql = String
+  .format("CREATE TIMESERIES %s WITH DATATYPE=%s, 
ENCODING=%s", item[1], item[2],
+  item[3]);
 
 Review comment:
   It is better to make the SQL templates some constants, while it is ok for me 
to leave them here.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251025712
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/query/control/FileReaderManager.java
 ##
 @@ -87,7 +87,7 @@ private void clearUnUsedFilesInFixTime() {
 try {
   reader.close();
 } catch (IOException e) {
-  LOGGER.error("Can not close TsFileSequenceReader {} !", 
reader.getFileName());
+  LOGGER.error("Can not close TsFileSequenceReader {} !", 
reader.getFileName() + ": " + e);
 
 Review comment:
   fixed


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251026096
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/query/executor/EngineExecutorWithoutTimeGenerator.java
 ##
 @@ -110,25 +127,43 @@ public QueryDataSet executeWithoutFilter()
   QueryDataSource queryDataSource = 
QueryDataSourceManager.getQueryDataSource(jobId, path);
 
   // add data type
-  dataTypes.add(MManager.getInstance().getSeriesType(path.getFullPath()));
+  try {
+
dataTypes.add(MManager.getInstance().getSeriesType(path.getFullPath()));
+  } catch (PathErrorException e) {
+throw new FileNodeManagerException(e);
+  }
 
   PriorityMergeReader priorityReader = new PriorityMergeReader();
 
   // sequence insert data
-  SequenceDataReader tsFilesReader = new 
SequenceDataReader(queryDataSource.getSeqDataSource(),
-  null);
-  priorityReader.addReaderWithPriority(tsFilesReader, 1);
+  SequenceDataReader tsFilesReader = null;
+  try {
+tsFilesReader = new 
SequenceDataReader(queryDataSource.getSeqDataSource(),
+null);
+priorityReader.addReaderWithPriority(tsFilesReader, 1);
+  } catch (IOException e) {
+throw new FileNodeManagerException(e);
+  }
 
   // unseq insert data
-  PriorityMergeReader unSeqMergeReader = SeriesReaderFactory.getInstance()
-  
.createUnSeqMergeReader(queryDataSource.getOverflowSeriesDataSource(), null);
-  priorityReader.addReaderWithPriority(unSeqMergeReader, 2);
+  PriorityMergeReader unSeqMergeReader = null;
+  try {
+unSeqMergeReader = SeriesReaderFactory.getInstance()
+
.createUnSeqMergeReader(queryDataSource.getOverflowSeriesDataSource(), null);
+priorityReader.addReaderWithPriority(unSeqMergeReader, 2);
+  } catch (IOException e) {
+throw new FileNodeManagerException(e);
+  }
 
   readersOfSelectedSeries.add(priorityReader);
 }
 
-return new 
EngineDataSetWithoutTimeGenerator(queryExpression.getSelectedSeries(), 
dataTypes,
-readersOfSelectedSeries);
+try {
+  return new 
EngineDataSetWithoutTimeGenerator(queryExpression.getSelectedSeries(), 
dataTypes,
 
 Review comment:
   discussed


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251025981
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/query/control/QueryTokenManager.java
 ##
 @@ -169,5 +169,7 @@ private void putQueryTokenForCurrentRequestThread(long 
jobId, String deviceId, i
 
   private static class QueryTokenManagerHelper {
 private static final QueryTokenManager INSTANCE = new QueryTokenManager();
+
+private QueryTokenManagerHelper(){}
 
 Review comment:
   fixed


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251026301
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/query/factory/SeriesReaderFactory.java
 ##
 @@ -169,5 +169,7 @@ private IReader createSealedTsFileReaderForMerge(String 
filePath,
 
   private static class SeriesReaderFactoryHelper {
 private static final SeriesReaderFactory INSTANCE = new 
SeriesReaderFactory();
+
+private SeriesReaderFactoryHelper(){}
 
 Review comment:
   fixed


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251026675
 
 

 ##
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/query/reader/sequence/SealedTsFilesReader.java
 ##
 @@ -90,22 +91,22 @@ public boolean hasNext() throws IOException {
   hasCachedData = true;
   return true;
 } else {
-  continue;
+  flag = true;
 }
   }
 
   // try to get next batch data from next reader
-  while (usedIntervalFileIndex < sealedTsFiles.size()) {
+  while (!flag && usedIntervalFileIndex < sealedTsFiles.size()) {
 // init until reach a satisfied reader
 if (seriesReader == null || !seriesReader.hasNextBatch()) {
   IntervalFileNode fileNode = 
sealedTsFiles.get(usedIntervalFileIndex++);
   if (singleTsFileSatisfied(fileNode)) {
 initSingleTsFileReader(fileNode);
   } else {
-continue;
+flag = true;
 
 Review comment:
   It's indeed a question


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251026912
 
 

 ##
 File path: iotdb/src/main/java/org/apache/iotdb/db/service/JDBCService.java
 ##
 @@ -158,14 +160,16 @@ private synchronized void close() {
   private static class JDBCServiceHolder {
 
 private static final JDBCService INSTANCE = new JDBCService();
+
+private JDBCServiceHolder(){}
 
 Review comment:
   fixed


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251027278
 
 

 ##
 File path: iotdb/src/main/java/org/apache/iotdb/db/service/Utils.java
 ##
 @@ -1,19 +1,15 @@
 /**
- * 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
+ * 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
+ * http://www.apache.org/licenses/LICENSE-2.0
 
 Review comment:
   restored


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251027948
 
 

 ##
 File path: iotdb/src/main/java/org/apache/iotdb/db/service/Utils.java
 ##
 @@ -1,19 +1,15 @@
 /**
- * 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
+ * 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
+ * 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
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
 
 Review comment:
   it may is outdated 


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


Re: How to prevent GitBox from sending too many commit notifications

2019-01-25 Thread Christofer Dutz
+1 as long as important discussions still get done here and not in announce 

We just got 69 emails in half an hour ... no one will be reading though these 
in this sort of volume)
And even searching is almost impossible.

Chris

Am 25.01.19, 15:37 schrieb "毛东方" :

+1, appreciate.

> 在 2019年1月25日,下午9:11,Xiangdong Huang  写道:
> 
> Hi all,
> 
> I find another project has the similar problem, and finally they send all
> code-reviews to the reviews@  (see [1]).
> 
> I think that it also fits us. As for the dev@, we can discuss about the
> issues about Infrastructures (e.g., how to use CI, how to keep code
> quality), new features, bugs, performance problems etc. These contents are
> more valuable.
> 
> If someone wants to keep tracking with code-reviews or freshman, he can
> subscribe the reviews@ mail list.
> 
> For experienced programmers,  they can focus on the contents on dev@
> 
> If all of you agree with it, I will try to open a ticket on JIRA INFRA.
> 
> Reference:
> [1]
> 
https://issues.apache.org/jira/browse/INFRA-12404?jql=text%20~%20%22github%20review%22%20AND%20%20project%20%20%3D%20Infrastructure
> 
> Best,
> ---
> Xiangdong Huang
> School of Software, Tsinghua University
> 
> 黄向东
> 清华大学 软件学院
> 
> 
> 江天  于2019年1月25日周五 上午10:34写道:
> 
>> I like the idea of being highly transparent, but we hope to know some
>> tricks of doing this. Do we have to paste the code in the mails or just
>> tell someone what problem which line in which file has? Both of these 
seem
>> tiring.
>> 
>>> 在 2019年1月25日,上午1:08,Justin Mclean  写道:
>>> 
>>> Hi,
>>> 
 No matter what you guys decide to do, I would strongly suggest to take
>> discussions here to the list and not do discussions in the Github
>> code-review tool.
>>> 
>>> A very big +1 to this, discussion works best for the whole community if
>> it is on the list.
>>> 
>>> Thanks,
>>> Justin
>> 
>> 
>> 





[GitHub] MyXOF commented on a change in pull request #9: New release for iotdb-website

2019-01-25 Thread GitBox
MyXOF commented on a change in pull request #9: New release for iotdb-website
URL: 
https://github.com/apache/incubator-iotdb-website/pull/9#discussion_r251028111
 
 

 ##
 File path: src/components/NavBar.vue
 ##
 @@ -117,46 +108,49 @@
 display: block;
   }
 
-  .navbar-nav>li > a > span{
+  .navbar-nav > li > a > span {
 color: white;
 font-size: 1.6rem;
   }
-  .navbar-nav>li > a > span:hover{
+
+  .navbar-nav > li > a > span:hover {
 color: orange;
   }
-  .container-fluid{
+
+  .container-fluid {
 margin-left: 15%;
 
 Review comment:
   thanks for your review, i have changed this.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251028230
 
 

 ##
 File path: iotdb/src/main/java/org/apache/iotdb/db/sql/ParseGenerator.java
 ##
 @@ -28,6 +28,8 @@
  */
 public final class ParseGenerator {
 
+  private ParseGenerator(){}
 
 Review comment:
   fixed


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251028833
 
 

 ##
 File path: iotdb/src/main/java/org/apache/iotdb/db/utils/FileUtils.java
 ##
 @@ -28,6 +28,8 @@
  */
 public class FileUtils {
 
+  private FileUtils(){}
 
 Review comment:
   fixed


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] kr11 commented on a change in pull request #31: Fix sonar

2019-01-25 Thread GitBox
kr11 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251030153
 
 

 ##
 File path: iotdb/src/main/java/org/apache/iotdb/db/utils/LoadDataUtils.java
 ##
 @@ -133,7 +133,7 @@ private void loadOneRecordLine(String line) {
 try {
   nsPath = mmanager.getFileNameByPath(record.deviceId);
 } catch (PathErrorException e) {
-  LOG.error("given seriesPath not found.{}", e.getMessage());
+  logger.error("given seriesPath not found, given deviceId:{} ", 
record.deviceId, e);
 
 Review comment:
   The `{}` within the text will be filled by the second parameter(`deivceId`). 
The last `e`(Exception) needn't  `{}`, and all message and stack trace of `e` 
will be print out。


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] MyXOF merged pull request #9: New release for iotdb-website

2019-01-25 Thread GitBox
MyXOF merged pull request #9: New release for iotdb-website
URL: https://github.com/apache/incubator-iotdb-website/pull/9
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


Fwd: Google Summer of Code 2019 is coming

2019-01-25 Thread Kevin A. McGrail
Podlings, please take a look at this and ask me questions.  This can be
a great way of getting some fresh eyes on a project.


Regards,
KAM



 Forwarded Message 
Subject:Google Summer of Code 2019 is coming
Date:   Fri, 25 Jan 2019 20:50:23 +0700
From:   Maxim Solodovnik 
Reply-To:   ment...@community.apache.org
To: ment...@community.apache.org



Hello PMCs (incubator Mentors, please forward this email to your podlings),

Google Summer of Code [1] is a program sponsored by Google allowing
students to spend their summer
working on open source software. Students will receive stipends for
developing open source software
full-time for three months. Projects will provide mentoring and
project ideas, and in return have
the chance to get new code developed and - most importantly - to
identify and bring in new committers.

The ASF will apply as a participating organization meaning individual
projects don't have to apply separately.

If you want to participate with your project we ask you to do the
following things by no later than
2019-01-31 19:00 UTC (applications from organizations close a week later)

1. understand what it means to be a mentor [2].

2. record your project ideas.

Just create issues in JIRA, label them with gsoc2019, and they will
show up at [3]. Please be as
specific as possible when describing your idea. Include the
programming language, the tools and
skills required, but try not to scare potential students away. They
are supposed to learn what's
required before the program starts.

Use labels, e.g. for the programming language (java, c, c++, erlang,
python, brainfuck, ...) or
technology area (cloud, xml, web, foo, bar, ...).

Please use the COMDEV JIRA project for recording your ideas if your
project doesn't use JIRA (e.g.
httpd, ooo). Contact d...@community.apache.org if you need assistance.

[4] contains some additional information (will be updated for 2019 shortly).

3. subscribe to ment...@community.apache.org; restricted to potential
mentors, meant to be used as a
private list - general discussions on the public
d...@community.apache.org list as much as possible
please). Use a recognized address when subscribing (@apache.org or one
of your alias addresses on
record).

Note that the ASF isn't accepted as a participating organization yet,
nevertheless you *have to*
start recording your ideas now or we might not get accepted.

Over the years we were able to complete hundreds of projects
successfully. Some of our prior
students are active contributors now! Let's make this year a success again!

P.S.: this email is free to be shared publicly if you want to.

[1] https://summerofcode.withgoogle.com/
[2] http://community.apache.org/guide-to-being-a-mentor.html
[3] https://issues.apache.org/jira/issues/?jql=labels+%3D+gsoc2019
[4] http://community.apache.org/gsoc.html


[GitHub] MyXOF opened a new pull request #10: fix nav button disappear bug and sample data url wrong

2019-01-25 Thread GitBox
MyXOF opened a new pull request #10: fix nav button disappear bug and sample 
data url wrong
URL: https://github.com/apache/incubator-iotdb-website/pull/10
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] MyXOF merged pull request #10: fix nav button disappear bug and sample data url wrong

2019-01-25 Thread GitBox
MyXOF merged pull request #10: fix nav button disappear bug and sample data url 
wrong
URL: https://github.com/apache/incubator-iotdb-website/pull/10
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


Re: How to prevent GitBox from sending too many commit notifications

2019-01-25 Thread Xiangdong Huang
OK.

I just opened a ticket on JIRA.
https://issues.apache.org/jira/browse/INFRA-17762

Hope it can be set tomorrow...

Best,
---
Xiangdong Huang
School of Software, Tsinghua University

 黄向东
清华大学 软件学院


Christofer Dutz  于2019年1月25日周五 下午11:38写道:

> +1 as long as important discussions still get done here and not in
> announce
>
> We just got 69 emails in half an hour ... no one will be reading though
> these in this sort of volume)
> And even searching is almost impossible.
>
> Chris
>
> Am 25.01.19, 15:37 schrieb "毛东方" :
>
> +1, appreciate.
>
> > 在 2019年1月25日,下午9:11,Xiangdong Huang  写道:
> >
> > Hi all,
> >
> > I find another project has the similar problem, and finally they
> send all
> > code-reviews to the reviews@  (see [1]).
> >
> > I think that it also fits us. As for the dev@, we can discuss about
> the
> > issues about Infrastructures (e.g., how to use CI, how to keep code
> > quality), new features, bugs, performance problems etc. These
> contents are
> > more valuable.
> >
> > If someone wants to keep tracking with code-reviews or freshman, he
> can
> > subscribe the reviews@ mail list.
> >
> > For experienced programmers,  they can focus on the contents on dev@
> >
> > If all of you agree with it, I will try to open a ticket on JIRA
> INFRA.
> >
> > Reference:
> > [1]
> >
> https://issues.apache.org/jira/browse/INFRA-12404?jql=text%20~%20%22github%20review%22%20AND%20%20project%20%20%3D%20Infrastructure
> >
> > Best,
> > ---
> > Xiangdong Huang
> > School of Software, Tsinghua University
> >
> > 黄向东
> > 清华大学 软件学院
> >
> >
> > 江天  于2019年1月25日周五 上午10:34写道:
> >
> >> I like the idea of being highly transparent, but we hope to know
> some
> >> tricks of doing this. Do we have to paste the code in the mails or
> just
> >> tell someone what problem which line in which file has? Both of
> these seem
> >> tiring.
> >>
> >>> 在 2019年1月25日,上午1:08,Justin Mclean  写道:
> >>>
> >>> Hi,
> >>>
>  No matter what you guys decide to do, I would strongly suggest to
> take
> >> discussions here to the list and not do discussions in the Github
> >> code-review tool.
> >>>
> >>> A very big +1 to this, discussion works best for the whole
> community if
> >> it is on the list.
> >>>
> >>> Thanks,
> >>> Justin
> >>
> >>
> >>
>
>
>
>


New release for iotdb website

2019-01-25 Thread 徐毅
Hi,


After about a month of work, our website is officially online. 
(http://iotdb.apache.org/#/) Thanks to the guys who worked hard for it. 


In this release, we mainly complete 3 things:
1. complete the remaining pages
2. Optimized display style
3. Adapt to the mobile side

If you have any advice to our website, please reply to this email.


Thanks
Xu Yi





[GitHub] MyXOF opened a new pull request #11: fix spelling bug in home page

2019-01-25 Thread GitBox
MyXOF opened a new pull request #11: fix spelling bug in home page
URL: https://github.com/apache/incubator-iotdb-website/pull/11
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] MyXOF merged pull request #11: fix spelling bug in home page

2019-01-25 Thread GitBox
MyXOF merged pull request #11: fix spelling bug in home page
URL: https://github.com/apache/incubator-iotdb-website/pull/11
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


  1   2   >