You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/02/03 19:04:30 UTC

[GitHub] [incubator-pinot] npawar opened a new pull request #6538: Support date_trunc during ingestion

npawar opened a new pull request #6538:
URL: https://github.com/apache/incubator-pinot/pull/6538


   date_trunc was only available during query time. Adding it to scalar functions, so that it can be used during ingestion.
   All logic is simply moved from DateTruncTransformFunction class to shared utils. No new logic has been introduced.
   
   Also as part of this PR, split the InbuiltFunctionsTest into test files of their own, per function group (arithmetic, array, json, datetime), because that file was getting too long.
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] fx19880617 commented on pull request #6538: Support date_trunc during ingestion

Posted by GitBox <gi...@apache.org>.
fx19880617 commented on pull request #6538:
URL: https://github.com/apache/incubator-pinot/pull/6538#issuecomment-773149504


   Maybe also change the PR title to mention that we move date_trunc to scalar function.
   Something like: Add date_trunc to scalar functions to support date_trunc during ingestion


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] npawar merged pull request #6538: Add date_trunc to scalar functions to support date_trunc during ingestion

Posted by GitBox <gi...@apache.org>.
npawar merged pull request #6538:
URL: https://github.com/apache/incubator-pinot/pull/6538


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] fx19880617 commented on a change in pull request #6538: Support date_trunc during ingestion

Posted by GitBox <gi...@apache.org>.
fx19880617 commented on a change in pull request #6538:
URL: https://github.com/apache/incubator-pinot/pull/6538#discussion_r569765896



##########
File path: pinot-common/src/main/java/org/apache/pinot/common/function/DateTimeUtils.java
##########
@@ -0,0 +1,152 @@
+/**
+ * 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.pinot.common.function;
+
+import org.joda.time.Chronology;
+import org.joda.time.DateTimeField;
+import org.joda.time.DateTimeFieldType;
+import org.joda.time.DateTimeZone;
+import org.joda.time.DurationField;
+import org.joda.time.DurationFieldType;
+import org.joda.time.chrono.ISOChronology;
+import org.joda.time.field.DividedDateTimeField;
+import org.joda.time.field.OffsetDateTimeField;
+import org.joda.time.field.ScaledDurationField;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Helper methods and constructs for datetrunc function
+ */
+public class DateTimeUtils {
+
+  private static final Logger LOGGER = LoggerFactory.getLogger(DateTimeUtils.class);
+  private static final DateTimeFieldType QUARTER_OF_YEAR = new QuarterOfYearDateTimeField();
+
+  public static DateTimeField getTimestampField(ISOChronology chronology, String unitString) {
+    switch (unitString) {

Review comment:
       Do we need to make this case insensitive?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] npawar merged pull request #6538: Add date_trunc to scalar functions to support date_trunc during ingestion

Posted by GitBox <gi...@apache.org>.
npawar merged pull request #6538:
URL: https://github.com/apache/incubator-pinot/pull/6538


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] fx19880617 commented on pull request #6538: Support date_trunc during ingestion

Posted by GitBox <gi...@apache.org>.
fx19880617 commented on pull request #6538:
URL: https://github.com/apache/incubator-pinot/pull/6538#issuecomment-773149504


   Maybe also change the PR title to mention that we move date_trunc to scalar function.
   Something like: Add date_trunc to scalar functions to support date_trunc during ingestion


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] fx19880617 commented on a change in pull request #6538: Support date_trunc during ingestion

Posted by GitBox <gi...@apache.org>.
fx19880617 commented on a change in pull request #6538:
URL: https://github.com/apache/incubator-pinot/pull/6538#discussion_r569790447



##########
File path: pinot-common/src/main/java/org/apache/pinot/common/function/DateTimeUtils.java
##########
@@ -0,0 +1,152 @@
+/**
+ * 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.pinot.common.function;
+
+import org.joda.time.Chronology;
+import org.joda.time.DateTimeField;
+import org.joda.time.DateTimeFieldType;
+import org.joda.time.DateTimeZone;
+import org.joda.time.DurationField;
+import org.joda.time.DurationFieldType;
+import org.joda.time.chrono.ISOChronology;
+import org.joda.time.field.DividedDateTimeField;
+import org.joda.time.field.OffsetDateTimeField;
+import org.joda.time.field.ScaledDurationField;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Helper methods and constructs for datetrunc function
+ */
+public class DateTimeUtils {
+
+  private static final Logger LOGGER = LoggerFactory.getLogger(DateTimeUtils.class);
+  private static final DateTimeFieldType QUARTER_OF_YEAR = new QuarterOfYearDateTimeField();
+
+  public static DateTimeField getTimestampField(ISOChronology chronology, String unitString) {
+    switch (unitString) {

Review comment:
       Since this could also be used in the ingestion functions




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] npawar commented on a change in pull request #6538: Support date_trunc during ingestion

Posted by GitBox <gi...@apache.org>.
npawar commented on a change in pull request #6538:
URL: https://github.com/apache/incubator-pinot/pull/6538#discussion_r569816554



##########
File path: pinot-common/src/main/java/org/apache/pinot/common/function/DateTimeUtils.java
##########
@@ -0,0 +1,152 @@
+/**
+ * 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.pinot.common.function;
+
+import org.joda.time.Chronology;
+import org.joda.time.DateTimeField;
+import org.joda.time.DateTimeFieldType;
+import org.joda.time.DateTimeZone;
+import org.joda.time.DurationField;
+import org.joda.time.DurationFieldType;
+import org.joda.time.chrono.ISOChronology;
+import org.joda.time.field.DividedDateTimeField;
+import org.joda.time.field.OffsetDateTimeField;
+import org.joda.time.field.ScaledDurationField;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Helper methods and constructs for datetrunc function
+ */
+public class DateTimeUtils {
+
+  private static final Logger LOGGER = LoggerFactory.getLogger(DateTimeUtils.class);
+  private static final DateTimeFieldType QUARTER_OF_YEAR = new QuarterOfYearDateTimeField();
+
+  public static DateTimeField getTimestampField(ISOChronology chronology, String unitString) {
+    switch (unitString) {

Review comment:
       Done




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org