[GitHub] [carbondata] Indhumathi27 commented on a change in pull request #3437: [CARBONDATA-3530] Support Create timeseries MV Datamap with the supported granularity levels.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] Indhumathi27 commented on a change in pull request #3437: [CARBONDATA-3530] Support Create timeseries MV Datamap with the supported granularity levels.

GitBox
Indhumathi27 commented on a change in pull request #3437: [CARBONDATA-3530] Support Create timeseries MV Datamap with the supported granularity levels.
URL: https://github.com/apache/carbondata/pull/3437#discussion_r346172832
 
 

 ##########
 File path: datamap/mv/core/src/main/scala/org/apache/carbondata/mv/datamap/MVHelper.scala
 ##########
 @@ -152,6 +176,33 @@ object MVHelper {
           fields,
           fieldRelationMap,
           tableProperties)
+      if (timeSeriesFunction != null) {
+        if (null != mainTable && (parentTablesList.size() == 1)) {
+          if (!mainTable.getTableName.equalsIgnoreCase(parentTablesList.get(0).getTableName)) {
+            throw new MalformedCarbonCommandException(
+              "Parent table name is different in Create and Select Statement")
+          }
+        }
+        val timeSeriesDataType = parentTablesList
+          .get(0)
+          .getTableInfo
+          .getFactTable
+          .getListOfColumns
+          .asScala
+          .filter(columnSchema => columnSchema.getColumnName
+            .equalsIgnoreCase(timeSeriesColumn))
+          .head
+          .getDataType
+        if (timeSeriesDataType.equals(DataTypes.DATE) ||
+            timeSeriesDataType.equals(DataTypes.TIMESTAMP)) {
+          if (timeSeriesDataType.equals(DataTypes.DATE)) {
+            TimeSeriesUtil.validateTimeSeriesGranularityForDate(timeSeriesFunction)
+          }
 
 Review comment:
   Validation is already added for granularity. This validation is particularly added for Date type, as for Date type, granularity like second,hour,minute is invalid.

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