[GitHub] [carbondata] CarbonDataQA1 commented on pull request #3770: [CARBONDATA-3829] Support pagination in SDK reader

2020-06-05 Thread GitBox


CarbonDataQA1 commented on pull request #3770:
URL: https://github.com/apache/carbondata/pull/3770#issuecomment-639612033


   Build Success with Spark 2.3.4, Please check CI 
http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/3141/
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [carbondata] CarbonDataQA1 commented on pull request #3770: [CARBONDATA-3829] Support pagination in SDK reader

2020-06-05 Thread GitBox


CarbonDataQA1 commented on pull request #3770:
URL: https://github.com/apache/carbondata/pull/3770#issuecomment-639610764


   Build Success with Spark 2.4.5, Please check CI 
http://121.244.95.60:12545/job/ApacheCarbon_PR_Builder_2.4.5/1417/
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [carbondata] CarbonDataQA1 commented on pull request #3771: [CARBONDATA-3849] pushdown array_contains filter to carbon for array of primitive types

2020-06-05 Thread GitBox


CarbonDataQA1 commented on pull request #3771:
URL: https://github.com/apache/carbondata/pull/3771#issuecomment-639548729


   Build Failed  with Spark 2.4.5, Please check CI 
http://121.244.95.60:12545/job/ApacheCarbon_PR_Builder_2.4.5/1416/
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [carbondata] CarbonDataQA1 commented on pull request #3771: [CARBONDATA-3849] pushdown array_contains filter to carbon for array of primitive types

2020-06-05 Thread GitBox


CarbonDataQA1 commented on pull request #3771:
URL: https://github.com/apache/carbondata/pull/3771#issuecomment-639547711


   Build Success with Spark 2.3.4, Please check CI 
http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/3140/
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [carbondata] ajantha-bhat commented on a change in pull request #3770: [CARBONDATA-3829] Support pagination in SDK reader

2020-06-05 Thread GitBox


ajantha-bhat commented on a change in pull request #3770:
URL: https://github.com/apache/carbondata/pull/3770#discussion_r435946982



##
File path: 
sdk/sdk/src/main/java/org/apache/carbondata/sdk/file/PaginationCarbonReader.java
##
@@ -0,0 +1,303 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.sdk.file;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.carbondata.common.annotations.InterfaceAudience;
+import org.apache.carbondata.common.annotations.InterfaceStability;
+import org.apache.carbondata.core.cache.CarbonLRUCache;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.indexstore.BlockletDetailInfo;
+import org.apache.carbondata.hadoop.CarbonInputSplit;
+import org.apache.carbondata.sdk.file.cache.BlockletRows;
+
+import org.apache.hadoop.mapreduce.InputSplit;
+
+/**
+ * CarbonData SDK reader with pagination support
+ */
+@InterfaceAudience.User
+@InterfaceStability.Evolving
+public class PaginationCarbonReader extends CarbonReader {
+  // Splits based the file present in the reader path when the reader is built.
+  private List allBlockletSplits;
+
+  // Rows till the current splits stored as list.
+  private List rowCountInSplits;
+
+  // Reader builder used to create the pagination reader, used for building 
split level readers.
+  private CarbonReaderBuilder readerBuilder;
+
+  private boolean isClosed;
+
+  // to store the rows of each blocklet in memory based LRU cache.
+  // key: unique blocklet id
+  // value: BlockletRows
+  private CarbonLRUCache cache =
+  new 
CarbonLRUCache(CarbonCommonConstants.CARBON_MAX_PAGINATION_LRU_CACHE_SIZE_IN_MB,
+  
CarbonCommonConstants.CARBON_MAX_PAGINATION_LRU_CACHE_SIZE_IN_MB_DEFAULT);
+
+  /**
+   * Call {@link #builder(String)} to construct an instance
+   */
+
+  PaginationCarbonReader(List splits, CarbonReaderBuilder 
readerBuilder) {
+// Initialize super class with no readers.
+// Based on the splits identified for pagination query, readers will be 
built for the query.
+super(null);
+this.allBlockletSplits = splits;
+this.readerBuilder = readerBuilder;
+// prepare the mapping.
+rowCountInSplits = new ArrayList<>(splits.size());
+long sum = ((CarbonInputSplit) 
splits.get(0)).getDetailInfo().getRowCount();
+rowCountInSplits.add(sum);
+for (int i = 1; i < splits.size(); i++) {
+  // prepare a summation array of row counts in each blocklet,
+  // this is used for pruning with pagination vales.
+  // At current index, it contains sum of rows of all the blocklet from 
previous + current.
+  sum += ((CarbonInputSplit) splits.get(i)).getDetailInfo().getRowCount();
+  rowCountInSplits.add(sum);
+}
+  }
+
+  /**
+   * Pagination query with from and to range.
+   *
+   * @param fromRowNumber must be greater than 0 (as row id starts from 1)
+   *  and less than or equals to toRowNumber
+   * @param toRowNumber must be greater than 0 (as row id starts from 1)
+   *and greater than or equals to fromRowNumber
+   *and should not cross the total rows count
+   * @return array of rows between fromRowNumber and toRowNumber (inclusive)
+   * @throws Exception
+   */
+  public Object[] read(long fromRowNumber, long toRowNumber)
+  throws IOException, InterruptedException {
+if (isClosed) {
+  throw new RuntimeException("Pagination Reader is closed. please build 
again");
+}
+if (fromRowNumber < 1) {
+  throw new IllegalArgumentException("from row id:" + fromRowNumber + " is 
less than 1");
+}
+if (fromRowNumber > toRowNumber) {
+  throw new IllegalArgumentException(
+  "from row id:" + fromRowNumber + " is greater than to row id:" + 
toRowNumber);
+}
+if (toRowNumber > getTotalRows()) {
+  throw new IllegalArgumentException(
+  "to row id:" + toRowNumber + " is greater than total rows:" + 
getTotalRows());
+}
+return getRows(fromRowNumber, toRowNumber);
+  }
+
+  /**
+   * Get total rows in the folder or a list of CarbonData 

[GitHub] [carbondata] ajantha-bhat commented on a change in pull request #3770: [CARBONDATA-3829] Support pagination in SDK reader

2020-06-05 Thread GitBox


ajantha-bhat commented on a change in pull request #3770:
URL: https://github.com/apache/carbondata/pull/3770#discussion_r435945737



##
File path: 
sdk/sdk/src/main/java/org/apache/carbondata/sdk/file/PaginationCarbonReader.java
##
@@ -0,0 +1,303 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.sdk.file;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.carbondata.common.annotations.InterfaceAudience;
+import org.apache.carbondata.common.annotations.InterfaceStability;
+import org.apache.carbondata.core.cache.CarbonLRUCache;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.indexstore.BlockletDetailInfo;
+import org.apache.carbondata.hadoop.CarbonInputSplit;
+import org.apache.carbondata.sdk.file.cache.BlockletRows;
+
+import org.apache.hadoop.mapreduce.InputSplit;
+
+/**
+ * CarbonData SDK reader with pagination support
+ */
+@InterfaceAudience.User
+@InterfaceStability.Evolving
+public class PaginationCarbonReader extends CarbonReader {
+  // Splits based the file present in the reader path when the reader is built.
+  private List allBlockletSplits;
+
+  // Rows till the current splits stored as list.
+  private List rowCountInSplits;
+
+  // Reader builder used to create the pagination reader, used for building 
split level readers.
+  private CarbonReaderBuilder readerBuilder;
+
+  private boolean isClosed;
+
+  // to store the rows of each blocklet in memory based LRU cache.
+  // key: unique blocklet id
+  // value: BlockletRows
+  private CarbonLRUCache cache =
+  new 
CarbonLRUCache(CarbonCommonConstants.CARBON_MAX_PAGINATION_LRU_CACHE_SIZE_IN_MB,
+  
CarbonCommonConstants.CARBON_MAX_PAGINATION_LRU_CACHE_SIZE_IN_MB_DEFAULT);
+
+  /**
+   * Call {@link #builder(String)} to construct an instance
+   */
+
+  PaginationCarbonReader(List splits, CarbonReaderBuilder 
readerBuilder) {
+// Initialize super class with no readers.
+// Based on the splits identified for pagination query, readers will be 
built for the query.
+super(null);
+this.allBlockletSplits = splits;
+this.readerBuilder = readerBuilder;
+// prepare the mapping.
+rowCountInSplits = new ArrayList<>(splits.size());
+long sum = ((CarbonInputSplit) 
splits.get(0)).getDetailInfo().getRowCount();
+rowCountInSplits.add(sum);
+for (int i = 1; i < splits.size(); i++) {
+  // prepare a summation array of row counts in each blocklet,
+  // this is used for pruning with pagination vales.
+  // At current index, it contains sum of rows of all the blocklet from 
previous + current.
+  sum += ((CarbonInputSplit) splits.get(i)).getDetailInfo().getRowCount();
+  rowCountInSplits.add(sum);
+}
+  }
+
+  /**
+   * Pagination query with from and to range.
+   *
+   * @param fromRowNumber must be greater than 0 (as row id starts from 1)
+   *  and less than or equals to toRowNumber
+   * @param toRowNumber must be greater than 0 (as row id starts from 1)
+   *and greater than or equals to fromRowNumber
+   *and should not cross the total rows count
+   * @return array of rows between fromRowNumber and toRowNumber (inclusive)
+   * @throws Exception
+   */
+  public Object[] read(long fromRowNumber, long toRowNumber)
+  throws IOException, InterruptedException {
+if (isClosed) {
+  throw new RuntimeException("Pagination Reader is closed. please build 
again");
+}
+if (fromRowNumber < 1) {
+  throw new IllegalArgumentException("from row id:" + fromRowNumber + " is 
less than 1");
+}
+if (fromRowNumber > toRowNumber) {
+  throw new IllegalArgumentException(
+  "from row id:" + fromRowNumber + " is greater than to row id:" + 
toRowNumber);
+}
+if (toRowNumber > getTotalRows()) {
+  throw new IllegalArgumentException(
+  "to row id:" + toRowNumber + " is greater than total rows:" + 
getTotalRows());
+}
+return getRows(fromRowNumber, toRowNumber);
+  }
+
+  /**
+   * Get total rows in the folder or a list of CarbonData 

[GitHub] [carbondata] ajantha-bhat commented on a change in pull request #3770: [CARBONDATA-3829] Support pagination in SDK reader

2020-06-05 Thread GitBox


ajantha-bhat commented on a change in pull request #3770:
URL: https://github.com/apache/carbondata/pull/3770#discussion_r435945737



##
File path: 
sdk/sdk/src/main/java/org/apache/carbondata/sdk/file/PaginationCarbonReader.java
##
@@ -0,0 +1,303 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.sdk.file;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.carbondata.common.annotations.InterfaceAudience;
+import org.apache.carbondata.common.annotations.InterfaceStability;
+import org.apache.carbondata.core.cache.CarbonLRUCache;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.indexstore.BlockletDetailInfo;
+import org.apache.carbondata.hadoop.CarbonInputSplit;
+import org.apache.carbondata.sdk.file.cache.BlockletRows;
+
+import org.apache.hadoop.mapreduce.InputSplit;
+
+/**
+ * CarbonData SDK reader with pagination support
+ */
+@InterfaceAudience.User
+@InterfaceStability.Evolving
+public class PaginationCarbonReader extends CarbonReader {
+  // Splits based the file present in the reader path when the reader is built.
+  private List allBlockletSplits;
+
+  // Rows till the current splits stored as list.
+  private List rowCountInSplits;
+
+  // Reader builder used to create the pagination reader, used for building 
split level readers.
+  private CarbonReaderBuilder readerBuilder;
+
+  private boolean isClosed;
+
+  // to store the rows of each blocklet in memory based LRU cache.
+  // key: unique blocklet id
+  // value: BlockletRows
+  private CarbonLRUCache cache =
+  new 
CarbonLRUCache(CarbonCommonConstants.CARBON_MAX_PAGINATION_LRU_CACHE_SIZE_IN_MB,
+  
CarbonCommonConstants.CARBON_MAX_PAGINATION_LRU_CACHE_SIZE_IN_MB_DEFAULT);
+
+  /**
+   * Call {@link #builder(String)} to construct an instance
+   */
+
+  PaginationCarbonReader(List splits, CarbonReaderBuilder 
readerBuilder) {
+// Initialize super class with no readers.
+// Based on the splits identified for pagination query, readers will be 
built for the query.
+super(null);
+this.allBlockletSplits = splits;
+this.readerBuilder = readerBuilder;
+// prepare the mapping.
+rowCountInSplits = new ArrayList<>(splits.size());
+long sum = ((CarbonInputSplit) 
splits.get(0)).getDetailInfo().getRowCount();
+rowCountInSplits.add(sum);
+for (int i = 1; i < splits.size(); i++) {
+  // prepare a summation array of row counts in each blocklet,
+  // this is used for pruning with pagination vales.
+  // At current index, it contains sum of rows of all the blocklet from 
previous + current.
+  sum += ((CarbonInputSplit) splits.get(i)).getDetailInfo().getRowCount();
+  rowCountInSplits.add(sum);
+}
+  }
+
+  /**
+   * Pagination query with from and to range.
+   *
+   * @param fromRowNumber must be greater than 0 (as row id starts from 1)
+   *  and less than or equals to toRowNumber
+   * @param toRowNumber must be greater than 0 (as row id starts from 1)
+   *and greater than or equals to fromRowNumber
+   *and should not cross the total rows count
+   * @return array of rows between fromRowNumber and toRowNumber (inclusive)
+   * @throws Exception
+   */
+  public Object[] read(long fromRowNumber, long toRowNumber)
+  throws IOException, InterruptedException {
+if (isClosed) {
+  throw new RuntimeException("Pagination Reader is closed. please build 
again");
+}
+if (fromRowNumber < 1) {
+  throw new IllegalArgumentException("from row id:" + fromRowNumber + " is 
less than 1");
+}
+if (fromRowNumber > toRowNumber) {
+  throw new IllegalArgumentException(
+  "from row id:" + fromRowNumber + " is greater than to row id:" + 
toRowNumber);
+}
+if (toRowNumber > getTotalRows()) {
+  throw new IllegalArgumentException(
+  "to row id:" + toRowNumber + " is greater than total rows:" + 
getTotalRows());
+}
+return getRows(fromRowNumber, toRowNumber);
+  }
+
+  /**
+   * Get total rows in the folder or a list of CarbonData 

[GitHub] [carbondata] ajantha-bhat commented on a change in pull request #3770: [CARBONDATA-3829] Support pagination in SDK reader

2020-06-05 Thread GitBox


ajantha-bhat commented on a change in pull request #3770:
URL: https://github.com/apache/carbondata/pull/3770#discussion_r435944365



##
File path: 
sdk/sdk/src/main/java/org/apache/carbondata/sdk/file/PaginationCarbonReader.java
##
@@ -0,0 +1,303 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.sdk.file;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.carbondata.common.annotations.InterfaceAudience;
+import org.apache.carbondata.common.annotations.InterfaceStability;
+import org.apache.carbondata.core.cache.CarbonLRUCache;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.indexstore.BlockletDetailInfo;
+import org.apache.carbondata.hadoop.CarbonInputSplit;
+import org.apache.carbondata.sdk.file.cache.BlockletRows;
+
+import org.apache.hadoop.mapreduce.InputSplit;
+
+/**
+ * CarbonData SDK reader with pagination support
+ */
+@InterfaceAudience.User
+@InterfaceStability.Evolving
+public class PaginationCarbonReader extends CarbonReader {
+  // Splits based the file present in the reader path when the reader is built.
+  private List allBlockletSplits;
+
+  // Rows till the current splits stored as list.
+  private List rowCountInSplits;
+
+  // Reader builder used to create the pagination reader, used for building 
split level readers.
+  private CarbonReaderBuilder readerBuilder;
+
+  private boolean isClosed;
+
+  // to store the rows of each blocklet in memory based LRU cache.
+  // key: unique blocklet id
+  // value: BlockletRows
+  private CarbonLRUCache cache =
+  new 
CarbonLRUCache(CarbonCommonConstants.CARBON_MAX_PAGINATION_LRU_CACHE_SIZE_IN_MB,
+  
CarbonCommonConstants.CARBON_MAX_PAGINATION_LRU_CACHE_SIZE_IN_MB_DEFAULT);
+
+  /**
+   * Call {@link #builder(String)} to construct an instance
+   */
+
+  PaginationCarbonReader(List splits, CarbonReaderBuilder 
readerBuilder) {
+// Initialize super class with no readers.
+// Based on the splits identified for pagination query, readers will be 
built for the query.
+super(null);
+this.allBlockletSplits = splits;
+this.readerBuilder = readerBuilder;
+// prepare the mapping.
+rowCountInSplits = new ArrayList<>(splits.size());
+long sum = ((CarbonInputSplit) 
splits.get(0)).getDetailInfo().getRowCount();
+rowCountInSplits.add(sum);

Review comment:
   yeah, it was initial code. modified.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [carbondata] ajantha-bhat commented on a change in pull request #3770: [CARBONDATA-3829] Support pagination in SDK reader

2020-06-05 Thread GitBox


ajantha-bhat commented on a change in pull request #3770:
URL: https://github.com/apache/carbondata/pull/3770#discussion_r435944901



##
File path: 
sdk/sdk/src/main/java/org/apache/carbondata/sdk/file/PaginationCarbonReader.java
##
@@ -0,0 +1,303 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.sdk.file;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.carbondata.common.annotations.InterfaceAudience;
+import org.apache.carbondata.common.annotations.InterfaceStability;
+import org.apache.carbondata.core.cache.CarbonLRUCache;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.indexstore.BlockletDetailInfo;
+import org.apache.carbondata.hadoop.CarbonInputSplit;
+import org.apache.carbondata.sdk.file.cache.BlockletRows;
+
+import org.apache.hadoop.mapreduce.InputSplit;
+
+/**
+ * CarbonData SDK reader with pagination support
+ */
+@InterfaceAudience.User
+@InterfaceStability.Evolving
+public class PaginationCarbonReader extends CarbonReader {
+  // Splits based the file present in the reader path when the reader is built.
+  private List allBlockletSplits;
+
+  // Rows till the current splits stored as list.
+  private List rowCountInSplits;
+
+  // Reader builder used to create the pagination reader, used for building 
split level readers.
+  private CarbonReaderBuilder readerBuilder;
+
+  private boolean isClosed;
+
+  // to store the rows of each blocklet in memory based LRU cache.
+  // key: unique blocklet id
+  // value: BlockletRows
+  private CarbonLRUCache cache =
+  new 
CarbonLRUCache(CarbonCommonConstants.CARBON_MAX_PAGINATION_LRU_CACHE_SIZE_IN_MB,
+  
CarbonCommonConstants.CARBON_MAX_PAGINATION_LRU_CACHE_SIZE_IN_MB_DEFAULT);
+
+  /**
+   * Call {@link #builder(String)} to construct an instance
+   */
+
+  PaginationCarbonReader(List splits, CarbonReaderBuilder 
readerBuilder) {
+// Initialize super class with no readers.
+// Based on the splits identified for pagination query, readers will be 
built for the query.
+super(null);
+this.allBlockletSplits = splits;
+this.readerBuilder = readerBuilder;
+// prepare the mapping.
+rowCountInSplits = new ArrayList<>(splits.size());
+long sum = ((CarbonInputSplit) 
splits.get(0)).getDetailInfo().getRowCount();
+rowCountInSplits.add(sum);
+for (int i = 1; i < splits.size(); i++) {
+  // prepare a summation array of row counts in each blocklet,
+  // this is used for pruning with pagination vales.
+  // At current index, it contains sum of rows of all the blocklet from 
previous + current.
+  sum += ((CarbonInputSplit) splits.get(i)).getDetailInfo().getRowCount();
+  rowCountInSplits.add(sum);
+}
+  }
+
+  /**
+   * Pagination query with from and to range.
+   *
+   * @param fromRowNumber must be greater than 0 (as row id starts from 1)
+   *  and less than or equals to toRowNumber
+   * @param toRowNumber must be greater than 0 (as row id starts from 1)
+   *and greater than or equals to fromRowNumber
+   *and should not cross the total rows count
+   * @return array of rows between fromRowNumber and toRowNumber (inclusive)
+   * @throws Exception
+   */
+  public Object[] read(long fromRowNumber, long toRowNumber)
+  throws IOException, InterruptedException {
+if (isClosed) {
+  throw new RuntimeException("Pagination Reader is closed. please build 
again");
+}
+if (fromRowNumber < 1) {
+  throw new IllegalArgumentException("from row id:" + fromRowNumber + " is 
less than 1");
+}
+if (fromRowNumber > toRowNumber) {
+  throw new IllegalArgumentException(
+  "from row id:" + fromRowNumber + " is greater than to row id:" + 
toRowNumber);
+}
+if (toRowNumber > getTotalRows()) {
+  throw new IllegalArgumentException(
+  "to row id:" + toRowNumber + " is greater than total rows:" + 
getTotalRows());
+}
+return getRows(fromRowNumber, toRowNumber);
+  }
+
+  /**
+   * Get total rows in the folder or a list of CarbonData 

[jira] [Created] (CARBONDATA-3849) Push down array_contains as equal to filter for array of primitive types

2020-06-05 Thread Ajantha Bhat (Jira)
Ajantha Bhat created CARBONDATA-3849:


 Summary: Push down array_contains as equal to filter for array of 
primitive types
 Key: CARBONDATA-3849
 URL: https://issues.apache.org/jira/browse/CARBONDATA-3849
 Project: CarbonData
  Issue Type: Improvement
Reporter: Ajantha Bhat
Assignee: Ajantha Bhat


problem:

Currently array_contains() UDF is not pushed down to carbon. So, carbon has to 
scan all the rows for query having this UDF. scanning all the rows reduces the 
query performance. 

 

solution: 

push down array_contains() for all the array of primitive type as equals to 
filter. Having as equals to filter, we can break the scanning of elements in 
array once found.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [carbondata] CarbonDataQA1 commented on pull request #3771: [WIP] pushdown array_contains filter to carbon

2020-06-05 Thread GitBox


CarbonDataQA1 commented on pull request #3771:
URL: https://github.com/apache/carbondata/pull/3771#issuecomment-639416717







This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [carbondata] CarbonDataQA1 commented on pull request #3788: [CARBONDATA-3844]Fix scan the relevant database instead of scanning all

2020-06-05 Thread GitBox


CarbonDataQA1 commented on pull request #3788:
URL: https://github.com/apache/carbondata/pull/3788#issuecomment-639378978


   Build Success with Spark 2.3.4, Please check CI 
http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/3138/
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [carbondata] CarbonDataQA1 commented on pull request #3788: [CARBONDATA-3844]Fix scan the relevant database instead of scanning all

2020-06-05 Thread GitBox


CarbonDataQA1 commented on pull request #3788:
URL: https://github.com/apache/carbondata/pull/3788#issuecomment-639378003


   Build Success with Spark 2.4.5, Please check CI 
http://121.244.95.60:12545/job/ApacheCarbon_PR_Builder_2.4.5/1414/
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [carbondata] CarbonDataQA1 commented on pull request #3787: [CARBONDATA-3848] support sort_scope for index creation

2020-06-05 Thread GitBox


CarbonDataQA1 commented on pull request #3787:
URL: https://github.com/apache/carbondata/pull/3787#issuecomment-639326930


   Build Success with Spark 2.4.5, Please check CI 
http://121.244.95.60:12545/job/ApacheCarbon_PR_Builder_2.4.5/1413/
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [carbondata] CarbonDataQA1 commented on pull request #3787: [CARBONDATA-3848] support sort_scope for index creation

2020-06-05 Thread GitBox


CarbonDataQA1 commented on pull request #3787:
URL: https://github.com/apache/carbondata/pull/3787#issuecomment-639326322


   Build Success with Spark 2.3.4, Please check CI 
http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/3137/
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org