apache / gravitino

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
https://gravitino.apache.org
Apache License 2.0
1.09k stars 343 forks source link

[Bug report] Failed to set property for doris table #5545

Open danhuawang opened 1 week ago

danhuawang commented 1 week ago

Version

main branch

Describe what's wrong

I can alter doris table property by SQL

mysql> ALTER TABLE test_aggregate SET ("in_memory" = "true");
Query OK, 0 rows affected (0.02 sec)

But failed to alter the same doris table property through gravitino api

Error message and/or stacktrace

{
    "code": 1002,
    "type": "RuntimeException",
    "message": "Failed to operate object [t2] operation [ALTER] under [s1], reason [errCode = 2, detailMessage = Syntax error in line 2:\n\"in_memory\" = \"true\",\n^\nEncountered: STRING LITERAL\nExpected: COMMA, ., IDENTIFIER\n]",
    "stack": [
        "org.apache.gravitino.exceptions.GravitinoRuntimeException: errCode = 2, detailMessage = Syntax error in line 2:",
        "\"in_memory\" = \"true\",",
        "^",
        "Encountered: STRING LITERAL",
        "Expected: COMMA, ., IDENTIFIER",
        "",
        "\tat org.apache.gravitino.catalog.doris.converter.DorisExceptionConverter.toGravitinoException(DorisExceptionConverter.java:112)",
        "\tat org.apache.gravitino.catalog.jdbc.operation.JdbcTableOperations.alterTable(JdbcTableOperations.java:294)",
        "\tat org.apache.gravitino.catalog.jdbc.JdbcCatalogOperations.internalAlterTable(JdbcCatalogOperations.java:542)",
        "\tat org.apache.gravitino.catalog.jdbc.JdbcCatalogOperations.alterTable(JdbcCatalogOperations.java:391)",
        "\tat org.apache.gravitino.catalog.TableOperationDispatcher.lambda$alterTable$5(TableOperationDispatcher.java:188)",
        "\tat org.apache.gravitino.catalog.CatalogManager$CatalogWrapper.lambda$doWithTableOps$1(CatalogManager.java:132)",
        "\tat org.apache.gravitino.utils.IsolatedClassLoader.withClassLoader(IsolatedClassLoader.java:86)",
        "\tat org.apache.gravitino.catalog.CatalogManager$CatalogWrapper.doWithTableOps(CatalogManager.java:127)",
        "\tat org.apache.gravitino.catalog.TableOperationDispatcher.lambda$alterTable$6(TableOperationDispatcher.java:187)",
        "\tat org.apache.gravitino.catalog.OperationDispatcher.doWithCatalog(OperationDispatcher.java:117)",
        "\tat org.apache.gravitino.catalog.TableOperationDispatcher.alterTable(TableOperationDispatcher.java:184)",
        "\tat org.apache.gravitino.hook.TableHookDispatcher.alterTable(TableHookDispatcher.java:94)",
        "\tat org.apache.gravitino.catalog.TableNormalizeDispatcher.alterTable(TableNormalizeDispatcher.java:93)",
        "\tat org.apache.gravitino.listener.TableEventDispatcher.alterTable(TableEventDispatcher.java:142)",
        "\tat org.apache.gravitino.server.web.rest.TableOperations.lambda$alterTable$5(TableOperations.java:197)",
        "\tat org.apache.gravitino.lock.TreeLockUtils.doWithTreeLock(TreeLockUtils.java:49)",
        "\tat org.apache.gravitino.server.web.rest.TableOperations.lambda$alterTable$6(TableOperations.java:194)",
        "\tat java.base/java.security.AccessController.doPrivileged(AccessController.java:712)",
        "\tat java.base/javax.security.auth.Subject.doAs(Subject.java:439)",
        "\tat org.apache.gravitino.utils.PrincipalUtils.doAs(PrincipalUtils.java:39)",
        "\tat org.apache.gravitino.server.web.Utils.doAs(Utils.java:153)",
        "\tat org.apache.gravitino.server.web.rest.TableOperations.alterTable(TableOperations.java:184)",
        "\tat jdk.internal.reflect.GeneratedMethodAccessor60.invoke(Unknown Source)",
        "\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)",
        "\tat java.base/java.lang.reflect.Method.invoke(Method.java:568)",
        "\tat org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)",
        "\tat org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:146)",
        "\tat org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:189)",
        "\tat org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176)",
        "\tat org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:93)",
        "\tat org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:478)",
        "\tat org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:400)",
        "\tat org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81)",
        "\tat org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:256)",
        "\tat org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)",
        "\tat org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)",
        "\tat org.glassfish.jersey.internal.Errors.process(Errors.java:292)",
        "\tat org.glassfish.jersey.internal.Errors.process(Errors.java:274)",
        "\tat org.glassfish.jersey.internal.Errors.process(Errors.java:244)",
        "\tat org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)",
        "\tat org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:235)",
        "\tat org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:684)",
        "\tat org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:394)",
        "\tat org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346)",
        "\tat org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:358)",
        "\tat org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:311)",
        "\tat org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:205)",
        "\tat org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)",
        "\tat org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1656)",
        "\tat org.apache.gravitino.server.authentication.AuthenticationFilter.doFilter(AuthenticationFilter.java:86)",
        "\tat org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)",
        "\tat org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1626)",
        "\tat org.apache.gravitino.server.web.VersioningFilter.doFilter(VersioningFilter.java:123)",
        "\tat org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)",
        "\tat org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1626)",
        "\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:552)",
        "\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)",
        "\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600)",
        "\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)",
        "\tat org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)",
        "\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)",
        "\tat org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)",
        "\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)",
        "\tat org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)",
        "\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505)",
        "\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)",
        "\tat org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)",
        "\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)",
        "\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)",
        "\tat org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)",
        "\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)",
        "\tat org.eclipse.jetty.server.Server.handle(Server.java:516)",
        "\tat org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)",
        "\tat org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)",
        "\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)",
        "\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)",
        "\tat org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)",
        "\tat org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)",
        "\tat org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)",
        "\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)",
        "\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)",
        "\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)",
        "\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)",
        "\tat org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)",
        "\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)",
        "\tat org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)",
        "\tat java.base/java.lang.Thread.run(Thread.java:833)",
        "Caused by: java.sql.SQLException: errCode = 2, detailMessage = Syntax error in line 2:",
        "\"in_memory\" = \"true\",",
        "^",
        "Encountered: STRING LITERAL",
        "Expected: COMMA, ., IDENTIFIER",
        "",
        "\tat com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)",
        "\tat com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)",
        "\tat com.mysql.cj.jdbc.StatementImpl.executeUpdateInternal(StatementImpl.java:1340)",
        "\tat com.mysql.cj.jdbc.StatementImpl.executeLargeUpdate(StatementImpl.java:2089)",
        "\tat com.mysql.cj.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1251)",
        "\tat org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:330)",
        "\tat org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:330)",
        "\tat org.apache.gravitino.catalog.jdbc.utils.JdbcConnectorUtils.executeUpdate(JdbcConnectorUtils.java:42)",
        "\tat org.apache.gravitino.catalog.jdbc.operation.JdbcTableOperations.alterTable(JdbcTableOperations.java:291)",
        "\t... 85 more"
    ]
}

How to reproduce

  1. Create a doris table
  2. Alter doris table property by API PUT URI {{host}}/api/metalakes/:metalake/catalogs/:catalog/schemas/:schema/tables/:table

request body { "updates": [ { "@type": "setProperty", "property": "in_memory", "value": "true" } ] }

Additional context

No response

danhuawang commented 1 week ago

@yuqi1129 Can you help check this issue?