Commit 997cd2b
committed
Fix charset annotation in plan strings via saffron.properties
The getDefaultCharset() override (introduced to fix non-ASCII PPL string
literals) caused Calcite to annotate all VARCHAR/CHAR types and literals
with CHARACTER SET "UTF-8" and _UTF-8 prefix in plan strings, breaking
dozens of unit tests that compare logical plan representations.
Root cause: Calcite suppresses the charset annotation and _charset prefix
only when the charset matches CalciteSystemProperty.DEFAULT_CHARSET (which
defaults to ISO-8859-1). Overriding getDefaultCharset() to UTF-8 set the
charset on all types, but the suppression checks still compared against
ISO-8859-1, making the annotations appear everywhere.
Fix: add saffron.properties to core/src/main/resources with:
calcite.default.charset=UTF-8
calcite.default.collation.name=UTF-8$en_US
Calcite reads this file at CalciteSystemProperty class-load time (before
any DEFAULT_CHARSET or SqlCollation.IMPLICIT static field is initialized),
shifting the entire "default charset" universe to UTF-8. Both suppression
checks now compare against UTF-8, so plan strings are identical to before
while non-ASCII string literals continue to work correctly.
The now-redundant getDefaultCharset() override is removed; the inherited
SqlTypeFactoryImpl path already returns UTF-8 via Util.getDefaultCharset()
which reads from CalciteSystemProperty.DEFAULT_CHARSET = "UTF-8".
Signed-off-by: Radhakrishnan Pachyappan <gingeekrishna@gmail.com>1 parent a4db157 commit 997cd2b
3 files changed
Lines changed: 9 additions & 9 deletions
File tree
- core/src/main
- java/org/opensearch/sql/calcite
- utils
- resources
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
135 | | - | |
136 | | - | |
| 134 | + | |
| 135 | + | |
137 | 136 | | |
138 | 137 | | |
139 | 138 | | |
| |||
Lines changed: 0 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
| |||
96 | 95 | | |
97 | 96 | | |
98 | 97 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | 98 | | |
105 | 99 | | |
106 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
0 commit comments