Grokbase Groups Hive commits May 2016
FAQ
Repository: hive
Updated Branches:
   refs/heads/master 1d7665683 -> fec0c1fab


HIVE-13705: Insert into table removes existing data (Reviewed by Ashutosh Chauhan)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/fec0c1fa
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/fec0c1fa
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/fec0c1fa

Branch: refs/heads/master
Commit: fec0c1fab31f79f1d3c775649f1898b010abfb57
Parents: 1d76656
Author: Aihua Xu <aihuaxu@apache.org>
Authored: Tue May 10 14:33:05 2016 -0400
Committer: Aihua Xu <aihuaxu@apache.org>
Committed: Fri May 13 15:29:35 2016 -0400

----------------------------------------------------------------------
  .../hadoop/hive/ql/io/ProxyLocalFileSystem.java | 36 ++++++++++++++
  .../services/org.apache.hadoop.fs.FileSystem | 2 +
  ql/src/test/queries/clientpositive/insert2.q | 13 +++++
  .../test/results/clientpositive/insert2.q.out | 52 ++++++++++++++++++++
  4 files changed, 103 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/fec0c1fa/ql/src/java/org/apache/hadoop/hive/ql/io/ProxyLocalFileSystem.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/ProxyLocalFileSystem.java b/ql/src/java/org/apache/hadoop/hive/ql/io/ProxyLocalFileSystem.java
new file mode 100644
index 0000000..034ecca
--- /dev/null
+++ b/ql/src/java/org/apache/hadoop/hive/ql/io/ProxyLocalFileSystem.java
@@ -0,0 +1,36 @@
+/**
+ * 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.hadoop.hive.ql.io;
+
+import java.io.IOException;
+
+import org.apache.hadoop.fs.LocalFileSystem;
+import org.apache.hadoop.fs.Path;
+
+/**
+ * This class is to workaround existing issues on LocalFileSystem.
+ */
+public class ProxyLocalFileSystem extends LocalFileSystem {
+
+ @Override
+ public boolean rename(Path src, Path dst) throws IOException {
+ // Make sure for existing destination we return false as per FileSystem api contract
+ return super.isFile(dst) ? false : super.rename(src, dst);
+ }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/fec0c1fa/ql/src/main/resources/META-INF/services/org.apache.hadoop.fs.FileSystem
----------------------------------------------------------------------
diff --git a/ql/src/main/resources/META-INF/services/org.apache.hadoop.fs.FileSystem b/ql/src/main/resources/META-INF/services/org.apache.hadoop.fs.FileSystem
index 257ceeb..09353f3 100644
--- a/ql/src/main/resources/META-INF/services/org.apache.hadoop.fs.FileSystem
+++ b/ql/src/main/resources/META-INF/services/org.apache.hadoop.fs.FileSystem
@@ -12,3 +12,5 @@
  # limitations under the License.
  #
  org.apache.hadoop.hive.ql.io.NullScanFileSystem
+org.apache.hadoop.fs.LocalFileSystem
+org.apache.hadoop.hive.ql.io.ProxyLocalFileSystem

http://git-wip-us.apache.org/repos/asf/hive/blob/fec0c1fa/ql/src/test/queries/clientpositive/insert2.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/insert2.q b/ql/src/test/queries/clientpositive/insert2.q
new file mode 100644
index 0000000..669e4c3
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/insert2.q
@@ -0,0 +1,13 @@
+set hive.explain.user=false;
+set fs.defaultFS=file:///;
+
+-- SORT_QUERY_RESULTS
+
+USE default;
+CREATE DATABASE db1;
+CREATE TABLE db1.result(col1 STRING);
+INSERT INTO TABLE db1.result SELECT 'db1_insert1' FROM src LIMIT 1;
+INSERT INTO TABLE db1.result SELECT 'db1_insert1' FROM src LIMIT 1;
+SELECT * FROM db1.result;
+
+reset fs.defaultFS;

http://git-wip-us.apache.org/repos/asf/hive/blob/fec0c1fa/ql/src/test/results/clientpositive/insert2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/insert2.q.out b/ql/src/test/results/clientpositive/insert2.q.out
new file mode 100644
index 0000000..3805f3a
--- /dev/null
+++ b/ql/src/test/results/clientpositive/insert2.q.out
@@ -0,0 +1,52 @@
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+USE default
+PREHOOK: type: SWITCHDATABASE
+PREHOOK: Input: database:default
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+USE default
+POSTHOOK: type: SWITCHDATABASE
+POSTHOOK: Input: database:default
+PREHOOK: query: CREATE DATABASE db1
+PREHOOK: type: CREATEDATABASE
+PREHOOK: Output: database:db1
+POSTHOOK: query: CREATE DATABASE db1
+POSTHOOK: type: CREATEDATABASE
+POSTHOOK: Output: database:db1
+PREHOOK: query: CREATE TABLE db1.result(col1 STRING)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:db1
+PREHOOK: Output: db1@result
+POSTHOOK: query: CREATE TABLE db1.result(col1 STRING)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:db1
+POSTHOOK: Output: db1@result
+PREHOOK: query: INSERT INTO TABLE db1.result SELECT 'db1_insert1' FROM src LIMIT 1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+PREHOOK: Output: db1@result
+POSTHOOK: query: INSERT INTO TABLE db1.result SELECT 'db1_insert1' FROM src LIMIT 1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+POSTHOOK: Output: db1@result
+POSTHOOK: Lineage: result.col1 SIMPLE []
+PREHOOK: query: INSERT INTO TABLE db1.result SELECT 'db1_insert1' FROM src LIMIT 1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+PREHOOK: Output: db1@result
+POSTHOOK: query: INSERT INTO TABLE db1.result SELECT 'db1_insert1' FROM src LIMIT 1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+POSTHOOK: Output: db1@result
+POSTHOOK: Lineage: result.col1 SIMPLE []
+PREHOOK: query: SELECT * FROM db1.result
+PREHOOK: type: QUERY
+PREHOOK: Input: db1@result
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT * FROM db1.result
+POSTHOOK: type: QUERY
+POSTHOOK: Input: db1@result
+#### A masked pattern was here ####
+db1_insert1
+db1_insert1

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupcommits @
categorieshive, hadoop
postedMay 13, '16 at 7:30p
activeMay 13, '16 at 7:30p
posts1
users1
websitehive.apache.org

1 user in discussion

Aihuaxu: 1 post

People

Translate

site design / logo © 2021 Grokbase