-
Notifications
You must be signed in to change notification settings - Fork 3k
Spark: Generate Spark's SQL literal format for binary and update the toString representation of binary/fixed literals. #3728
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -598,7 +598,8 @@ private static String sqlString(org.apache.iceberg.expressions.Literal<?> lit) { | |
| if (lit.value() instanceof String) { | ||
| return "'" + lit.value() + "'"; | ||
| } else if (lit.value() instanceof ByteBuffer) { | ||
| throw new IllegalArgumentException("Cannot convert bytes to SQL literal: " + lit); | ||
| // produce a literal value that Spark can parse | ||
| return lit.toString(); | ||
|
||
| } else { | ||
| return lit.value().toString(); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ | |
|
|
||
| package org.apache.iceberg.spark; | ||
|
|
||
| import java.lang.reflect.Array; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.stream.Collectors; | ||
|
|
@@ -118,6 +119,8 @@ private Object[] toJava(Row row) { | |
| return row.getList(pos); | ||
| } else if (value instanceof scala.collection.Map) { | ||
| return row.getJavaMap(pos); | ||
| } else if (value instanceof byte[]) { | ||
| return IntStream.range(0, Array.getLength(value)).mapToObj(i -> Array.get(value, i)).toArray(); | ||
|
||
| } else { | ||
| return value; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.