CarbonDataQA1 commented on issue #3538: [WIP] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#issuecomment-581278725 Build Failed with Spark 2.4.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbon_PR_Builder_2.4.4/126/ ---------------------------------------------------------------- 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 #3538: [WIP] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#issuecomment-581283852 Build Failed with Spark 2.3.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/1830/ ---------------------------------------------------------------- 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 #3538: [WIP] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#issuecomment-581309191 Build Failed with Spark 2.4.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbon_PR_Builder_2.4.4/128/ ---------------------------------------------------------------- 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 #3538: [WIP] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#issuecomment-581336230 Build Failed with Spark 2.3.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/1832/ ---------------------------------------------------------------- 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 #3538: [WIP] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#issuecomment-581464371 Build Failed with Spark 2.4.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbon_PR_Builder_2.4.4/135/ ---------------------------------------------------------------- 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 #3538: [WIP] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#issuecomment-581495747 Build Failed with Spark 2.3.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/1839/ ---------------------------------------------------------------- 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 #3538: [WIP] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#issuecomment-581508197 Build Failed with Spark 2.4.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbon_PR_Builder_2.4.4/137/ ---------------------------------------------------------------- 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 #3538: [WIP] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#issuecomment-581517381 Build Failed with Spark 2.4.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbon_PR_Builder_2.4.4/138/ ---------------------------------------------------------------- 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 #3538: [WIP] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#issuecomment-581543315 Build Failed with Spark 2.3.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/1842/ ---------------------------------------------------------------- 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 #3538: [WIP] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#issuecomment-581713906 Build Failed with Spark 2.4.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbon_PR_Builder_2.4.4/139/ ---------------------------------------------------------------- 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 #3538: [WIP] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#issuecomment-581720405 Build Failed with Spark 2.4.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbon_PR_Builder_2.4.4/140/ ---------------------------------------------------------------- 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 #3538: [WIP] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#issuecomment-581733364 Build Success with Spark 2.3.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/1844/ ---------------------------------------------------------------- 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 #3538: [CARBONDATA-3637] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#issuecomment-581736552 @kumarvishal09 , @jackylk , @ravipesala , @QiangCai : PR is ready please review ---------------------------------------------------------------- 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
kunal642 commented on a change in pull request #3538: [CARBONDATA-3637] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#discussion_r374612386 ########## File path: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonInsertIntoWithDf.scala ########## @@ -0,0 +1,230 @@ +/* + * 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.spark.sql.execution.command.management + +import java.text.SimpleDateFormat +import java.util + +import org.apache.spark.sql.{AnalysisException, CarbonUtils, DataFrame, Dataset, Row, SparkSession} +import org.apache.spark.sql.execution.command.{DataLoadTableFileMapping, UpdateTableModel} +import org.apache.spark.sql.execution.datasources.LogicalRelation +import org.apache.spark.util.{CarbonReflectionUtils, CausedBy, SparkUtil} + +import org.apache.carbondata.common.logging.LogServiceFactory +import org.apache.carbondata.core.datastore.impl.FileFactory +import org.apache.carbondata.core.indexstore.PartitionSpec +import org.apache.carbondata.core.metadata.schema.table.{CarbonTable, TableInfo} +import org.apache.carbondata.core.statusmanager.{LoadMetadataDetails, SegmentStatus, SegmentStatusManager} +import org.apache.carbondata.core.util.{CarbonProperties, ThreadLocalSessionInfo} +import org.apache.carbondata.core.util.path.CarbonTablePath +import org.apache.carbondata.events.OperationContext +import org.apache.carbondata.events.exception.PreEventException +import org.apache.carbondata.processing.loading.TableProcessingOperations +import org.apache.carbondata.processing.loading.exception.NoRetryException +import org.apache.carbondata.processing.loading.model.CarbonLoadModel +import org.apache.carbondata.processing.util.{CarbonDataProcessorUtil, CarbonLoaderUtil} +import org.apache.carbondata.spark.rdd.CarbonDataRDDFactory + +/* +* insert into with df, doesn't use logical plan +* +*/ +case class CarbonInsertIntoWithDf(databaseNameOp: Option[String], + tableName: String, + options: Map[String, String], + isOverwriteTable: Boolean, + var dimFilesPath: Seq[DataLoadTableFileMapping] = Seq(), + var dataFrame: DataFrame, + var inputSqlString: String = null, + var updateModel: Option[UpdateTableModel] = None, + var tableInfoOp: Option[TableInfo] = None, + var internalOptions: Map[String, String] = Map.empty, + var partition: Map[String, Option[String]] = Map.empty, + var operationContext: OperationContext = new OperationContext) { + + var table: CarbonTable = _ + + var logicalPartitionRelation: LogicalRelation = _ + + var sizeInBytes: Long = _ + + var currPartitions: util.List[PartitionSpec] = _ + + var parentTablePath: String = _ + + val LOGGER = LogServiceFactory.getLogService(this.getClass.getName) + + var finalPartition: Map[String, Option[String]] = Map.empty + + var timeStampFormat: SimpleDateFormat = _ + + var dateFormat: SimpleDateFormat = _ + + def process(sparkSession: SparkSession): Seq[Row] = { + ThreadLocalSessionInfo + .setConfigurationToCurrentThread(sparkSession.sessionState.newHadoopConf()) + val (sizeInBytes, table, dbName, logicalPartitionRelation, finalPartition) = CommonLoadUtils + .processMetadataCommon( + sparkSession, + databaseNameOp, + tableName, + tableInfoOp, + partition) + this.sizeInBytes = sizeInBytes + this.table = table + this.logicalPartitionRelation = logicalPartitionRelation + this.finalPartition = finalPartition + val carbonProperty: CarbonProperties = CarbonProperties.getInstance() + val hadoopConf = sparkSession.sessionState.newHadoopConf() + carbonProperty.addProperty("zookeeper.enable.lock", "false") + val factPath = "" + currPartitions = CommonLoadUtils.getCurrentParitions(sparkSession, table) + CommonLoadUtils.setNumberOfCoresWhileLoading(sparkSession, carbonProperty) + val optionsFinal: util.Map[String, String] = + CommonLoadUtils.getFinalLoadOptions( + carbonProperty, table, options) Review comment: No need to pass the carbonProperties object to these methods let them handle using CarbonProperties.getInstance(). Same with setNumberOfCoresWhileLoading ---------------------------------------------------------------- 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
kunal642 commented on a change in pull request #3538: [CARBONDATA-3637] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#discussion_r374614202 ########## File path: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonInsertIntoWithDf.scala ########## @@ -0,0 +1,230 @@ +/* + * 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.spark.sql.execution.command.management + +import java.text.SimpleDateFormat +import java.util + +import org.apache.spark.sql.{AnalysisException, CarbonUtils, DataFrame, Dataset, Row, SparkSession} +import org.apache.spark.sql.execution.command.{DataLoadTableFileMapping, UpdateTableModel} +import org.apache.spark.sql.execution.datasources.LogicalRelation +import org.apache.spark.util.{CarbonReflectionUtils, CausedBy, SparkUtil} + +import org.apache.carbondata.common.logging.LogServiceFactory +import org.apache.carbondata.core.datastore.impl.FileFactory +import org.apache.carbondata.core.indexstore.PartitionSpec +import org.apache.carbondata.core.metadata.schema.table.{CarbonTable, TableInfo} +import org.apache.carbondata.core.statusmanager.{LoadMetadataDetails, SegmentStatus, SegmentStatusManager} +import org.apache.carbondata.core.util.{CarbonProperties, ThreadLocalSessionInfo} +import org.apache.carbondata.core.util.path.CarbonTablePath +import org.apache.carbondata.events.OperationContext +import org.apache.carbondata.events.exception.PreEventException +import org.apache.carbondata.processing.loading.TableProcessingOperations +import org.apache.carbondata.processing.loading.exception.NoRetryException +import org.apache.carbondata.processing.loading.model.CarbonLoadModel +import org.apache.carbondata.processing.util.{CarbonDataProcessorUtil, CarbonLoaderUtil} +import org.apache.carbondata.spark.rdd.CarbonDataRDDFactory + +/* +* insert into with df, doesn't use logical plan +* +*/ +case class CarbonInsertIntoWithDf(databaseNameOp: Option[String], + tableName: String, + options: Map[String, String], + isOverwriteTable: Boolean, + var dimFilesPath: Seq[DataLoadTableFileMapping] = Seq(), + var dataFrame: DataFrame, + var inputSqlString: String = null, + var updateModel: Option[UpdateTableModel] = None, + var tableInfoOp: Option[TableInfo] = None, + var internalOptions: Map[String, String] = Map.empty, + var partition: Map[String, Option[String]] = Map.empty, + var operationContext: OperationContext = new OperationContext) { + + var table: CarbonTable = _ Review comment: Please remove unnecessary class level variables like these ---------------------------------------------------------------- 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
kunal642 commented on a change in pull request #3538: [CARBONDATA-3637] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#discussion_r374614556 ########## File path: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonInsertIntoWithDf.scala ########## @@ -0,0 +1,230 @@ +/* + * 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.spark.sql.execution.command.management + +import java.text.SimpleDateFormat +import java.util + +import org.apache.spark.sql.{AnalysisException, CarbonUtils, DataFrame, Dataset, Row, SparkSession} +import org.apache.spark.sql.execution.command.{DataLoadTableFileMapping, UpdateTableModel} +import org.apache.spark.sql.execution.datasources.LogicalRelation +import org.apache.spark.util.{CarbonReflectionUtils, CausedBy, SparkUtil} + +import org.apache.carbondata.common.logging.LogServiceFactory +import org.apache.carbondata.core.datastore.impl.FileFactory +import org.apache.carbondata.core.indexstore.PartitionSpec +import org.apache.carbondata.core.metadata.schema.table.{CarbonTable, TableInfo} +import org.apache.carbondata.core.statusmanager.{LoadMetadataDetails, SegmentStatus, SegmentStatusManager} +import org.apache.carbondata.core.util.{CarbonProperties, ThreadLocalSessionInfo} +import org.apache.carbondata.core.util.path.CarbonTablePath +import org.apache.carbondata.events.OperationContext +import org.apache.carbondata.events.exception.PreEventException +import org.apache.carbondata.processing.loading.TableProcessingOperations +import org.apache.carbondata.processing.loading.exception.NoRetryException +import org.apache.carbondata.processing.loading.model.CarbonLoadModel +import org.apache.carbondata.processing.util.{CarbonDataProcessorUtil, CarbonLoaderUtil} +import org.apache.carbondata.spark.rdd.CarbonDataRDDFactory + +/* +* insert into with df, doesn't use logical plan +* +*/ +case class CarbonInsertIntoWithDf(databaseNameOp: Option[String], + tableName: String, + options: Map[String, String], + isOverwriteTable: Boolean, + var dimFilesPath: Seq[DataLoadTableFileMapping] = Seq(), + var dataFrame: DataFrame, + var inputSqlString: String = null, + var updateModel: Option[UpdateTableModel] = None, + var tableInfoOp: Option[TableInfo] = None, + var internalOptions: Map[String, String] = Map.empty, + var partition: Map[String, Option[String]] = Map.empty, + var operationContext: OperationContext = new OperationContext) { + + var table: CarbonTable = _ + + var logicalPartitionRelation: LogicalRelation = _ + + var sizeInBytes: Long = _ + + var currPartitions: util.List[PartitionSpec] = _ + + var parentTablePath: String = _ + + val LOGGER = LogServiceFactory.getLogService(this.getClass.getName) + + var finalPartition: Map[String, Option[String]] = Map.empty + + var timeStampFormat: SimpleDateFormat = _ + + var dateFormat: SimpleDateFormat = _ + + def process(sparkSession: SparkSession): Seq[Row] = { + ThreadLocalSessionInfo + .setConfigurationToCurrentThread(sparkSession.sessionState.newHadoopConf()) + val (sizeInBytes, table, dbName, logicalPartitionRelation, finalPartition) = CommonLoadUtils + .processMetadataCommon( + sparkSession, + databaseNameOp, + tableName, + tableInfoOp, + partition) + this.sizeInBytes = sizeInBytes + this.table = table + this.logicalPartitionRelation = logicalPartitionRelation + this.finalPartition = finalPartition + val carbonProperty: CarbonProperties = CarbonProperties.getInstance() + val hadoopConf = sparkSession.sessionState.newHadoopConf() + carbonProperty.addProperty("zookeeper.enable.lock", "false") + val factPath = "" + currPartitions = CommonLoadUtils.getCurrentParitions(sparkSession, table) + CommonLoadUtils.setNumberOfCoresWhileLoading(sparkSession, carbonProperty) + val optionsFinal: util.Map[String, String] = + CommonLoadUtils.getFinalLoadOptions( + carbonProperty, table, options) + val carbonLoadModel: CarbonLoadModel = CommonLoadUtils.prepareLoadModel( + hadoopConf, + factPath, + optionsFinal, + parentTablePath, + table, + isDataFrame = true, + internalOptions, + finalPartition, + options) + val (tf, df) = CommonLoadUtils.getTimeAndDateFormatFromLoadModel( + carbonLoadModel) + timeStampFormat = tf + dateFormat = df Review comment: Make dateFormat and timeStampFormat as local variables ---------------------------------------------------------------- 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
kunal642 commented on a change in pull request #3538: [CARBONDATA-3637] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#discussion_r374615892 ########## File path: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonInsertIntoWithDf.scala ########## @@ -0,0 +1,230 @@ +/* + * 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.spark.sql.execution.command.management + +import java.text.SimpleDateFormat +import java.util + +import org.apache.spark.sql.{AnalysisException, CarbonUtils, DataFrame, Dataset, Row, SparkSession} +import org.apache.spark.sql.execution.command.{DataLoadTableFileMapping, UpdateTableModel} +import org.apache.spark.sql.execution.datasources.LogicalRelation +import org.apache.spark.util.{CarbonReflectionUtils, CausedBy, SparkUtil} + +import org.apache.carbondata.common.logging.LogServiceFactory +import org.apache.carbondata.core.datastore.impl.FileFactory +import org.apache.carbondata.core.indexstore.PartitionSpec +import org.apache.carbondata.core.metadata.schema.table.{CarbonTable, TableInfo} +import org.apache.carbondata.core.statusmanager.{LoadMetadataDetails, SegmentStatus, SegmentStatusManager} +import org.apache.carbondata.core.util.{CarbonProperties, ThreadLocalSessionInfo} +import org.apache.carbondata.core.util.path.CarbonTablePath +import org.apache.carbondata.events.OperationContext +import org.apache.carbondata.events.exception.PreEventException +import org.apache.carbondata.processing.loading.TableProcessingOperations +import org.apache.carbondata.processing.loading.exception.NoRetryException +import org.apache.carbondata.processing.loading.model.CarbonLoadModel +import org.apache.carbondata.processing.util.{CarbonDataProcessorUtil, CarbonLoaderUtil} +import org.apache.carbondata.spark.rdd.CarbonDataRDDFactory + +/* +* insert into with df, doesn't use logical plan +* +*/ +case class CarbonInsertIntoWithDf(databaseNameOp: Option[String], + tableName: String, + options: Map[String, String], + isOverwriteTable: Boolean, + var dimFilesPath: Seq[DataLoadTableFileMapping] = Seq(), + var dataFrame: DataFrame, + var inputSqlString: String = null, + var updateModel: Option[UpdateTableModel] = None, + var tableInfoOp: Option[TableInfo] = None, + var internalOptions: Map[String, String] = Map.empty, + var partition: Map[String, Option[String]] = Map.empty, + var operationContext: OperationContext = new OperationContext) { + + var table: CarbonTable = _ + + var logicalPartitionRelation: LogicalRelation = _ + + var sizeInBytes: Long = _ + + var currPartitions: util.List[PartitionSpec] = _ + + var parentTablePath: String = _ + + val LOGGER = LogServiceFactory.getLogService(this.getClass.getName) + + var finalPartition: Map[String, Option[String]] = Map.empty + + var timeStampFormat: SimpleDateFormat = _ + + var dateFormat: SimpleDateFormat = _ + + def process(sparkSession: SparkSession): Seq[Row] = { + ThreadLocalSessionInfo + .setConfigurationToCurrentThread(sparkSession.sessionState.newHadoopConf()) + val (sizeInBytes, table, dbName, logicalPartitionRelation, finalPartition) = CommonLoadUtils + .processMetadataCommon( + sparkSession, + databaseNameOp, + tableName, + tableInfoOp, + partition) + this.sizeInBytes = sizeInBytes + this.table = table + this.logicalPartitionRelation = logicalPartitionRelation + this.finalPartition = finalPartition + val carbonProperty: CarbonProperties = CarbonProperties.getInstance() + val hadoopConf = sparkSession.sessionState.newHadoopConf() + carbonProperty.addProperty("zookeeper.enable.lock", "false") + val factPath = "" + currPartitions = CommonLoadUtils.getCurrentParitions(sparkSession, table) + CommonLoadUtils.setNumberOfCoresWhileLoading(sparkSession, carbonProperty) + val optionsFinal: util.Map[String, String] = + CommonLoadUtils.getFinalLoadOptions( + carbonProperty, table, options) + val carbonLoadModel: CarbonLoadModel = CommonLoadUtils.prepareLoadModel( + hadoopConf, + factPath, + optionsFinal, + parentTablePath, + table, + isDataFrame = true, + internalOptions, + finalPartition, + options) Review comment: Can we have a single map instead of 'options' and 'internalOptions'? ---------------------------------------------------------------- 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
kunal642 commented on a change in pull request #3538: [CARBONDATA-3637] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#discussion_r374615892 ########## File path: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonInsertIntoWithDf.scala ########## @@ -0,0 +1,230 @@ +/* + * 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.spark.sql.execution.command.management + +import java.text.SimpleDateFormat +import java.util + +import org.apache.spark.sql.{AnalysisException, CarbonUtils, DataFrame, Dataset, Row, SparkSession} +import org.apache.spark.sql.execution.command.{DataLoadTableFileMapping, UpdateTableModel} +import org.apache.spark.sql.execution.datasources.LogicalRelation +import org.apache.spark.util.{CarbonReflectionUtils, CausedBy, SparkUtil} + +import org.apache.carbondata.common.logging.LogServiceFactory +import org.apache.carbondata.core.datastore.impl.FileFactory +import org.apache.carbondata.core.indexstore.PartitionSpec +import org.apache.carbondata.core.metadata.schema.table.{CarbonTable, TableInfo} +import org.apache.carbondata.core.statusmanager.{LoadMetadataDetails, SegmentStatus, SegmentStatusManager} +import org.apache.carbondata.core.util.{CarbonProperties, ThreadLocalSessionInfo} +import org.apache.carbondata.core.util.path.CarbonTablePath +import org.apache.carbondata.events.OperationContext +import org.apache.carbondata.events.exception.PreEventException +import org.apache.carbondata.processing.loading.TableProcessingOperations +import org.apache.carbondata.processing.loading.exception.NoRetryException +import org.apache.carbondata.processing.loading.model.CarbonLoadModel +import org.apache.carbondata.processing.util.{CarbonDataProcessorUtil, CarbonLoaderUtil} +import org.apache.carbondata.spark.rdd.CarbonDataRDDFactory + +/* +* insert into with df, doesn't use logical plan +* +*/ +case class CarbonInsertIntoWithDf(databaseNameOp: Option[String], + tableName: String, + options: Map[String, String], + isOverwriteTable: Boolean, + var dimFilesPath: Seq[DataLoadTableFileMapping] = Seq(), + var dataFrame: DataFrame, + var inputSqlString: String = null, + var updateModel: Option[UpdateTableModel] = None, + var tableInfoOp: Option[TableInfo] = None, + var internalOptions: Map[String, String] = Map.empty, + var partition: Map[String, Option[String]] = Map.empty, + var operationContext: OperationContext = new OperationContext) { + + var table: CarbonTable = _ + + var logicalPartitionRelation: LogicalRelation = _ + + var sizeInBytes: Long = _ + + var currPartitions: util.List[PartitionSpec] = _ + + var parentTablePath: String = _ + + val LOGGER = LogServiceFactory.getLogService(this.getClass.getName) + + var finalPartition: Map[String, Option[String]] = Map.empty + + var timeStampFormat: SimpleDateFormat = _ + + var dateFormat: SimpleDateFormat = _ + + def process(sparkSession: SparkSession): Seq[Row] = { + ThreadLocalSessionInfo + .setConfigurationToCurrentThread(sparkSession.sessionState.newHadoopConf()) + val (sizeInBytes, table, dbName, logicalPartitionRelation, finalPartition) = CommonLoadUtils + .processMetadataCommon( + sparkSession, + databaseNameOp, + tableName, + tableInfoOp, + partition) + this.sizeInBytes = sizeInBytes + this.table = table + this.logicalPartitionRelation = logicalPartitionRelation + this.finalPartition = finalPartition + val carbonProperty: CarbonProperties = CarbonProperties.getInstance() + val hadoopConf = sparkSession.sessionState.newHadoopConf() + carbonProperty.addProperty("zookeeper.enable.lock", "false") + val factPath = "" + currPartitions = CommonLoadUtils.getCurrentParitions(sparkSession, table) + CommonLoadUtils.setNumberOfCoresWhileLoading(sparkSession, carbonProperty) + val optionsFinal: util.Map[String, String] = + CommonLoadUtils.getFinalLoadOptions( + carbonProperty, table, options) + val carbonLoadModel: CarbonLoadModel = CommonLoadUtils.prepareLoadModel( + hadoopConf, + factPath, + optionsFinal, + parentTablePath, + table, + isDataFrame = true, + internalOptions, + finalPartition, + options) Review comment: Can we have a single map instead of 'options' and 'internalOptions'? Can be fixed in this PR as all Load classes are being refactored ---------------------------------------------------------------- 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
kunal642 commented on a change in pull request #3538: [CARBONDATA-3637] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#discussion_r374623053 ########## File path: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonInsertIntoWithDf.scala ########## @@ -0,0 +1,230 @@ +/* + * 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.spark.sql.execution.command.management + +import java.text.SimpleDateFormat +import java.util + +import org.apache.spark.sql.{AnalysisException, CarbonUtils, DataFrame, Dataset, Row, SparkSession} +import org.apache.spark.sql.execution.command.{DataLoadTableFileMapping, UpdateTableModel} +import org.apache.spark.sql.execution.datasources.LogicalRelation +import org.apache.spark.util.{CarbonReflectionUtils, CausedBy, SparkUtil} + +import org.apache.carbondata.common.logging.LogServiceFactory +import org.apache.carbondata.core.datastore.impl.FileFactory +import org.apache.carbondata.core.indexstore.PartitionSpec +import org.apache.carbondata.core.metadata.schema.table.{CarbonTable, TableInfo} +import org.apache.carbondata.core.statusmanager.{LoadMetadataDetails, SegmentStatus, SegmentStatusManager} +import org.apache.carbondata.core.util.{CarbonProperties, ThreadLocalSessionInfo} +import org.apache.carbondata.core.util.path.CarbonTablePath +import org.apache.carbondata.events.OperationContext +import org.apache.carbondata.events.exception.PreEventException +import org.apache.carbondata.processing.loading.TableProcessingOperations +import org.apache.carbondata.processing.loading.exception.NoRetryException +import org.apache.carbondata.processing.loading.model.CarbonLoadModel +import org.apache.carbondata.processing.util.{CarbonDataProcessorUtil, CarbonLoaderUtil} +import org.apache.carbondata.spark.rdd.CarbonDataRDDFactory + +/* +* insert into with df, doesn't use logical plan +* +*/ +case class CarbonInsertIntoWithDf(databaseNameOp: Option[String], + tableName: String, + options: Map[String, String], + isOverwriteTable: Boolean, + var dimFilesPath: Seq[DataLoadTableFileMapping] = Seq(), + var dataFrame: DataFrame, + var inputSqlString: String = null, + var updateModel: Option[UpdateTableModel] = None, + var tableInfoOp: Option[TableInfo] = None, + var internalOptions: Map[String, String] = Map.empty, + var partition: Map[String, Option[String]] = Map.empty, + var operationContext: OperationContext = new OperationContext) { + + var table: CarbonTable = _ + + var logicalPartitionRelation: LogicalRelation = _ + + var sizeInBytes: Long = _ + + var currPartitions: util.List[PartitionSpec] = _ + + var parentTablePath: String = _ + + val LOGGER = LogServiceFactory.getLogService(this.getClass.getName) + + var finalPartition: Map[String, Option[String]] = Map.empty + + var timeStampFormat: SimpleDateFormat = _ + + var dateFormat: SimpleDateFormat = _ + + def process(sparkSession: SparkSession): Seq[Row] = { + ThreadLocalSessionInfo + .setConfigurationToCurrentThread(sparkSession.sessionState.newHadoopConf()) + val (sizeInBytes, table, dbName, logicalPartitionRelation, finalPartition) = CommonLoadUtils + .processMetadataCommon( + sparkSession, + databaseNameOp, + tableName, + tableInfoOp, + partition) + this.sizeInBytes = sizeInBytes + this.table = table + this.logicalPartitionRelation = logicalPartitionRelation + this.finalPartition = finalPartition + val carbonProperty: CarbonProperties = CarbonProperties.getInstance() + val hadoopConf = sparkSession.sessionState.newHadoopConf() + carbonProperty.addProperty("zookeeper.enable.lock", "false") + val factPath = "" + currPartitions = CommonLoadUtils.getCurrentParitions(sparkSession, table) + CommonLoadUtils.setNumberOfCoresWhileLoading(sparkSession, carbonProperty) + val optionsFinal: util.Map[String, String] = + CommonLoadUtils.getFinalLoadOptions( + carbonProperty, table, options) + val carbonLoadModel: CarbonLoadModel = CommonLoadUtils.prepareLoadModel( + hadoopConf, + factPath, + optionsFinal, + parentTablePath, + table, + isDataFrame = true, + internalOptions, + finalPartition, + options) + val (tf, df) = CommonLoadUtils.getTimeAndDateFormatFromLoadModel( + carbonLoadModel) + timeStampFormat = tf + dateFormat = df + // Delete stale segment folders that are not in table status but are physically present in + // the Fact folder + LOGGER.info(s"Deleting stale folders if present for table $dbName.$tableName") + TableProcessingOperations.deletePartialLoadDataIfExist(table, false) + var isUpdateTableStatusRequired = false + val uuid = "" + try { + val (tableDataMaps, dataMapOperationContext) = + CommonLoadUtils.firePreLoadEvents(sparkSession, + carbonLoadModel, + uuid, + table, + isOverwriteTable, + operationContext) + // First system has to partition the data first and then call the load data + LOGGER.info(s"Initiating Direct Load for the Table : ($dbName.$tableName)") Review comment: Remove this log ---------------------------------------------------------------- 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
kunal642 commented on a change in pull request #3538: [CARBONDATA-3637] Optimize insert into flow
URL: https://github.com/apache/carbondata/pull/3538#discussion_r375086020 ########## File path: processing/src/main/java/org/apache/carbondata/processing/loading/steps/InputProcessorStepWithNoConverterImpl.java ########## @@ -334,6 +356,42 @@ private CarbonRowBatch getBatch() { return newData; } + private Object[] convertToNoDictionaryToBytesWithoutReArrange(Object[] data, Review comment: This method is almost same as 'convertToNoDictionaryToBytes'. Better to use the withoutReArrange to skip the rearrange in that method. ---------------------------------------------------------------- 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 |