<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Regarding data import into hive from csv in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Regarding-data-import-into-hive-from-csv/m-p/370235#M240656</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/104966"&gt;@jijy&lt;/a&gt;,&amp;nbsp;Welcome to our community! To help you get the best possible answer, I have tagged our Hive experts&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/82698"&gt;@smruti&lt;/a&gt;,&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/71090"&gt;@asish&lt;/a&gt;,&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/33734"&gt;@Asok&lt;/a&gt;,&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/31523"&gt;@tjangid&lt;/a&gt;&amp;nbsp; who may be able to assist you further.&lt;BR /&gt;&lt;BR /&gt;Please feel free to provide any additional information or details about your query, and we hope that you will find a satisfactory solution to your question.&lt;/P&gt;</description>
    <pubDate>Mon, 08 May 2023 09:23:33 GMT</pubDate>
    <dc:creator>VidyaSargur</dc:creator>
    <dc:date>2023-05-08T09:23:33Z</dc:date>
    <item>
      <title>Regarding data import into hive from csv</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Regarding-data-import-into-hive-from-csv/m-p/370218#M240647</link>
      <description>&lt;P&gt;I have issue in importing the data from dataframe converted to csv then uploading it into hive but its not loading properly .&lt;/P&gt;&lt;P&gt;My procedure:&lt;/P&gt;&lt;P&gt;1st I took a Data frame from database and converted into a csv ,which has 343 columns and 24 lakhs rows&amp;nbsp;&lt;/P&gt;&lt;P&gt;2nd I took the csv file to hive and I loaded the data to hive using load data code to table which i created directly by connect the hive to same database .&lt;/P&gt;&lt;P&gt;this is what ,I am doing.&lt;/P&gt;&lt;P&gt;In this case , my issue is for some rows it taking proper values but for some is null&amp;nbsp; or 0.&lt;/P&gt;&lt;P&gt;then i took a sample of 5 rows and I checked manually then i find out in csv file some rows there are some extra comma .so I manually removed and tried ,it worked but this cant be happening in real-time .&lt;/P&gt;&lt;P&gt;so pls help me on this by giving some suggestion.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2026 07:14:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Regarding-data-import-into-hive-from-csv/m-p/370218#M240647</guid>
      <dc:creator>jijy</dc:creator>
      <dc:date>2026-04-21T07:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding data import into hive from csv</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Regarding-data-import-into-hive-from-csv/m-p/370235#M240656</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/104966"&gt;@jijy&lt;/a&gt;,&amp;nbsp;Welcome to our community! To help you get the best possible answer, I have tagged our Hive experts&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/82698"&gt;@smruti&lt;/a&gt;,&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/71090"&gt;@asish&lt;/a&gt;,&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/33734"&gt;@Asok&lt;/a&gt;,&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/31523"&gt;@tjangid&lt;/a&gt;&amp;nbsp; who may be able to assist you further.&lt;BR /&gt;&lt;BR /&gt;Please feel free to provide any additional information or details about your query, and we hope that you will find a satisfactory solution to your question.&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2023 09:23:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Regarding-data-import-into-hive-from-csv/m-p/370235#M240656</guid>
      <dc:creator>VidyaSargur</dc:creator>
      <dc:date>2023-05-08T09:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding data import into hive from csv</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Regarding-data-import-into-hive-from-csv/m-p/370236#M240657</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/104966"&gt;@jijy&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;could you please share your create table statement and some sample data?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2023 09:27:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Regarding-data-import-into-hive-from-csv/m-p/370236#M240657</guid>
      <dc:creator>tj2007</dc:creator>
      <dc:date>2023-05-08T09:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding data import into hive from csv</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Regarding-data-import-into-hive-from-csv/m-p/372227#M241186</link>
      <description>&lt;P&gt;Once the data has been read from database, you don't need to write the same data to&amp;nbsp; file (i.e. CSV ) .&amp;nbsp; Instead you can write directly into hive table using DataFrame API's.&amp;nbsp; Once the Data has been loaded you query the same from hive.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;df.write.mode(SaveMode.Overwrite).saveAsTable("hive_records")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Ref -&amp;nbsp;&lt;A href="https://spark.apache.org/docs/2.4.7/sql-data-sources-hive-tables.html" target="_blank" rel="noopener"&gt;https://spark.apache.org/docs/2.4.7/sql-data-sources-hive-tables.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Sample Code Snippet&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;df = spark.read \
    .format("jdbc") \
    .option("url", "jdbc:postgresql://&amp;lt;server name&amp;gt;:5432/&amp;lt;DBNAME&amp;gt;") \
    .option("dbtable", "\"&amp;lt;SourceTableName&amp;gt;\"") \
    .option("user", "&amp;lt;Username&amp;gt;") \
    .option("password", "&amp;lt;Password&amp;gt;") \
    .option("driver", "org.postgresql.Driver") \
    .load()

df.write.mode('overwrite').saveAsTable("&amp;lt;TargetTableName&amp;gt;")


From hive 

INFO  : Compiling command(queryId=hive_20230607042851_fa703b79-d6e0-4a4c-936c-efa21ec00a10): select count(*) from TBLS_POSTGRES
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Created Hive schema: Schema(fieldSchemas:[FieldSchema(name:_c0, type:bigint, comment:null)], properties:null)
INFO  : Completed compiling command(queryId=hive_20230607042851_fa703b79-d6e0-4a4c-936c-efa21ec00a10); Time taken: 0.591 seconds
INFO  : Executing command(queryId=hive_20230607042851_fa703b79-d6e0-4a4c-936c-efa21ec00a10): select count(*) from TBLS_POSTGRES
.
.
.
+------+
| _c0  |
+------+
| 122  |
+------+&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 04:38:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Regarding-data-import-into-hive-from-csv/m-p/372227#M241186</guid>
      <dc:creator>ggangadharan</dc:creator>
      <dc:date>2023-06-07T04:38:08Z</dc:date>
    </item>
  </channel>
</rss>

