You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@doris.apache.org by Murugan Muthusamy <mm...@gmail.com> on 2020/10/26 18:33:34 UTC

update table

Hi,

I am using Master branch and running the following query

update table1 set username='muru' where siteid=5;


throws exception (see below)


I checked Doris FAQ and documentation but no reference to the update table.


Please, help me to understand and how to update table values?


Thanks,

Muru

2020-10-06 17:41:09,617 WARN (doris-mysql-nio-pool-82|684)
[ConnectProcessor.analyze():243] origin_stmt: update table1 set
username='muru' where siteid=5; Analyze error message: Syntax error in line
1:
update table1 set username='muru' where siteid=5
^
Encountered: IDENTIFIER
Expected

org.apache.doris.common.AnalysisException: errCode = 2, detailMessage =
Syntax error
        at
org.apache.doris.analysis.SqlParser.unrecovered_syntax_error(SqlParser.java:1749)
~[palo-fe.jar:3.4.0]
        at java_cup.runtime.lr_parser.parse(lr_parser.java:616)
~[jflex-1.4.3.jar:?]
        at
org.apache.doris.common.util.SqlParserUtils.getMultiStmts(SqlParserUtils.java:50)
~[palo-fe.jar:3.4.0]
        at
org.apache.doris.qe.ConnectProcessor.analyze(ConnectProcessor.java:239)
~[palo-fe.jar:3.4.0]
        at
org.apache.doris.qe.ConnectProcessor.handleQuery(ConnectProcessor.java:183)
~[palo-fe.jar:3.4.0]
        at
org.apache.doris.qe.ConnectProcessor.dispatch(ConnectProcessor.java:325)
~[palo-fe.jar:3.4.0]
        at
org.apache.doris.qe.ConnectProcessor.processOnce(ConnectProcessor.java:510)
~[palo-fe.jar:3.4.0]
        at
org.apache.doris.mysql.nio.ReadListener.lambda$handleEvent$0(ReadListener.java:50)
~[palo-fe.jar:3.4.0]
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[?:1.8.0_262]
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[?:1.8.0_262]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_262]

Re: update table

Posted by ling miao <em...@gmail.com>.
Hi

Doris don't support `update` right now.
There are two solutions:
1. Use 'delete' + 'insert'
2. Create a unique table

These two solutions are suitable for different situations, please refer to
the official documents for how to use them http://doris.apache.org/

You are welcome to use doris, you can communicate by email if you have any
questions.

Ling Miao

Zhao Chun <zh...@apache.org> 于2020年10月27日周二 上午8:59写道:

> Hi
>
> Doris don't support 'update' statement right now.
> If you want to update a table, you should create table with `unique key`.
> They you can insert a new row to overwrite the old one.
>
> Thanks,
> Zhao Chun
>
>
> Murugan Muthusamy <mm...@gmail.com> 于2020年10月27日周二 上午2:33写道:
>
> > Hi,
> >
> > I am using Master branch and running the following query
> >
> > update table1 set username='muru' where siteid=5;
> >
> >
> > throws exception (see below)
> >
> >
> > I checked Doris FAQ and documentation but no reference to the update
> table.
> >
> >
> > Please, help me to understand and how to update table values?
> >
> >
> > Thanks,
> >
> > Muru
> >
> > 2020-10-06 17:41:09,617 WARN (doris-mysql-nio-pool-82|684)
> > [ConnectProcessor.analyze():243] origin_stmt: update table1 set
> > username='muru' where siteid=5; Analyze error message: Syntax error in
> line
> > 1:
> > update table1 set username='muru' where siteid=5
> > ^
> > Encountered: IDENTIFIER
> > Expected
> >
> > org.apache.doris.common.AnalysisException: errCode = 2, detailMessage =
> > Syntax error
> >         at
> >
> >
> org.apache.doris.analysis.SqlParser.unrecovered_syntax_error(SqlParser.java:1749)
> > ~[palo-fe.jar:3.4.0]
> >         at java_cup.runtime.lr_parser.parse(lr_parser.java:616)
> > ~[jflex-1.4.3.jar:?]
> >         at
> >
> >
> org.apache.doris.common.util.SqlParserUtils.getMultiStmts(SqlParserUtils.java:50)
> > ~[palo-fe.jar:3.4.0]
> >         at
> > org.apache.doris.qe.ConnectProcessor.analyze(ConnectProcessor.java:239)
> > ~[palo-fe.jar:3.4.0]
> >         at
> >
> org.apache.doris.qe.ConnectProcessor.handleQuery(ConnectProcessor.java:183)
> > ~[palo-fe.jar:3.4.0]
> >         at
> > org.apache.doris.qe.ConnectProcessor.dispatch(ConnectProcessor.java:325)
> > ~[palo-fe.jar:3.4.0]
> >         at
> >
> org.apache.doris.qe.ConnectProcessor.processOnce(ConnectProcessor.java:510)
> > ~[palo-fe.jar:3.4.0]
> >         at
> >
> >
> org.apache.doris.mysql.nio.ReadListener.lambda$handleEvent$0(ReadListener.java:50)
> > ~[palo-fe.jar:3.4.0]
> >         at
> >
> >
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> > [?:1.8.0_262]
> >         at
> >
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> > [?:1.8.0_262]
> >         at java.lang.Thread.run(Thread.java:748) [?:1.8.0_262]
> >
>

Re: update table

Posted by Zhao Chun <zh...@apache.org>.
Hi

Doris don't support 'update' statement right now.
If you want to update a table, you should create table with `unique key`.
They you can insert a new row to overwrite the old one.

Thanks,
Zhao Chun


Murugan Muthusamy <mm...@gmail.com> 于2020年10月27日周二 上午2:33写道:

> Hi,
>
> I am using Master branch and running the following query
>
> update table1 set username='muru' where siteid=5;
>
>
> throws exception (see below)
>
>
> I checked Doris FAQ and documentation but no reference to the update table.
>
>
> Please, help me to understand and how to update table values?
>
>
> Thanks,
>
> Muru
>
> 2020-10-06 17:41:09,617 WARN (doris-mysql-nio-pool-82|684)
> [ConnectProcessor.analyze():243] origin_stmt: update table1 set
> username='muru' where siteid=5; Analyze error message: Syntax error in line
> 1:
> update table1 set username='muru' where siteid=5
> ^
> Encountered: IDENTIFIER
> Expected
>
> org.apache.doris.common.AnalysisException: errCode = 2, detailMessage =
> Syntax error
>         at
>
> org.apache.doris.analysis.SqlParser.unrecovered_syntax_error(SqlParser.java:1749)
> ~[palo-fe.jar:3.4.0]
>         at java_cup.runtime.lr_parser.parse(lr_parser.java:616)
> ~[jflex-1.4.3.jar:?]
>         at
>
> org.apache.doris.common.util.SqlParserUtils.getMultiStmts(SqlParserUtils.java:50)
> ~[palo-fe.jar:3.4.0]
>         at
> org.apache.doris.qe.ConnectProcessor.analyze(ConnectProcessor.java:239)
> ~[palo-fe.jar:3.4.0]
>         at
> org.apache.doris.qe.ConnectProcessor.handleQuery(ConnectProcessor.java:183)
> ~[palo-fe.jar:3.4.0]
>         at
> org.apache.doris.qe.ConnectProcessor.dispatch(ConnectProcessor.java:325)
> ~[palo-fe.jar:3.4.0]
>         at
> org.apache.doris.qe.ConnectProcessor.processOnce(ConnectProcessor.java:510)
> ~[palo-fe.jar:3.4.0]
>         at
>
> org.apache.doris.mysql.nio.ReadListener.lambda$handleEvent$0(ReadListener.java:50)
> ~[palo-fe.jar:3.4.0]
>         at
>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> [?:1.8.0_262]
>         at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> [?:1.8.0_262]
>         at java.lang.Thread.run(Thread.java:748) [?:1.8.0_262]
>