hadoop-hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject svn commit: r795279 - in /hadoop/hive/trunk: CHANGES.txt ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g ql/src/test/queries/clientpositive/quote2.q ql/src/test/results/clientpositive/quote2.q.out
Date Sat, 18 Jul 2009 00:01:10 GMT
Author: namit
Date: Sat Jul 18 00:01:09 2009
New Revision: 795279

URL: http://svn.apache.org/viewvc?rev=795279&view=rev
Log:
HIVE-643. recognize escaped strings
(Emil Ibrishimov via namit)


Added:
    hadoop/hive/trunk/ql/src/test/queries/clientpositive/quote2.q
    hadoop/hive/trunk/ql/src/test/results/clientpositive/quote2.q.out
Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=795279&r1=795278&r2=795279&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Sat Jul 18 00:01:09 2009
@@ -379,6 +379,9 @@
     HIVE-635. fix union accepting multiple objectinspectors
     (Zheng Shao via namit)
 
+    HIVE-643. recognize escaped strings
+    (Emil Ibrishimov via namit)
+
 Release 0.3.1 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g?rev=795279&r1=795278&r2=795279&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g Sat Jul 18 00:01:09
2009
@@ -1297,7 +1297,9 @@
 
 StringLiteral
     :
-    ( '\'' (~'\'')* '\'' | '\"' (~'\"')* '\"' )+
+    ( '\'' ( ~('\''|'\\') | ('\\' .) )* '\'' 
+    | '\"' ( ~('\"'|'\\') | ('\\' .) )* '\"' 
+    )+
     ;
 
 CharSetLiteral

Added: hadoop/hive/trunk/ql/src/test/queries/clientpositive/quote2.q
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/queries/clientpositive/quote2.q?rev=795279&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/queries/clientpositive/quote2.q (added)
+++ hadoop/hive/trunk/ql/src/test/queries/clientpositive/quote2.q Sat Jul 18 00:01:09 2009
@@ -0,0 +1,28 @@
+EXPLAIN
+SELECT
+    'abc',        "abc",
+    'abc\'',      "abc\"",
+    'abc\\',      "abc\\",
+    'abc\\\'',    "abc\\\"",
+    'abc\\\\',    "abc\\\\",
+    'abc\\\\\'',  "abc\\\\\"",
+    'abc\\\\\\',  "abc\\\\\\",
+    'abc""""\\',  "abc''''\\",
+    "awk '{print NR\"\\t\"$0}'",
+    'tab\ttab',   "tab\ttab"
+FROM src
+LIMIT 1;
+
+SELECT
+    'abc',        "abc",
+    'abc\'',      "abc\"",
+    'abc\\',      "abc\\",
+    'abc\\\'',    "abc\\\"",
+    'abc\\\\',    "abc\\\\",
+    'abc\\\\\'',  "abc\\\\\"",
+    'abc\\\\\\',  "abc\\\\\\",
+    'abc""""\\',  "abc''''\\",
+    "awk '{print NR\"\\t\"$0}'",
+    'tab\ttab',   "tab\ttab"
+FROM src
+LIMIT 1;

Added: hadoop/hive/trunk/ql/src/test/results/clientpositive/quote2.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientpositive/quote2.q.out?rev=795279&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientpositive/quote2.q.out (added)
+++ hadoop/hive/trunk/ql/src/test/results/clientpositive/quote2.q.out Sat Jul 18 00:01:09
2009
@@ -0,0 +1,95 @@
+query: EXPLAIN
+SELECT
+    'abc',        "abc",
+    'abc\'',      "abc\"",
+    'abc\\',      "abc\\",
+    'abc\\\'',    "abc\\\"",
+    'abc\\\\',    "abc\\\\",
+    'abc\\\\\'',  "abc\\\\\"",
+    'abc\\\\\\',  "abc\\\\\\",
+    'abc""""\\',  "abc''''\\",
+    "awk '{print NR\"\\t\"$0}'",
+    'tab\ttab',   "tab\ttab"
+FROM src
+LIMIT 1
+ABSTRACT SYNTAX TREE:
+  (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE))
(TOK_SELECT (TOK_SELEXPR 'abc') (TOK_SELEXPR "abc") (TOK_SELEXPR 'abc\'') (TOK_SELEXPR "abc\"")
(TOK_SELEXPR 'abc\\') (TOK_SELEXPR "abc\\") (TOK_SELEXPR 'abc\\\'') (TOK_SELEXPR "abc\\\"")
(TOK_SELEXPR 'abc\\\\') (TOK_SELEXPR "abc\\\\") (TOK_SELEXPR 'abc\\\\\'') (TOK_SELEXPR "abc\\\\\"")
(TOK_SELEXPR 'abc\\\\\\') (TOK_SELEXPR "abc\\\\\\") (TOK_SELEXPR 'abc""""\\') (TOK_SELEXPR
"abc''''\\") (TOK_SELEXPR "awk '{print NR\"\\t\"$0}'") (TOK_SELEXPR 'tab\ttab') (TOK_SELEXPR
"tab\ttab")) (TOK_LIMIT 1)))
+
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 is a root stage
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Alias -> Map Operator Tree:
+        src 
+            Select Operator
+              expressions:
+                    expr: 'abc'
+                    type: string
+                    expr: 'abc'
+                    type: string
+                    expr: 'abc''
+                    type: string
+                    expr: 'abc"'
+                    type: string
+                    expr: 'abc\'
+                    type: string
+                    expr: 'abc\'
+                    type: string
+                    expr: 'abc\''
+                    type: string
+                    expr: 'abc\"'
+                    type: string
+                    expr: 'abc\\'
+                    type: string
+                    expr: 'abc\\'
+                    type: string
+                    expr: 'abc\\''
+                    type: string
+                    expr: 'abc\\"'
+                    type: string
+                    expr: 'abc\\\'
+                    type: string
+                    expr: 'abc\\\'
+                    type: string
+                    expr: 'abc""""\'
+                    type: string
+                    expr: 'abc''''\'
+                    type: string
+                    expr: 'awk '{print NR"\t"$0}''
+                    type: string
+                    expr: 'tab	tab'
+                    type: string
+                    expr: 'tab	tab'
+                    type: string
+              Limit
+                File Output Operator
+                  compressed: false
+                  GlobalTableId: 0
+                  table:
+                      input format: org.apache.hadoop.mapred.TextInputFormat
+                      output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 1
+
+
+query: SELECT
+    'abc',        "abc",
+    'abc\'',      "abc\"",
+    'abc\\',      "abc\\",
+    'abc\\\'',    "abc\\\"",
+    'abc\\\\',    "abc\\\\",
+    'abc\\\\\'',  "abc\\\\\"",
+    'abc\\\\\\',  "abc\\\\\\",
+    'abc""""\\',  "abc''''\\",
+    "awk '{print NR\"\\t\"$0}'",
+    'tab\ttab',   "tab\ttab"
+FROM src
+LIMIT 1
+Input: default/src
+Output: file:/data/users/emil/hive1/hive1/build/ql/tmp/171746919/10000
+abc	abc	abc'	abc"	abc\	abc\	abc\'	abc\"	abc\\	abc\\	abc\\'	abc\\"	abc\\\	abc\\\	abc""""\
abc''''\	awk '{print NR"\t"$0}'	tab	tab	tab	tab



Mime
View raw message