Return-Path: X-Original-To: apmail-drill-dev-archive@www.apache.org Delivered-To: apmail-drill-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C80B318D01 for ; Thu, 3 Mar 2016 18:25:00 +0000 (UTC) Received: (qmail 7268 invoked by uid 500); 3 Mar 2016 18:25:00 -0000 Delivered-To: apmail-drill-dev-archive@drill.apache.org Received: (qmail 7213 invoked by uid 500); 3 Mar 2016 18:25:00 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 7193 invoked by uid 99); 3 Mar 2016 18:25:00 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Mar 2016 18:25:00 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 30097E78E9; Thu, 3 Mar 2016 18:25:00 +0000 (UTC) From: sudheeshkatkam To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request: Drill 4372 review Content-Type: text/plain Message-Id: <20160303182500.30097E78E9@git1-us-west.apache.org> Date: Thu, 3 Mar 2016 18:25:00 +0000 (UTC) Github user sudheeshkatkam commented on a diff in the pull request: https://github.com/apache/drill/pull/397#discussion_r54923238 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/TypeInferenceUtils.java --- @@ -0,0 +1,568 @@ +/** + * 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.drill.exec.planner.sql; + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; + +import com.google.common.collect.Maps; +import org.apache.calcite.avatica.util.TimeUnit; +import org.apache.calcite.rel.type.RelDataType; +import org.apache.calcite.rel.type.RelDataTypeFactory; +import org.apache.calcite.sql.SqlCallBinding; +import org.apache.calcite.sql.SqlCharStringLiteral; +import org.apache.calcite.sql.SqlDynamicParam; +import org.apache.calcite.sql.SqlLiteral; +import org.apache.calcite.sql.SqlNode; +import org.apache.calcite.sql.SqlOperatorBinding; +import org.apache.calcite.sql.type.SqlReturnTypeInference; +import org.apache.calcite.sql.type.SqlTypeName; + +import org.apache.drill.common.expression.ExpressionPosition; +import org.apache.drill.common.expression.FunctionCall; +import org.apache.drill.common.expression.LogicalExpression; +import org.apache.drill.common.expression.MajorTypeInLogicalExpression; +import org.apache.drill.common.exceptions.UserException; +import org.apache.drill.common.types.TypeProtos; +import org.apache.drill.common.types.Types; +import org.apache.drill.exec.expr.TypeHelper; +import org.apache.drill.exec.expr.fn.DrillFuncHolder; +import org.apache.drill.exec.planner.logical.DrillConstExecutor; +import org.apache.drill.exec.resolver.FunctionResolver; +import org.apache.drill.exec.resolver.FunctionResolverFactory; +import org.apache.drill.exec.resolver.TypeCastRules; + +import java.util.List; +import java.util.Map; + +public class TypeInferenceUtils { + private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TypeInferenceUtils.class); + + public static final TypeProtos.MajorType UNKNOWN_TYPE = TypeProtos.MajorType.getDefaultInstance(); + private static ImmutableMap DRILL_TO_CALCITE_TYPE_MAPPING = + ImmutableMap. builder() + .put(TypeProtos.MinorType.INT, SqlTypeName.INTEGER) + .put(TypeProtos.MinorType.BIGINT, SqlTypeName.BIGINT) + .put(TypeProtos.MinorType.FLOAT4, SqlTypeName.FLOAT) + .put(TypeProtos.MinorType.FLOAT8, SqlTypeName.DOUBLE) + .put(TypeProtos.MinorType.VARCHAR, SqlTypeName.VARCHAR) + .put(TypeProtos.MinorType.BIT, SqlTypeName.BOOLEAN) + .put(TypeProtos.MinorType.DATE, SqlTypeName.DATE) + .put(TypeProtos.MinorType.DECIMAL9, SqlTypeName.DECIMAL) + .put(TypeProtos.MinorType.DECIMAL18, SqlTypeName.DECIMAL) + .put(TypeProtos.MinorType.DECIMAL28SPARSE, SqlTypeName.DECIMAL) + .put(TypeProtos.MinorType.DECIMAL38SPARSE, SqlTypeName.DECIMAL) + .put(TypeProtos.MinorType.TIME, SqlTypeName.TIME) + .put(TypeProtos.MinorType.TIMESTAMP, SqlTypeName.TIMESTAMP) + .put(TypeProtos.MinorType.VARBINARY, SqlTypeName.VARBINARY) + .put(TypeProtos.MinorType.INTERVALYEAR, SqlTypeName.INTERVAL_YEAR_MONTH) + .put(TypeProtos.MinorType.INTERVALDAY, SqlTypeName.INTERVAL_DAY_TIME) + .put(TypeProtos.MinorType.MAP, SqlTypeName.MAP) + .put(TypeProtos.MinorType.LIST, SqlTypeName.ARRAY) + .put(TypeProtos.MinorType.LATE, SqlTypeName.ANY) + .build(); + + private static ImmutableMap CALCITE_TO_DRILL_MAPPING = --- End diff -- final --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---