[GitHub] [carbondata] kunal642 opened a new pull request #3697: [HOTFIX] Refactored hive related classes to use constants

classic Classic list List threaded Threaded
29 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] ajantha-bhat commented on a change in pull request #3697: [HOTFIX] Refactored hive related classes to use constants

GitBox
ajantha-bhat commented on a change in pull request #3697: [HOTFIX] Refactored hive related classes to use constants
URL: https://github.com/apache/carbondata/pull/3697#discussion_r404713321
 
 

 ##########
 File path: integration/hive/src/main/java/org/apache/carbondata/hive/MapredCarbonOutputFormat.java
 ##########
 @@ -61,24 +68,32 @@ public void checkOutputSpecs(FileSystem fileSystem, JobConf jobConf) throws IOEx
   public FileSinkOperator.RecordWriter getHiveRecordWriter(JobConf jc, Path finalOutPath,
       Class<? extends Writable> valueClass, boolean isCompressed, Properties tableProperties,
       Progressable progress) throws IOException {
+    ThreadLocalSessionInfo.setConfigurationToCurrentThread(jc);
     CarbonLoadModel carbonLoadModel = null;
+    // Try to get loadmodel from JobConf.
     String encodedString = jc.get(LOAD_MODEL);
     if (encodedString != null) {
       carbonLoadModel =
           (CarbonLoadModel) ObjectSerializationUtil.convertStringToObject(encodedString);
-    }
-    if (carbonLoadModel == null) {
-      carbonLoadModel = HiveCarbonUtil.getCarbonLoadModel(tableProperties, jc);
     } else {
-      for (Map.Entry<Object, Object> entry : tableProperties.entrySet()) {
-        carbonLoadModel.getCarbonDataLoadSchema().getCarbonTable().getTableInfo().getFactTable()
-            .getTableProperties().put(entry.getKey().toString().toLowerCase(),
-            entry.getValue().toString().toLowerCase());
+      // Try to get loadmodel from Container environment.
+      encodedString = System.getenv("carbon");
+      if (encodedString != null) {
+        carbonLoadModel =
+            (CarbonLoadModel) ObjectSerializationUtil.convertStringToObject(encodedString);
+      } else {
+        carbonLoadModel = HiveCarbonUtil.getCarbonLoadModel(tableProperties, jc);
       }
     }
+    for (Map.Entry<Object, Object> entry : tableProperties.entrySet()) {
 
 Review comment:
   where are these table properties validated ?

----------------------------------------------------------------
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
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] kunal642 commented on a change in pull request #3697: [HOTFIX] Refactored hive related classes to use constants

GitBox
In reply to this post by GitBox
kunal642 commented on a change in pull request #3697: [HOTFIX] Refactored hive related classes to use constants
URL: https://github.com/apache/carbondata/pull/3697#discussion_r404718652
 
 

 ##########
 File path: integration/hive/src/main/java/org/apache/carbondata/hive/MapredCarbonOutputFormat.java
 ##########
 @@ -61,24 +68,32 @@ public void checkOutputSpecs(FileSystem fileSystem, JobConf jobConf) throws IOEx
   public FileSinkOperator.RecordWriter getHiveRecordWriter(JobConf jc, Path finalOutPath,
       Class<? extends Writable> valueClass, boolean isCompressed, Properties tableProperties,
       Progressable progress) throws IOException {
+    ThreadLocalSessionInfo.setConfigurationToCurrentThread(jc);
     CarbonLoadModel carbonLoadModel = null;
+    // Try to get loadmodel from JobConf.
     String encodedString = jc.get(LOAD_MODEL);
     if (encodedString != null) {
       carbonLoadModel =
           (CarbonLoadModel) ObjectSerializationUtil.convertStringToObject(encodedString);
-    }
-    if (carbonLoadModel == null) {
-      carbonLoadModel = HiveCarbonUtil.getCarbonLoadModel(tableProperties, jc);
     } else {
-      for (Map.Entry<Object, Object> entry : tableProperties.entrySet()) {
-        carbonLoadModel.getCarbonDataLoadSchema().getCarbonTable().getTableInfo().getFactTable()
-            .getTableProperties().put(entry.getKey().toString().toLowerCase(),
-            entry.getValue().toString().toLowerCase());
+      // Try to get loadmodel from Container environment.
+      encodedString = System.getenv("carbon");
+      if (encodedString != null) {
+        carbonLoadModel =
+            (CarbonLoadModel) ObjectSerializationUtil.convertStringToObject(encodedString);
+      } else {
+        carbonLoadModel = HiveCarbonUtil.getCarbonLoadModel(tableProperties, jc);
       }
     }
+    for (Map.Entry<Object, Object> entry : tableProperties.entrySet()) {
 
 Review comment:
   in CarbonLoadModelBuilder

----------------------------------------------------------------
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
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] kunal642 commented on a change in pull request #3697: [HOTFIX] Refactored hive related classes to use constants

GitBox
In reply to this post by GitBox
kunal642 commented on a change in pull request #3697: [HOTFIX] Refactored hive related classes to use constants
URL: https://github.com/apache/carbondata/pull/3697#discussion_r404719261
 
 

 ##########
 File path: core/src/main/java/org/apache/carbondata/core/util/CarbonProperties.java
 ##########
 @@ -855,7 +855,11 @@ private void loadProperties() {
    * Return the store path
    */
   public static String getStorePath() {
-    return getInstance().getProperty(CarbonCommonConstants.STORE_LOCATION);
+    String storePath = getInstance().getProperty(CarbonCommonConstants.STORE_LOCATION);
+    if (storePath == null) {
 
 Review comment:
   Internally spark sets the value of spark.warehouse.dir to hive.metastore.warehouse.dir, so hive.metastore.warehouse.dir is enough here

----------------------------------------------------------------
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
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] ajantha-bhat commented on a change in pull request #3697: [HOTFIX] Refactored hive related classes to use constants

GitBox
In reply to this post by GitBox
ajantha-bhat commented on a change in pull request #3697: [HOTFIX] Refactored hive related classes to use constants
URL: https://github.com/apache/carbondata/pull/3697#discussion_r405224377
 
 

 ##########
 File path: core/src/main/java/org/apache/carbondata/core/util/CarbonProperties.java
 ##########
 @@ -855,7 +855,11 @@ private void loadProperties() {
    * Return the store path
    */
   public static String getStorePath() {
-    return getInstance().getProperty(CarbonCommonConstants.STORE_LOCATION);
+    String storePath = getInstance().getProperty(CarbonCommonConstants.STORE_LOCATION);
+    if (storePath == null) {
 
 Review comment:
   ok

----------------------------------------------------------------
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
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] ajantha-bhat commented on a change in pull request #3697: [HOTFIX] Refactored hive related classes to use constants

GitBox
In reply to this post by GitBox
ajantha-bhat commented on a change in pull request #3697: [HOTFIX] Refactored hive related classes to use constants
URL: https://github.com/apache/carbondata/pull/3697#discussion_r405224399
 
 

 ##########
 File path: integration/hive/src/main/java/org/apache/carbondata/hive/MapredCarbonOutputFormat.java
 ##########
 @@ -61,24 +68,32 @@ public void checkOutputSpecs(FileSystem fileSystem, JobConf jobConf) throws IOEx
   public FileSinkOperator.RecordWriter getHiveRecordWriter(JobConf jc, Path finalOutPath,
       Class<? extends Writable> valueClass, boolean isCompressed, Properties tableProperties,
       Progressable progress) throws IOException {
+    ThreadLocalSessionInfo.setConfigurationToCurrentThread(jc);
     CarbonLoadModel carbonLoadModel = null;
+    // Try to get loadmodel from JobConf.
     String encodedString = jc.get(LOAD_MODEL);
     if (encodedString != null) {
       carbonLoadModel =
           (CarbonLoadModel) ObjectSerializationUtil.convertStringToObject(encodedString);
-    }
-    if (carbonLoadModel == null) {
-      carbonLoadModel = HiveCarbonUtil.getCarbonLoadModel(tableProperties, jc);
     } else {
-      for (Map.Entry<Object, Object> entry : tableProperties.entrySet()) {
-        carbonLoadModel.getCarbonDataLoadSchema().getCarbonTable().getTableInfo().getFactTable()
-            .getTableProperties().put(entry.getKey().toString().toLowerCase(),
-            entry.getValue().toString().toLowerCase());
+      // Try to get loadmodel from Container environment.
+      encodedString = System.getenv("carbon");
+      if (encodedString != null) {
+        carbonLoadModel =
+            (CarbonLoadModel) ObjectSerializationUtil.convertStringToObject(encodedString);
+      } else {
+        carbonLoadModel = HiveCarbonUtil.getCarbonLoadModel(tableProperties, jc);
       }
     }
+    for (Map.Entry<Object, Object> entry : tableProperties.entrySet()) {
 
 Review comment:
   ok

----------------------------------------------------------------
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
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] ajantha-bhat commented on a change in pull request #3697: [HOTFIX] Refactored hive related classes to use constants

GitBox
In reply to this post by GitBox
ajantha-bhat commented on a change in pull request #3697: [HOTFIX] Refactored hive related classes to use constants
URL: https://github.com/apache/carbondata/pull/3697#discussion_r405224399
 
 

 ##########
 File path: integration/hive/src/main/java/org/apache/carbondata/hive/MapredCarbonOutputFormat.java
 ##########
 @@ -61,24 +68,32 @@ public void checkOutputSpecs(FileSystem fileSystem, JobConf jobConf) throws IOEx
   public FileSinkOperator.RecordWriter getHiveRecordWriter(JobConf jc, Path finalOutPath,
       Class<? extends Writable> valueClass, boolean isCompressed, Properties tableProperties,
       Progressable progress) throws IOException {
+    ThreadLocalSessionInfo.setConfigurationToCurrentThread(jc);
     CarbonLoadModel carbonLoadModel = null;
+    // Try to get loadmodel from JobConf.
     String encodedString = jc.get(LOAD_MODEL);
     if (encodedString != null) {
       carbonLoadModel =
           (CarbonLoadModel) ObjectSerializationUtil.convertStringToObject(encodedString);
-    }
-    if (carbonLoadModel == null) {
-      carbonLoadModel = HiveCarbonUtil.getCarbonLoadModel(tableProperties, jc);
     } else {
-      for (Map.Entry<Object, Object> entry : tableProperties.entrySet()) {
-        carbonLoadModel.getCarbonDataLoadSchema().getCarbonTable().getTableInfo().getFactTable()
-            .getTableProperties().put(entry.getKey().toString().toLowerCase(),
-            entry.getValue().toString().toLowerCase());
+      // Try to get loadmodel from Container environment.
+      encodedString = System.getenv("carbon");
+      if (encodedString != null) {
+        carbonLoadModel =
+            (CarbonLoadModel) ObjectSerializationUtil.convertStringToObject(encodedString);
+      } else {
+        carbonLoadModel = HiveCarbonUtil.getCarbonLoadModel(tableProperties, jc);
       }
     }
+    for (Map.Entry<Object, Object> entry : tableProperties.entrySet()) {
 
 Review comment:
   ok. But it is ideal to validate before adding to table

----------------------------------------------------------------
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
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] kunal642 commented on a change in pull request #3697: [HOTFIX] Refactored hive related classes to use constants

GitBox
In reply to this post by GitBox
kunal642 commented on a change in pull request #3697: [HOTFIX] Refactored hive related classes to use constants
URL: https://github.com/apache/carbondata/pull/3697#discussion_r405298312
 
 

 ##########
 File path: integration/hive/src/main/java/org/apache/carbondata/hive/MapredCarbonOutputFormat.java
 ##########
 @@ -61,24 +68,32 @@ public void checkOutputSpecs(FileSystem fileSystem, JobConf jobConf) throws IOEx
   public FileSinkOperator.RecordWriter getHiveRecordWriter(JobConf jc, Path finalOutPath,
       Class<? extends Writable> valueClass, boolean isCompressed, Properties tableProperties,
       Progressable progress) throws IOException {
+    ThreadLocalSessionInfo.setConfigurationToCurrentThread(jc);
     CarbonLoadModel carbonLoadModel = null;
+    // Try to get loadmodel from JobConf.
     String encodedString = jc.get(LOAD_MODEL);
     if (encodedString != null) {
       carbonLoadModel =
           (CarbonLoadModel) ObjectSerializationUtil.convertStringToObject(encodedString);
-    }
-    if (carbonLoadModel == null) {
-      carbonLoadModel = HiveCarbonUtil.getCarbonLoadModel(tableProperties, jc);
     } else {
-      for (Map.Entry<Object, Object> entry : tableProperties.entrySet()) {
-        carbonLoadModel.getCarbonDataLoadSchema().getCarbonTable().getTableInfo().getFactTable()
-            .getTableProperties().put(entry.getKey().toString().toLowerCase(),
-            entry.getValue().toString().toLowerCase());
+      // Try to get loadmodel from Container environment.
+      encodedString = System.getenv("carbon");
+      if (encodedString != null) {
+        carbonLoadModel =
+            (CarbonLoadModel) ObjectSerializationUtil.convertStringToObject(encodedString);
+      } else {
+        carbonLoadModel = HiveCarbonUtil.getCarbonLoadModel(tableProperties, jc);
       }
     }
+    for (Map.Entry<Object, Object> entry : tableProperties.entrySet()) {
 
 Review comment:
   CarbonLoadModelBuilder is used to create LoadModel before this. So the properties would be validated

----------------------------------------------------------------
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
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] kevinjmh commented on a change in pull request #3697: [HOTFIX] Refactored hive related classes to use constants

GitBox
In reply to this post by GitBox
kevinjmh commented on a change in pull request #3697: [HOTFIX] Refactored hive related classes to use constants
URL: https://github.com/apache/carbondata/pull/3697#discussion_r405391079
 
 

 ##########
 File path: core/src/main/java/org/apache/carbondata/core/util/CarbonProperties.java
 ##########
 @@ -855,7 +855,11 @@ private void loadProperties() {
    * Return the store path
    */
   public static String getStorePath() {
-    return getInstance().getProperty(CarbonCommonConstants.STORE_LOCATION);
+    String storePath = getInstance().getProperty(CarbonCommonConstants.STORE_LOCATION);
+    if (storePath == null) {
 
 Review comment:
   > Internally spark sets the value of spark.warehouse.dir to hive.metastore.warehouse.dir, so hive.metastore.warehouse.dir is enough here
   
   we can mark this as comment in 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
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] kunal642 closed pull request #3697: [HOTFIX] Refactored hive related classes to use constants

GitBox
In reply to this post by GitBox
kunal642 closed pull request #3697: [HOTFIX] Refactored hive related classes to use constants
URL: https://github.com/apache/carbondata/pull/3697
 
 
   

----------------------------------------------------------------
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
12