Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 of 3 tasks
hogger2099 opened this issue Apr 28, 2024 · 9 comments
Open
2 of 3 tasks
Labels

Comments

@hogger2099
Copy link

Search before asking

  • I had searched in the issues and found no similar issues.

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?

  • Yes I am willing to submit a PR!

Code of Conduct

@hogger2099 hogger2099 added the bug label Apr 28, 2024
@hogger2099
Copy link
Author

Need help, thank you all.

@liunaijie
Copy link
Contributor

liunaijie commented Apr 29, 2024

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

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

@liunaijie
Copy link
Contributor

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
Copy link
Author

hogger2099 commented Apr 29, 2024

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
Copy link
Contributor

liunaijie commented Apr 29, 2024

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
Copy link
Author

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
Copy link
Contributor

liunaijie commented Apr 29, 2024

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
Copy link
Author

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

@liunaijie
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants