LakshSingla commented on a change in pull request #12163: URL: https://github.com/apache/druid/pull/12163#discussion_r794933546
########## File path: sql/src/main/codegen/includes/insert.ftl ########## @@ -0,0 +1,65 @@ +/* + * 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. + */ + +SqlNode DruidSqlInsert() : +{ + SqlNode insertNode; + SqlNode partitionBy = null; + SqlNodeList clusterBy = null; +} +{ + insertNode = SqlInsert() + [ + <PARTITION> <BY> + partitionBy = StringLiteral() Review comment: One more question regarding the query granularities: `TimeUnit()` in Calcite is defined to have the following units (from MILLISECOND to MILLENNIUM). ``` <MILLISECOND> { return TimeUnit.MILLISECOND; } | <SECOND> { return TimeUnit.SECOND; } | <MINUTE> { return TimeUnit.MINUTE; } | <HOUR> { return TimeUnit.HOUR; } | <DAY> { return TimeUnit.DAY; } | <DOW> { return TimeUnit.DOW; } | <DOY> { return TimeUnit.DOY; } | <ISODOW> { return TimeUnit.ISODOW; } | <ISOYEAR> { return TimeUnit.ISOYEAR; } | <WEEK> { return TimeUnit.WEEK; } | <MONTH> { return TimeUnit.MONTH; } | <QUARTER> { return TimeUnit.QUARTER; } | <YEAR> { return TimeUnit.YEAR; } | <EPOCH> { return TimeUnit.EPOCH; } | <DECADE> { return TimeUnit.DECADE; } | <CENTURY> { return TimeUnit.CENTURY; } | <MILLENNIUM> { return TimeUnit.MILLENNIUM; } ``` Whereas in Druid's TimeUnitRange-Period map, the granularities are defined as ``` private static final Map<TimeUnitRange, Period> PERIOD_MAP = ImmutableMap.<TimeUnitRange, Period>builder() .put(TimeUnitRange.SECOND, Period.seconds(1)) .put(TimeUnitRange.MINUTE, Period.minutes(1)) .put(TimeUnitRange.HOUR, Period.hours(1)) .put(TimeUnitRange.DAY, Period.days(1)) .put(TimeUnitRange.WEEK, Period.weeks(1)) .put(TimeUnitRange.MONTH, Period.months(1)) .put(TimeUnitRange.QUARTER, Period.months(3)) .put(TimeUnitRange.YEAR, Period.years(1)) .build(); ``` i.e. there's a mismatch as to what Calcite's SQL can accept as TimeUnit, and what we can convert using TimeUnits class. For the ingestion's `PARTITION BY` what range of time units from the above should be accepted by the SQL? -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
