Here you can find the source of sqlTypeToHiveType(Integer type)
public static String sqlTypeToHiveType(Integer type)
//package com.java2s; /*-/*w w w . j a v a 2 s . c o m*/ * #%L * thinkbig-schema-discovery-api * %% * Copyright (C) 2017 ThinkBig Analytics * %% * Licensed 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. * #L% */ import java.sql.JDBCType; import java.sql.Types; public class Main { public static String sqlTypeToHiveType(Integer type) { switch (type) { case Types.BIGINT: return "bigint"; case Types.NUMERIC: case Types.DOUBLE: case Types.DECIMAL: return "double"; case Types.INTEGER: return "int"; case Types.FLOAT: return "float"; case Types.TINYINT: return "tinyint"; case Types.DATE: return "date"; case Types.TIMESTAMP: return "timestamp"; case Types.BOOLEAN: return "boolean"; case Types.BINARY: return "binary"; default: return "string"; } } public static String sqlTypeToHiveType(JDBCType jdbcType) { if (jdbcType != null) { Integer type = jdbcType.getVendorTypeNumber(); return sqlTypeToHiveType(type); } return null; } }