apache / seatunnel

SeaTunnel is a next-generation super high-performance, distributed, massive data integration tool.
https://seatunnel.apache.org/
Apache License 2.0
8.07k stars 1.83k forks source link

[Bug] [shell client] variable not correct when it has space, eg: -i dt="2024-04-28 00:00:00" #6769

Closed hogger2099 closed 5 months ago

hogger2099 commented 7 months ago

Search before asking

What happened

variable replaced not correct

SeaTunnel Version

2.3.4

SeaTunnel Config

mysql_2_doris.config:
source {
    Jdbc {
        query = "select * from t where updated_time >= '"${dt}"'"
    }
}

Running Command

./start-seatunnel-spark-2-connector-v2.sh --config ./mysql_2_doris.config -i dt="2024-04-28 00:00:00"

Error Exception

the executed SQL is below, the variable is not replaced correct!
actual:
select * from t where updated_time >= '2024-04-28'
expected:
select * from t where updated_time >= '2024-04-28 00:00:00'

Zeta or Flink or Spark Version

No response

Java or Scala Version

No response

Screenshots

No response

Are you willing to submit PR?

Code of Conduct

hogger2099 commented 7 months ago

Need help, thank you all.

liunaijie commented 7 months ago

you can refer this pr #6387
try to use single quota.

-i dt='2024-04-28 00:00:00'
liunaijie commented 7 months ago

you can refer this pr #6387 try to use single quota.

-i dt='2024-04-28 00:00:00'

https://github.com/apache/seatunnel/pull/6387/files#diff-f7dba51c9511c67942157a5e10fc0224f0c526f024db8dc95018be4229e27bbbR255

hogger2099 commented 7 months ago

Thank u for replay. But not work if use variable like below, any suggestion? here use two single quota to use variable "dt"

dt=$(date +'%Y-%m-%d 00:00:00')

./start-seatunnel-spark-2-connector-v2.sh --config ./mysql_2_doris.config -i dt=''$dt''

you can refer this pr #6387 try to use single quota.

-i dt='2024-04-28 00:00:00'

https://github.com/apache/seatunnel/pull/6387/files#diff-f7dba51c9511c67942157a5e10fc0224f0c526f024db8dc95018be4229e27bbbR255

liunaijie commented 7 months ago

Thank u for replay. But not work if use variable like below, any suggestion? here use two single quota to use variable "dt"

dt=$(date +'%Y-%m-%d 00:00:00')

./start-seatunnel-spark-2-connector-v2.sh --config ./mysql_2_doris.config -i dt=''$dt''

you can refer this pr #6387 try to use single quota.

-i dt='2024-04-28 00:00:00'

https://github.com/apache/seatunnel/pull/6387/files#diff-f7dba51c9511c67942157a5e10fc0224f0c526f024db8dc95018be4229e27bbbR255

echo dt=\'$dt\'
hogger2099 commented 7 months ago

Thank u for replay. But not work if use variable like below, any suggestion? here use two single quota to use variable "dt"

dt=$(date +'%Y-%m-%d 00:00:00')

./start-seatunnel-spark-2-connector-v2.sh --config ./mysql_2_doris.config -i dt=''$dt''

you can refer this pr #6387 try to use single quota.

-i dt='2024-04-28 00:00:00'

https://github.com/apache/seatunnel/pull/6387/files#diff-f7dba51c9511c67942157a5e10fc0224f0c526f024db8dc95018be4229e27bbbR255

echo dt=\'$dt\'

what's the meaning?

liunaijie commented 7 months ago

Thank u for replay. But not work if use variable like below, any suggestion? here use two single quota to use variable "dt"

dt=$(date +'%Y-%m-%d 00:00:00')

./start-seatunnel-spark-2-connector-v2.sh --config ./mysql_2_doris.config -i dt=''$dt''

you can refer this pr #6387 try to use single quota.

-i dt='2024-04-28 00:00:00'

https://github.com/apache/seatunnel/pull/6387/files#diff-f7dba51c9511c67942157a5e10fc0224f0c526f024db8dc95018be4229e27bbbR255

echo dt=\'$dt\'

what's the meaning?

./start-seatunnel-spark-2-connector-v2.sh --config ./mysql_2_doris.config -i dt=\'$dt\'
hogger2099 commented 7 months ago

OK, thx, will version2.3.6 support this feature?

liunaijie commented 7 months ago

OK, thx, will version2.3.6 support this feature?

yes, the mentioned pr has merged. it will be release in 2.3.6.

and for your case, you mentiond you can pass the variable, but the format is not right. so maybe you can try pass the variables with single quota first. maybe it can work for you.

github-actions[bot] commented 6 months ago

This issue has been automatically marked as stale because it has not had recent activity for 30 days. It will be closed in next 7 days if no further activity occurs.

github-actions[bot] commented 5 months ago

This issue has been closed because it has not received response for too long time. You could reopen it if you encountered similar problems in the future.