Skip to content

Commit 8feb1d2

Browse files
committed
improve tests
1 parent 58acba8 commit 8feb1d2

File tree

2 files changed

+15
-32
lines changed

2 files changed

+15
-32
lines changed

docs/source/user-guide/latest/compatibility.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,14 @@ Cast operations in Comet fall into three levels of support:
105105
<!-- prettier-ignore-end -->
106106

107107
**Notes:**
108-
109108
- **decimal -> string**: There can be formatting differences in some case due to Spark using scientific notation where Comet does not
110109
- **double -> decimal**: There can be rounding differences
111110
- **double -> string**: There can be differences in precision. For example, the input "1.4E-45" will produce 1.0E-45 instead of 1.4E-45
112111
- **float -> decimal**: There can be rounding differences
113112
- **float -> string**: There can be differences in precision. For example, the input "1.4E-45" will produce 1.0E-45 instead of 1.4E-45
114113
- **string -> date**: Only supports years between 262143 BC and 262142 AD
115114
- **string -> decimal**: Does not support fullwidth unicode digits (e.g \\uFF10)
116-
or strings containing null bytes (e.g \\u0000)
115+
or strings containing null bytes (e.g \\u0000)
117116
- **string -> timestamp**: Not all valid formats are supported
118117
<!--END:CAST_LEGACY_TABLE-->
119118

@@ -140,15 +139,14 @@ Cast operations in Comet fall into three levels of support:
140139
<!-- prettier-ignore-end -->
141140

142141
**Notes:**
143-
144142
- **decimal -> string**: There can be formatting differences in some case due to Spark using scientific notation where Comet does not
145143
- **double -> decimal**: There can be rounding differences
146144
- **double -> string**: There can be differences in precision. For example, the input "1.4E-45" will produce 1.0E-45 instead of 1.4E-45
147145
- **float -> decimal**: There can be rounding differences
148146
- **float -> string**: There can be differences in precision. For example, the input "1.4E-45" will produce 1.0E-45 instead of 1.4E-45
149147
- **string -> date**: Only supports years between 262143 BC and 262142 AD
150148
- **string -> decimal**: Does not support fullwidth unicode digits (e.g \\uFF10)
151-
or strings containing null bytes (e.g \\u0000)
149+
or strings containing null bytes (e.g \\u0000)
152150
- **string -> timestamp**: Not all valid formats are supported
153151
<!--END:CAST_TRY_TABLE-->
154152

@@ -175,15 +173,14 @@ Cast operations in Comet fall into three levels of support:
175173
<!-- prettier-ignore-end -->
176174

177175
**Notes:**
178-
179176
- **decimal -> string**: There can be formatting differences in some case due to Spark using scientific notation where Comet does not
180177
- **double -> decimal**: There can be rounding differences
181178
- **double -> string**: There can be differences in precision. For example, the input "1.4E-45" will produce 1.0E-45 instead of 1.4E-45
182179
- **float -> decimal**: There can be rounding differences
183180
- **float -> string**: There can be differences in precision. For example, the input "1.4E-45" will produce 1.0E-45 instead of 1.4E-45
184181
- **string -> date**: Only supports years between 262143 BC and 262142 AD
185182
- **string -> decimal**: Does not support fullwidth unicode digits (e.g \\uFF10)
186-
or strings containing null bytes (e.g \\u0000)
183+
or strings containing null bytes (e.g \\u0000)
187184
- **string -> timestamp**: ANSI mode not supported
188185
<!--END:CAST_ANSI_TABLE-->
189186

spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,8 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper {
193193
withTempDir { dir =>
194194
val path = new Path(dir.toURI.toString, "test.parquet")
195195
makeParquetFileAllPrimitiveTypes(path, dictionaryEnabled = dictionaryEnabled, 10000)
196-
withSQLConf(CometConf.COMET_SCAN_ALLOW_INCOMPATIBLE.key -> "true") {
197-
withParquetTable(path.toString, "tbl") {
198-
checkSparkAnswerAndOperator("select * FROM tbl WHERE _2 > 100")
199-
}
196+
withParquetTable(path.toString, "tbl") {
197+
checkSparkAnswerAndOperator("select * FROM tbl WHERE _2 > 100")
200198
}
201199
}
202200
}
@@ -207,28 +205,16 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper {
207205
// this test requires native_comet scan due to unsigned u8/u16 issue
208206
withSQLConf(CometConf.COMET_NATIVE_SCAN_IMPL.key -> CometConf.SCAN_NATIVE_COMET) {
209207
Seq(true, false).foreach { dictionaryEnabled =>
210-
withSQLConf(CometConf.COMET_SCAN_ALLOW_INCOMPATIBLE.key -> "true") {
211-
withTempDir { dir =>
212-
val path = new Path(dir.toURI.toString, "testuint.parquet")
213-
makeParquetFileAllPrimitiveTypes(
214-
path,
215-
dictionaryEnabled = dictionaryEnabled,
216-
Byte.MinValue,
217-
Byte.MaxValue)
218-
withParquetTable(path.toString, "tbl") {
219-
val qry = "select _9 from tbl order by _11"
220-
if (usingDataSourceExec(conf)) {
221-
// need to convert the values to unsigned values
222-
val expected = (Byte.MinValue to Byte.MaxValue)
223-
.map(v => {
224-
if (v < 0) Byte.MaxValue.toShort - v else v
225-
})
226-
.toDF("a")
227-
checkAnswer(sql(qry), expected)
228-
} else {
229-
checkSparkAnswerAndOperator(qry)
230-
}
231-
}
208+
withTempDir { dir =>
209+
val path = new Path(dir.toURI.toString, "testuint.parquet")
210+
makeParquetFileAllPrimitiveTypes(
211+
path,
212+
dictionaryEnabled = dictionaryEnabled,
213+
Byte.MinValue,
214+
Byte.MaxValue)
215+
withParquetTable(path.toString, "tbl") {
216+
val qry = "select _9 from tbl order by _11"
217+
checkSparkAnswerAndOperator(qry)
232218
}
233219
}
234220
}

0 commit comments

Comments
 (0)