Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 5A873200CE7 for ; Sat, 16 Sep 2017 19:38:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 58F231609CC; Sat, 16 Sep 2017 17:38:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9CCF31609D5 for ; Sat, 16 Sep 2017 19:38:04 +0200 (CEST) Received: (qmail 1789 invoked by uid 500); 16 Sep 2017 17:38:03 -0000 Mailing-List: contact issues-help@carbondata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@carbondata.apache.org Delivered-To: mailing list issues@carbondata.apache.org Received: (qmail 1780 invoked by uid 99); 16 Sep 2017 17:38:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Sep 2017 17:38:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 5992E184279 for ; Sat, 16 Sep 2017 17:38:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id F9jdehcd42dM for ; Sat, 16 Sep 2017 17:38:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id D44A35FBBB for ; Sat, 16 Sep 2017 17:38:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 1D400E0F0D for ; Sat, 16 Sep 2017 17:38:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 5DDEA2538B for ; Sat, 16 Sep 2017 17:38:00 +0000 (UTC) Date: Sat, 16 Sep 2017 17:38:00 +0000 (UTC) From: "anubhav tarar (JIRA)" To: issues@carbondata.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Issue Comment Deleted] (CARBONDATA-1477) wrong values shown when fetching date type values in hive MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sat, 16 Sep 2017 17:38:05 -0000 [ https://issues.apache.org/jira/browse/CARBONDATA-1477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] anubhav tarar updated CARBONDATA-1477: -------------------------------------- Comment: was deleted (was: [~liliangc]i attached the csv to the jira issue above) > wrong values shown when fetching date type values in hive > --------------------------------------------------------- > > Key: CARBONDATA-1477 > URL: https://issues.apache.org/jira/browse/CARBONDATA-1477 > Project: CarbonData > Issue Type: Bug > Components: hive-integration > Affects Versions: 1.2.0 > Environment: hive1.2.1,spark2.1 > Reporter: anubhav tarar > Assignee: anubhav tarar > Priority: Trivial > Attachments: data.csv > > Time Spent: 2h 50m > Remaining Estimate: 0h > > {code} > package org.apache.carbondata.hiveexample > import java.io.File > import java.sql.{DriverManager, ResultSet, Statement} > import org.apache.spark.sql.SparkSession > import org.apache.carbondata.common.logging.LogServiceFactory > import org.apache.carbondata.hive.server.HiveEmbeddedServer2 > // scalastyle:off println > object HiveExample { > private val driverName: String = "org.apache.hive.jdbc.HiveDriver" > def main(args: Array[String]) { > val rootPath = new File(this.getClass.getResource("/").getPath > + "../../../..").getCanonicalPath > val store = s"$rootPath/integration/hive/target/store" > val warehouse = s"$rootPath/integration/hive/target/warehouse" > val metaStore_Db = s"$rootPath/integration/hive/target/carbon_metaStore_db" > val logger = LogServiceFactory.getLogService(this.getClass.getCanonicalName) > var resultId = "" > var resultName = "" > var resultSalary = "" > import org.apache.spark.sql.CarbonSession._ > val carbonSession = SparkSession > .builder() > .master("local") > .appName("HiveExample") > .config("carbonSession.sql.warehouse.dir", warehouse).enableHiveSupport() > .getOrCreateCarbonSession( > store, metaStore_Db) > carbonSession.sql("DROP TABLE IF EXISTS HIVE_CARBON_EXAMPLE ") > carbonSession > .sql( > """CREATE TABLE IF NOT EXISTS HIVE_CARBON_EXAMPLE (ID int,NAME string,SALARY double,JOININGDATE date) STORED BY > |'CARBONDATA' """ > .stripMargin) > carbonSession.sql( > s""" > LOAD DATA LOCAL INPATH '$rootPath/integration/hive/src/main/resources/data.csv' INTO > TABLE > HIVE_CARBON_EXAMPLE > """) > carbonSession.sql("SELECT * FROM HIVE_CARBON_EXAMPLE").show() > carbonSession.stop() > try { > Class.forName(driverName) > } > catch { > case classNotFoundException: ClassNotFoundException => > classNotFoundException.printStackTrace() > } > val hiveEmbeddedServer2 = new HiveEmbeddedServer2() > hiveEmbeddedServer2.start() > val port = hiveEmbeddedServer2.getFreePort > val connection = DriverManager.getConnection(s"jdbc:hive2://localhost:$port/default", "", "") > val statement: Statement = connection.createStatement > logger.info(s"============HIVE CLI IS STARTED ON PORT $port ==============") > statement.execute("CREATE TABLE IF NOT EXISTS " + "HIVE_CARBON_EXAMPLE " + > " (ID int, NAME string,SALARY double,JOININGDATE date)") > statement > .execute( > "ALTER TABLE HIVE_CARBON_EXAMPLE SET FILEFORMAT INPUTFORMAT \"org.apache.carbondata." + > "hive.MapredCarbonInputFormat\"OUTPUTFORMAT \"org.apache.carbondata.hive." + > "MapredCarbonOutputFormat\"SERDE \"org.apache.carbondata.hive." + > "CarbonHiveSerDe\" ") > statement > .execute( > "ALTER TABLE HIVE_CARBON_EXAMPLE SET LOCATION " + > s"'file:///$store/default/hive_carbon_example' ") > val sql = "SELECT * FROM HIVE_CARBON_EXAMPLE" > val resultSet: ResultSet = statement.executeQuery(sql) > var rowsFetched = 0 > while (resultSet.next) { > println("*********"+resultSet.getString("JOININGDATE")) > } > println(s"******Total Number Of Rows Fetched ****** $rowsFetched") > logger.info("Fetching the Individual Columns ") > hiveEmbeddedServer2.stop() > System.exit(0) > } > } -- This message was sent by Atlassian JIRA (v6.4.14#64029)