[jira] [Updated] (SPARK-23193) Insert into Spark Table statement cannot specify column names
[ https://issues.apache.org/jira/browse/SPARK-23193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sean Owen updated SPARK-23193: -- Priority: Minor (was: Major) Issue Type: Improvement (was: Bug) I don't see that syntax is supported by Spark, Hive or Impala. I think it could be a feature request, I guess. > Insert into Spark Table statement cannot specify column names > - > > Key: SPARK-23193 > URL: https://issues.apache.org/jira/browse/SPARK-23193 > Project: Spark > Issue Type: Improvement > Components: SQL >Affects Versions: 2.2.1 >Reporter: Paul Wu >Priority: Minor > > The following code shows the insert statement cannot specify the column > names. The error is > {{insert into aaa (age, name) values (12, 'nn')}} > {{-^^^}} > {{ at > org.apache.spark.sql.catalyst.parser.ParseException.withCommand(ParseDriver.scala:217)}} > {{ at > org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parse(ParseDriver.scala:114)}} > {{ at > org.apache.spark.sql.execution.SparkSqlParser.parse(SparkSqlParser.scala:48)}} > {{ at > org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parsePlan(ParseDriver.scala:68)}} > {{ at org.apache.spark.sql.SparkSession.sql(SparkSession.scala:632)}} > {{ at com.---.iqi.spk.TestInsert.main(TestInsert.java:75)}} > > {{public class TestInsert {}} > {{ public static final SparkSession spark}} > {{ = SparkSession.builder()}} > {{ .config("spark.sql.warehouse.dir", "file:///temp")}} > {{ .config("spark.driver.memory", "5g")}} > {{ .enableHiveSupport()}} > {{ > .master("local[*]").appName("Spark2JdbcDs").getOrCreate();}} > {{ }} > {{ public static class Person implements Serializable {}} > {{ private String name;}} > {{ private int age;}} > {{ public String getName() {}} > {{ return name;}} > {{ }}} > {{ public void setName(String name) {}} > {{ this.name = name;}} > {{ }}} > {{ public int getAge() {}} > {{ return age;}} > {{ }}} > {{ public void setAge(int age) {}} > {{ this.age = age;}} > {{ }}} > {{ }}} > {{ public static void main(String[] args) throws Exception {}} > {{ // Create an instance of a Bean class}} > {{ Person person = new Person();}} > {{ person.setName("Andy");}} > {{ person.setAge(32);}} > {{// Encoders are created for Java beans}} > {{ Encoder personEncoder = Encoders.bean(Person.class);}} > {{ Dataset javaBeanDS = spark.createDataset(}} > {{ Collections.singletonList(person),}} > {{ personEncoder}} > {{ );}} > {{ javaBeanDS.show();}} > {{ javaBeanDS.createTempView("Abc");}} > {{ spark.sql("drop table aaa");}} > {{ spark.sql("create table aaa as select * from abc");}} > {{ spark.sql("insert into aaa values (12, 'nn')");}} > {{ spark.sql("select * from aaa").show();}} > {{ spark.sql("insert into aaa (age, name) values (12, 'nn')");}} > {{ spark.sql("select * from aaa").show();}} > {{ }} > {{ spark.close();}} > {{ }} > {{ }}} > {{}}} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Updated] (SPARK-23193) Insert into Spark Table statement cannot specify column names
[ https://issues.apache.org/jira/browse/SPARK-23193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Paul Wu updated SPARK-23193: Summary: Insert into Spark Table statement cannot specify column names (was: Insert into Spark Table cannot specify column names) > Insert into Spark Table statement cannot specify column names > - > > Key: SPARK-23193 > URL: https://issues.apache.org/jira/browse/SPARK-23193 > Project: Spark > Issue Type: Bug > Components: SQL >Affects Versions: 2.2.1 >Reporter: Paul Wu >Priority: Major > > The following code shows the insert statement cannot specify the column > names. The error is > {{insert into aaa (age, name) values (12, 'nn')}} > {{-^^^}} > {{ at > org.apache.spark.sql.catalyst.parser.ParseException.withCommand(ParseDriver.scala:217)}} > {{ at > org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parse(ParseDriver.scala:114)}} > {{ at > org.apache.spark.sql.execution.SparkSqlParser.parse(SparkSqlParser.scala:48)}} > {{ at > org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parsePlan(ParseDriver.scala:68)}} > {{ at org.apache.spark.sql.SparkSession.sql(SparkSession.scala:632)}} > {{ at com.---.iqi.spk.TestInsert.main(TestInsert.java:75)}} > > {{public class TestInsert {}} > {{ public static final SparkSession spark}} > {{ = SparkSession.builder()}} > {{ .config("spark.sql.warehouse.dir", "file:///temp")}} > {{ .config("spark.driver.memory", "5g")}} > {{ .enableHiveSupport()}} > {{ > .master("local[*]").appName("Spark2JdbcDs").getOrCreate();}} > {{ }} > {{ public static class Person implements Serializable {}} > {{ private String name;}} > {{ private int age;}} > {{ public String getName() {}} > {{ return name;}} > {{ }}} > {{ public void setName(String name) {}} > {{ this.name = name;}} > {{ }}} > {{ public int getAge() {}} > {{ return age;}} > {{ }}} > {{ public void setAge(int age) {}} > {{ this.age = age;}} > {{ }}} > {{ }}} > {{ public static void main(String[] args) throws Exception {}} > {{ // Create an instance of a Bean class}} > {{ Person person = new Person();}} > {{ person.setName("Andy");}} > {{ person.setAge(32);}} > {{// Encoders are created for Java beans}} > {{ Encoder personEncoder = Encoders.bean(Person.class);}} > {{ Dataset javaBeanDS = spark.createDataset(}} > {{ Collections.singletonList(person),}} > {{ personEncoder}} > {{ );}} > {{ javaBeanDS.show();}} > {{ javaBeanDS.createTempView("Abc");}} > {{ spark.sql("drop table aaa");}} > {{ spark.sql("create table aaa as select * from abc");}} > {{ spark.sql("insert into aaa values (12, 'nn')");}} > {{ spark.sql("select * from aaa").show();}} > {{ spark.sql("insert into aaa (age, name) values (12, 'nn')");}} > {{ spark.sql("select * from aaa").show();}} > {{ }} > {{ spark.close();}} > {{ }} > {{ }}} > {{}}} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org