You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Yin Huai (JIRA)" <ji...@apache.org> on 2015/02/05 00:02:35 UTC

[jira] [Created] (SPARK-5603) Preinsert casting and renaming rule is needed in the Analyzer

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: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org