Teradata:如何删除字符\ x00& \ x02来自数据
我正在从Teradata数据库中加载数据,例如:
df = spark.read.format("jdbc").option("url", "jdbc:teradata://url_of_teradata_db/MAYBENULL=ON,TYPE=FASTEXPORT,charset=ASCII").option("dbtable", "({}) as subq".format(req)).option("driver", "com.teradata.jdbc.TeraDriver").option("user", my_user).option("password", my_password).load()
在我的数据中,我得到了不必要的字符,例如:\ x00& \ x02 ...
如何正确读取这些字符 *到我的spark.read.format ?
我发现 nullbyteprefix ,但我不确定如何使用
编辑:
我的查询查询真的很简单:
SELECT MY_ROW FROM MY_TABLE
我问Teradata有关此列的更多信息,我得到了:
| Column Name | Type | Nullable | Format | Max length |
| My_TABLE.MY_ROW | CV | N | X(100) | 100 |
I am loading data from a teradata database like:
df = spark.read.format("jdbc").option("url", "jdbc:teradata://url_of_teradata_db/MAYBENULL=ON,TYPE=FASTEXPORT,charset=ASCII").option("dbtable", "({}) as subq".format(req)).option("driver", "com.teradata.jdbc.TeraDriver").option("user", my_user).option("password", my_password).load()
In my data, I get unwanted character like: \x00 & \x02 ...
How can I correctly read those characters *into my spark.read.format?
I found the NULLBYTEPREFIX but I am not sure how to use it
EDIT :
my query query is really simple:
SELECT MY_ROW FROM MY_TABLE
I ask teradata more information about this column and I get:
| Column Name | Type | Nullable | Format | Max length |
| My_TABLE.MY_ROW | CV | N | X(100) | 100 |
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以检查数据库列的字符集,并将这些字符设置添加到上面的查询中吗?
您可以引用此 link ,如果您无法理解Teradata中设置的字符。
Could you check character set of database columns and add those character set into your above query.
You can refer this link, if you unable to understand the character set in teradata.