datavane / datavines

Know your data better!Datavines is Next-gen Data Observability Platform, support metadata manage and data quality.
https://datavane.github.io/datavines-website/
Apache License 2.0
510 stars 157 forks source link

[Bug][datavines-engine]when save error data to datasource, timestamp column will cause error : java.sql.SQLSyntaxErrorException: Invalid default value for ‘columnName‘’ #338

Open unnunique opened 9 months ago

unnunique commented 9 months ago

Search before asking

What happened

image when save error data to datasource, if the origin table have a column with type timestamp or datetime, it will cause the following error :

[ERROR] 2024-01-19 11:20:01.101 [JobExecutionUniqueId=JOB-20240119-client_local_116:[121] - output error data error: 
java.sql.SQLSyntaxErrorException: Invalid default value for 'xxxxxxxColumn'
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
    at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
    at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:782)
    at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:666)
    at com.alibaba.druid.filter.FilterChainImpl.statement_execute(FilterChainImpl.java:2958)
    at com.alibaba.druid.filter.FilterAdapter.statement_execute(FilterAdapter.java:2473)
    at com.alibaba.druid.filter.FilterEventAdapter.statement_execute(FilterEventAdapter.java:188)
    at com.alibaba.druid.filter.FilterChainImpl.statement_execute(FilterChainImpl.java:2956)
    at com.alibaba.druid.proxy.jdbc.StatementProxyImpl.execute(StatementProxyImpl.java:147)
    at com.alibaba.druid.pool.DruidPooledStatement.execute(DruidPooledStatement.java:622)
    at io.datavines.engine.local.connector.executor.ErrorDataSinkExecutor.sinkErrorDataToDataSource(ErrorDataSinkExecutor.java:114)
    at io.datavines.engine.local.connector.executor.ErrorDataSinkExecutor.execute(ErrorDataSinkExecutor.java:73)
    at io.datavines.engine.local.connector.BaseJdbcSink.output(BaseJdbcSink.java:98)
    at io.datavines.engine.local.api.LocalExecution.execute(LocalExecution.java:146)
    at io.datavines.engine.core.BaseDataVinesBootstrap.parseConfigAndExecute(BaseDataVinesBootstrap.java:79)
    at io.datavines.engine.core.BaseDataVinesBootstrap.execute(BaseDataVinesBootstrap.java:43)
    at io.datavines.engine.local.executor.LocalEngineExecutor.execute(LocalEngineExecutor.java:44)
    at io.datavines.server.dqc.executor.runner.JobRunner.run(JobRunner.java:66)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)

DataVines Version

master branch

DataVines Config

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
spring:
  main:
    banner-mode: off
    allow-circular-references: true
  application:
    name: datavines-server
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3306/datavines?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
    username: root
    password: root
    hikari:
      connection-test-query: select 1
      minimum-idle: 5
      auto-commit: true
      validation-timeout: 3000
      pool-name: datavines
      maximum-pool-size: 50
      connection-timeout: 30000
      idle-timeout: 600000
      leak-detection-threshold: 0
      initialization-fail-timeout: 1
  quartz:
    job-store-type: jdbc
    jdbc:
      initialize-schema: never
    properties:
      org.quartz.threadPool.threadPriority: 5
      org.quartz.jobStore.isClustered: true
      org.quartz.jobStore.class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
      org.quartz.scheduler.instanceId: AUTO
      org.quartz.jobStore.tablePrefix: QRTZ_
      org.quartz.jobStore.acquireTriggersWithinLock: true
      org.quartz.scheduler.instanceName: datavines
      org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
      org.quartz.jobStore.useProperties: false
      org.quartz.threadPool.makeThreadsDaemons: true
      org.quartz.threadPool.threadCount: 25
      org.quartz.jobStore.misfireThreshold: 60000
      org.quartz.scheduler.batchTriggerAcquisitionMaxCount: 1
      org.quartz.scheduler.makeSchedulerThreadDaemon: true
      org.quartz.jobStore.driverDelegateClass: org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
      org.quartz.jobStore.clusterCheckinInterval: 5000
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher

mybatis-plus:
  type-enums-package: io.datavines.*.enums
#  configuration:
#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

server:
  port: 5600

management:
  endpoints:
    web:
      exposure:
        include: '*'
  metrics:
    tags:
      application: ${spring.application.name}

logging:
  config: classpath:server-logback.xml
---
spring:
  config:
    activate:
      on-profile: mysql
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3306/datavines?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
    username: root
    password: 123456
  quartz:
    properties:
      org.quartz.jobStore.driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate

Running Command

no

Error Exception

[ERROR] 2024-01-19 11:20:01.101 [JobExecutionUniqueId=JOB-20240119-client_local_116:[121] - output error data error: 
java.sql.SQLSyntaxErrorException: Invalid default value for 'xxxxxxxColumn'
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
    at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
    at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:782)
    at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:666)
    at com.alibaba.druid.filter.FilterChainImpl.statement_execute(FilterChainImpl.java:2958)
    at com.alibaba.druid.filter.FilterAdapter.statement_execute(FilterAdapter.java:2473)
    at com.alibaba.druid.filter.FilterEventAdapter.statement_execute(FilterEventAdapter.java:188)
    at com.alibaba.druid.filter.FilterChainImpl.statement_execute(FilterChainImpl.java:2956)
    at com.alibaba.druid.proxy.jdbc.StatementProxyImpl.execute(StatementProxyImpl.java:147)
    at com.alibaba.druid.pool.DruidPooledStatement.execute(DruidPooledStatement.java:622)
    at io.datavines.engine.local.connector.executor.ErrorDataSinkExecutor.sinkErrorDataToDataSource(ErrorDataSinkExecutor.java:114)
    at io.datavines.engine.local.connector.executor.ErrorDataSinkExecutor.execute(ErrorDataSinkExecutor.java:73)
    at io.datavines.engine.local.connector.BaseJdbcSink.output(BaseJdbcSink.java:98)
    at io.datavines.engine.local.api.LocalExecution.execute(LocalExecution.java:146)
    at io.datavines.engine.core.BaseDataVinesBootstrap.parseConfigAndExecute(BaseDataVinesBootstrap.java:79)
    at io.datavines.engine.core.BaseDataVinesBootstrap.execute(BaseDataVinesBootstrap.java:43)
    at io.datavines.engine.local.executor.LocalEngineExecutor.execute(LocalEngineExecutor.java:44)
    at io.datavines.server.dqc.executor.runner.JobRunner.run(JobRunner.java:66)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)

Engine Type

datavines-engine-local

Java Version

jdk8

Screenshots

No response

Are you willing to submit PR?