Yin Huai created SPARK-5603:
-------------------------------

             Summary: Preinsert casting and renaming rule is needed in the 
Analyzer
                 Key: SPARK-5603
                 URL: https://issues.apache.org/jira/browse/SPARK-5603
             Project: Spark
          Issue Type: Sub-task
          Components: SQL
            Reporter: Yin Huai
            Priority: Blocker


For an INSERT INTO/OVERWRITE statement, we should add necessary Cast and Alias 
to the output of the query.

{code}
CREATE TEMPORARY TABLE jsonTable (a int, b string)
USING org.apache.spark.sql.json.DefaultSource
OPTIONS (
  path '...'
)
INSERT OVERWRITE TABLE jsonTable SELECT a * 2, a * 4 FROM table
{code}
For a*2, we should create an Alias, so the InsertableRelation can know it is 
the column a. For a*4, it is actually the column b in jsonTable. We should 
first cast it to StringType and add an Alias b to it.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to