jackylk commented on a change in pull request #3627: [CARBONDATA-3710] Make stage files queryable
URL: https://github.com/apache/carbondata/pull/3627#discussion_r383716671 ########## File path: integration/flink/src/test/scala/org/apache/carbon/flink/TestCarbonWriter.scala ########## @@ -95,9 +96,18 @@ class TestCarbonWriter extends QueryTest { throw new UnsupportedOperationException(exception) } + checkAnswer(sql(s"select count(1) from $tableName"), Seq(Row(0))) + + // query with stage input + CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_QUERY_STAGE_INPUT, "true") Review comment: added ---------------------------------------------------------------- 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: [hidden email] With regards, Apache Git Services |
In reply to this post by GitBox
ajantha-bhat commented on a change in pull request #3627: [CARBONDATA-3710] Make stage files queryable
URL: https://github.com/apache/carbondata/pull/3627#discussion_r383669888 ########## File path: core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java ########## @@ -1519,6 +1519,12 @@ private CarbonCommonConstants() { public static final String CARBON_QUERY_PREFETCH_ENABLE_DEFAULT = "true"; + @CarbonProperty + public static final String CARBON_QUERY_STAGE_INPUT = Review comment: please annotate as `dynamicConfigurable` ? It is used in session params ---------------------------------------------------------------- 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: [hidden email] With regards, Apache Git Services |
In reply to this post by GitBox
ajantha-bhat commented on a change in pull request #3627: [CARBONDATA-3710] Make stage files queryable
URL: https://github.com/apache/carbondata/pull/3627#discussion_r383717477 ########## File path: core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTable.java ########## @@ -501,6 +501,13 @@ public String getMetadataPath() { return CarbonTablePath.getMetadataPath(getTablePath()); } + /** + * Return the stage input path + */ + public String getStagePath() { Review comment: CarbonTablePath.`SNAPSHOT_FILE_NAME` is not used. can we remove it ? ---------------------------------------------------------------- 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: [hidden email] With regards, Apache Git Services |
In reply to this post by GitBox
ajantha-bhat commented on a change in pull request #3627: [CARBONDATA-3710] Make stage files queryable
URL: https://github.com/apache/carbondata/pull/3627#discussion_r383717477 ########## File path: core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTable.java ########## @@ -501,6 +501,13 @@ public String getMetadataPath() { return CarbonTablePath.getMetadataPath(getTablePath()); } + /** + * Return the stage input path + */ + public String getStagePath() { Review comment: In CarbonTablePath class, `SNAPSHOT_FILE_NAME` is not used. can we remove it ? ---------------------------------------------------------------- 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: [hidden email] With regards, Apache Git Services |
In reply to this post by GitBox
jackylk commented on a change in pull request #3627: [CARBONDATA-3710] Make stage files queryable
URL: https://github.com/apache/carbondata/pull/3627#discussion_r383725524 ########## File path: core/src/main/java/org/apache/carbondata/core/statusmanager/StageInputCollector.java ########## @@ -0,0 +1,143 @@ +/* + * 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.core.statusmanager; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.stream.Collectors; + +import org.apache.carbondata.common.logging.LogServiceFactory; +import org.apache.carbondata.core.datastore.filesystem.CarbonFile; +import org.apache.carbondata.core.datastore.impl.FileFactory; +import org.apache.carbondata.core.metadata.schema.table.CarbonTable; + +import static org.apache.carbondata.core.util.path.CarbonTablePath.SUCCESS_FILE_SUBFIX; + +import com.google.gson.Gson; +import org.apache.commons.io.IOUtils; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.mapreduce.InputSplit; +import org.apache.log4j.Logger; + +/** + * Utilities to create input split from stage files + */ +public class StageInputCollector { + + private static Logger LOGGER = + LogServiceFactory.getLogService(StageInputCollector.class.getCanonicalName()); + + /** + * Collect all stage files and create splits from them. + * These splits can be included in the queried. + */ + public static List<InputSplit> createInputSplits(CarbonTable table, Configuration hadoopConf) + throws ExecutionException, InterruptedException { + List<CarbonFile> stageInputFiles = new LinkedList<>(); + List<CarbonFile> successFiles = new LinkedList<>(); + collectStageFiles(table, hadoopConf, stageInputFiles, successFiles); + if (stageInputFiles.size() > 0) { + int numThreads = Math.min(Math.max(stageInputFiles.size(), 1), 10); + ExecutorService executorService = Executors.newFixedThreadPool(numThreads); + return createInputSplits(executorService, stageInputFiles); + } else { + return new ArrayList<>(0); + } + } + + /** + * Collect all stage files and matched success files. + * A stage file without success file will not be collected + */ + public static void collectStageFiles(CarbonTable table, Configuration hadoopConf, + List<CarbonFile> stageInputList, List<CarbonFile> successFileList) { + Objects.requireNonNull(table); + Objects.requireNonNull(hadoopConf); + Objects.requireNonNull(stageInputList); + Objects.requireNonNull(successFileList); + CarbonFile dir = FileFactory.getCarbonFile(table.getStagePath(), hadoopConf); + if (dir.exists()) { + // list the stage folder and collect all stage files who has corresponding success file, + // which means the file is committed + CarbonFile[] allFiles = dir.listFiles(); Review comment: But this way can not access S3, right? ---------------------------------------------------------------- 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: [hidden email] With regards, Apache Git Services |
In reply to this post by GitBox
jackylk commented on a change in pull request #3627: [CARBONDATA-3710] Make stage files queryable
URL: https://github.com/apache/carbondata/pull/3627#discussion_r383726240 ########## File path: core/src/main/java/org/apache/carbondata/core/statusmanager/StageInputCollector.java ########## @@ -0,0 +1,143 @@ +/* + * 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.core.statusmanager; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.stream.Collectors; + +import org.apache.carbondata.common.logging.LogServiceFactory; +import org.apache.carbondata.core.datastore.filesystem.CarbonFile; +import org.apache.carbondata.core.datastore.impl.FileFactory; +import org.apache.carbondata.core.metadata.schema.table.CarbonTable; + +import static org.apache.carbondata.core.util.path.CarbonTablePath.SUCCESS_FILE_SUBFIX; + +import com.google.gson.Gson; +import org.apache.commons.io.IOUtils; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.mapreduce.InputSplit; +import org.apache.log4j.Logger; + +/** + * Utilities to create input split from stage files + */ +public class StageInputCollector { + + private static Logger LOGGER = + LogServiceFactory.getLogService(StageInputCollector.class.getCanonicalName()); + + /** + * Collect all stage files and create splits from them. + * These splits can be included in the queried. + */ + public static List<InputSplit> createInputSplits(CarbonTable table, Configuration hadoopConf) + throws ExecutionException, InterruptedException { + List<CarbonFile> stageInputFiles = new LinkedList<>(); + List<CarbonFile> successFiles = new LinkedList<>(); + collectStageFiles(table, hadoopConf, stageInputFiles, successFiles); + if (stageInputFiles.size() > 0) { + int numThreads = Math.min(Math.max(stageInputFiles.size(), 1), 10); + ExecutorService executorService = Executors.newFixedThreadPool(numThreads); + return createInputSplits(executorService, stageInputFiles); + } else { + return new ArrayList<>(0); Review comment: It is ok, avoiding creating more objects ---------------------------------------------------------------- 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: [hidden email] With regards, Apache Git Services |
In reply to this post by GitBox
jackylk commented on a change in pull request #3627: [CARBONDATA-3710] Make stage files queryable
URL: https://github.com/apache/carbondata/pull/3627#discussion_r383726755 ########## File path: core/src/main/java/org/apache/carbondata/core/statusmanager/StageInputCollector.java ########## @@ -0,0 +1,143 @@ +/* + * 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.core.statusmanager; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.stream.Collectors; + +import org.apache.carbondata.common.logging.LogServiceFactory; +import org.apache.carbondata.core.datastore.filesystem.CarbonFile; +import org.apache.carbondata.core.datastore.impl.FileFactory; +import org.apache.carbondata.core.metadata.schema.table.CarbonTable; + +import static org.apache.carbondata.core.util.path.CarbonTablePath.SUCCESS_FILE_SUBFIX; + +import com.google.gson.Gson; +import org.apache.commons.io.IOUtils; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.mapreduce.InputSplit; +import org.apache.log4j.Logger; + +/** + * Utilities to create input split from stage files + */ +public class StageInputCollector { + + private static Logger LOGGER = + LogServiceFactory.getLogService(StageInputCollector.class.getCanonicalName()); + + /** + * Collect all stage files and create splits from them. + * These splits can be included in the queried. Review comment: fixed ---------------------------------------------------------------- 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: [hidden email] With regards, Apache Git Services |
In reply to this post by GitBox
jackylk commented on a change in pull request #3627: [CARBONDATA-3710] Make stage files queryable
URL: https://github.com/apache/carbondata/pull/3627#discussion_r383727646 ########## File path: docs/configuration-parameters.md ########## @@ -144,6 +144,7 @@ This section provides the details of all the configurations required for the Car | carbon.heap.memory.pooling.threshold.bytes | 1048576 | CarbonData supports unsafe operations of Java to avoid GC overhead for certain operations. Using unsafe, memory can be allocated on Java Heap or off heap. This configuration controls the allocation mechanism on Java HEAP. If the heap memory allocations of the given size is greater or equal than this value,it should go through the pooling mechanism. But if set this size to -1, it should not go through the pooling mechanism. Default value is 1048576(1MB, the same as Spark). Value to be specified in bytes. | | carbon.push.rowfilters.for.vector | false | When enabled complete row filters will be handled by carbon in case of vector. If it is disabled then only page level pruning will be done by carbon and row level filtering will be done by spark for vector. And also there are scan optimizations in carbon to avoid multiple data copies when this parameter is set to false. There is no change in flow for non-vector based queries. | | carbon.query.prefetch.enable | true | By default this property is true, so prefetch is used in query to read next blocklet asynchronously in other thread while processing current blocklet in main thread. This can help to reduce CPU idle time. Setting this property false will disable this prefetch feature in query. | +| carbon.query.stage.input.enable | false | Stage input files are data files written by external applications (such as Flink) but has not been loaded into carbon table. Enabling this configuration makes query includes these files, thus makes query on latest data. However, since these files are not indexed, query maybe slower due to full scan is required for these files. | Review comment: fixed ---------------------------------------------------------------- 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: [hidden email] With regards, Apache Git Services |
In reply to this post by GitBox
jackylk commented on a change in pull request #3627: [CARBONDATA-3710] Make stage files queryable
URL: https://github.com/apache/carbondata/pull/3627#discussion_r383728166 ########## File path: core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTable.java ########## @@ -501,6 +501,13 @@ public String getMetadataPath() { return CarbonTablePath.getMetadataPath(getTablePath()); } + /** + * Return the stage input path + */ + public String getStagePath() { Review comment: It is used in func `getStageSnapshotFile` ---------------------------------------------------------------- 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: [hidden email] With regards, Apache Git Services |
In reply to this post by GitBox
akashrn5 commented on a change in pull request #3627: [CARBONDATA-3710] Make stage files queryable
URL: https://github.com/apache/carbondata/pull/3627#discussion_r383729909 ########## File path: core/src/main/java/org/apache/carbondata/core/statusmanager/StageInputCollector.java ########## @@ -0,0 +1,143 @@ +/* + * 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.core.statusmanager; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.stream.Collectors; + +import org.apache.carbondata.common.logging.LogServiceFactory; +import org.apache.carbondata.core.datastore.filesystem.CarbonFile; +import org.apache.carbondata.core.datastore.impl.FileFactory; +import org.apache.carbondata.core.metadata.schema.table.CarbonTable; + +import static org.apache.carbondata.core.util.path.CarbonTablePath.SUCCESS_FILE_SUBFIX; + +import com.google.gson.Gson; +import org.apache.commons.io.IOUtils; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.mapreduce.InputSplit; +import org.apache.log4j.Logger; + +/** + * Utilities to create input split from stage files + */ +public class StageInputCollector { + + private static Logger LOGGER = + LogServiceFactory.getLogService(StageInputCollector.class.getCanonicalName()); + + /** + * Collect all stage files and create splits from them. + * These splits can be included in the queried. + */ + public static List<InputSplit> createInputSplits(CarbonTable table, Configuration hadoopConf) + throws ExecutionException, InterruptedException { + List<CarbonFile> stageInputFiles = new LinkedList<>(); + List<CarbonFile> successFiles = new LinkedList<>(); + collectStageFiles(table, hadoopConf, stageInputFiles, successFiles); + if (stageInputFiles.size() > 0) { + int numThreads = Math.min(Math.max(stageInputFiles.size(), 1), 10); + ExecutorService executorService = Executors.newFixedThreadPool(numThreads); + return createInputSplits(executorService, stageInputFiles); + } else { + return new ArrayList<>(0); + } + } + + /** + * Collect all stage files and matched success files. + * A stage file without success file will not be collected + */ + public static void collectStageFiles(CarbonTable table, Configuration hadoopConf, + List<CarbonFile> stageInputList, List<CarbonFile> successFileList) { + Objects.requireNonNull(table); + Objects.requireNonNull(hadoopConf); + Objects.requireNonNull(stageInputList); + Objects.requireNonNull(successFileList); + CarbonFile dir = FileFactory.getCarbonFile(table.getStagePath(), hadoopConf); + if (dir.exists()) { + // list the stage folder and collect all stage files who has corresponding success file, + // which means the file is committed + CarbonFile[] allFiles = dir.listFiles(); Review comment: can we implement this in our carbonfile API over hadoop conf and try? is it possible? ---------------------------------------------------------------- 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: [hidden email] With regards, Apache Git Services |
In reply to this post by GitBox
ajantha-bhat commented on a change in pull request #3627: [CARBONDATA-3710] Make stage files queryable
URL: https://github.com/apache/carbondata/pull/3627#discussion_r383730022 ########## File path: core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTable.java ########## @@ -501,6 +501,13 @@ public String getMetadataPath() { return CarbonTablePath.getMetadataPath(getTablePath()); } + /** + * Return the stage input path + */ + public String getStagePath() { Review comment: I know, that function is used only for test files. I didn't see `snapshot` file creation in the flink sdk write code. ---------------------------------------------------------------- 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: [hidden email] With regards, Apache Git Services |
In reply to this post by GitBox
CarbonDataQA1 commented on issue #3627: [CARBONDATA-3710] Make stage files queryable
URL: https://github.com/apache/carbondata/pull/3627#issuecomment-590757484 Build Success with Spark 2.4.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbon_PR_Builder_2.4.4/458/ ---------------------------------------------------------------- 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: [hidden email] With regards, Apache Git Services |
In reply to this post by GitBox
CarbonDataQA1 commented on issue #3627: [CARBONDATA-3710] Make stage files queryable
URL: https://github.com/apache/carbondata/pull/3627#issuecomment-590795061 Build Success with Spark 2.3.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/2159/ ---------------------------------------------------------------- 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: [hidden email] With regards, Apache Git Services |
In reply to this post by GitBox
ajantha-bhat commented on issue #3627: [CARBONDATA-3710] Make stage files queryable
URL: https://github.com/apache/carbondata/pull/3627#issuecomment-590849586 LGTM ---------------------------------------------------------------- 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: [hidden email] With regards, Apache Git Services |
In reply to this post by GitBox
asfgit closed pull request #3627: [CARBONDATA-3710] Make stage files queryable
URL: https://github.com/apache/carbondata/pull/3627 ---------------------------------------------------------------- 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: [hidden email] With regards, Apache Git Services |
Free forum by Nabble | Edit this page |