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_r346177413
##########
File path: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/timeseries/TimeSeriesUtil.scala
##########
@@ -161,5 +161,55 @@ object TimeSeriesUtil {
obj._2.aggregateFunction.isEmpty)
isTimeSeriesColumnExits.get._2.aggregateFunction = timeSeriesFunction
}
+
+ def validateTimeSeriesGranularityForDate(
+ timeSeriesFunction: String): Unit = {
+ for (granularity <- Granularity.values()) {
+ if (timeSeriesFunction.equalsIgnoreCase(granularity.getName
+ .substring(0, granularity.getName.indexOf(CarbonCommonConstants.UNDERSCORE)))) {
+ if (!(granularity.getName.equalsIgnoreCase(Granularity.DAY.getName) ||
+ granularity.getName.equalsIgnoreCase(Granularity.MONTH.getName) ||
+ granularity.getName.equalsIgnoreCase(Granularity.YEAR.getName))) {
+ throw new MalformedCarbonCommandException(
+ "Granularity should be DAY,MONTH or YEAR, for timeseries column of Date type")
+ }
+ }
+ }
+ }
+
+ /**
+ * validate TimeSeries Granularity
+ *
+ * @param timeSeriesFunction user defined granularity
+ */
+ def validateTimeSeriesGranularity(
+ timeSeriesFunction: String): Unit = {
+ var found = false
+ for (granularity <- Granularity.values()) {
+ if (timeSeriesFunction.equalsIgnoreCase(granularity.getName
+ .substring(0, granularity.getName.indexOf(CarbonCommonConstants.UNDERSCORE)))) {
+ found = true
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