singhpk234 commented on code in PR #14804:
URL: https://github.com/apache/iceberg/pull/14804#discussion_r2603419873
##########
spark/v4.0/spark/src/test/java/org/apache/iceberg/spark/sql/TestSelect.java:
##########
@@ -643,4 +644,39 @@ public void
testRequiredNestedFieldInOptionalStructFilter() {
assertEquals("Should return all expected rows", ImmutableList.of(row(0)),
result);
sql("DROP TABLE IF EXISTS %s", nestedStructTable);
}
+
+ @TestTemplate
+ public void simpleTypesInFilter() {
+ String tableName = tableName("simple_types_table");
+ sql(
+ "CREATE TABLE IF NOT EXISTS %s (id bigint, boolean boolean, integer
integer, long long, "
+ + "float float, double double, string string, date date, timestamp
timestamp) USING iceberg",
+ tableName);
Review Comment:
Are we planning to add remaining types in follow-up ?
https://github.com/apache/iceberg/blob/0547af078c9d21b8642a4efcb3cbc85756547f22/open-api/rest-catalog-open-api.yaml#L4317-L4334
##########
spark/v4.0/spark/src/test/java/org/apache/iceberg/spark/sql/TestSelect.java:
##########
@@ -643,4 +644,39 @@ public void
testRequiredNestedFieldInOptionalStructFilter() {
assertEquals("Should return all expected rows", ImmutableList.of(row(0)),
result);
sql("DROP TABLE IF EXISTS %s", nestedStructTable);
}
+
+ @TestTemplate
+ public void simpleTypesInFilter() {
+ String tableName = tableName("simple_types_table");
+ sql(
+ "CREATE TABLE IF NOT EXISTS %s (id bigint, boolean boolean, integer
integer, long long, "
+ + "float float, double double, string string, date date, timestamp
timestamp) USING iceberg",
+ tableName);
+ sql(
+ "INSERT INTO %s VALUES (1, true, 1, 1L, 1.0, 1.0, '1.0',
to_date('2021-01-01'), to_timestamp('2021-01-01T00:00:00')), "
+ + "(2, false, 2, 2L, 2.0, 2.0, '2.0', to_date('2022-02-02'),
to_timestamp('2022-02-02T00:00:00')), "
+ + "(3, true, 3, 3L, 3.0, 3.0, '3.0', to_date('2023-03-03'),
to_timestamp('2023-03-03T00:00:00'))",
+ tableName);
+ assertThat(sql("SELECT id FROM %s where id > 1",
tableName)).containsExactly(row(2L), row(3L));
+ assertThat(sql("SELECT id, boolean FROM %s where boolean = true",
tableName))
+ .containsExactly(row(1L, true), row(3L, true));
+ assertThat(sql("SELECT long FROM %s where long > 1", tableName))
+ .containsExactly(row(2L), row(3L));
+ assertThat(sql("SELECT float FROM %s where float > 1.0", tableName))
+ .containsExactly(row(2.0f), row(3.0f));
+ assertThat(sql("SELECT double FROM %s where double > 1.0", tableName))
Review Comment:
should have values for this column 1.2, 2.2, 3.2, from POV to double confirm
if the underlying stuff is correctly mapped to float / double, presently lets
say serde make it long even when the type is double it would pass ?
assertThat(sql("SELECT float FROM %s where float > 1.3", tableName))
assertThat(sql("SELECT float FROM %s where double > 1.3", tableName))
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]