hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lei liu <liulei...@gmail.com>
Subject After colse the JDBC connection, the hive don't delete hive exec scratch dir
Date Tue, 25 Jan 2011 02:24:10 GMT
I use hive 0.6 version, I use JDBC to execute one search sql, for example
below code:
public static void query() {
        Connection hiveConnection = null;
        Statement statement = null;

        try {

            Class.forName("org.apache.hadoop.hive.jdbc.HiveDriver");
            hiveConnection = DriverManager.getConnection("jdbc:hive://" ,
"", "");
            statement = hiveConnection.createStatement();
            String sql = "select  a.id, b.name, a.age from  test1 a   join
test2  b on(a.id=b.id)";
            ResultSet result = statement.executeQuery(sql);
            while(result.next()) {
                System.out.println(result.getString(1) + "  "
+result.getString(2) + "  " +result.getString(3));
            }
            statement.close();

        }  catch(Exception e) {
            e.printStackTrace();
        } finally {
            try {
                hiveConnection.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }

When the sql is executing, hive create one
/tmp/hive-root/scratch/hive_2011-01-25_10-13-31_275_912012219404735792
directory in HDFS, after I colse the JDBC connection,  the hive don't delete
the directory.


Thanks,


LiuLei

Mime
View raw message