You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
following sql reports Exception: DataFusion error: type_coercion caused by Execution error: Cannot access field at argument 1: type Utf8 is not Struct, Map, or Null #1796
s="""WITH RECURSIVE input(sud) AS ( VALUES('....754..........8.8.19....3....1.6........34....6817.2.4...6.39......2.53.2.....'), ('3.........5.7.3..8....28.7.7......43...........39.41.54..3..8..1...4....968...2..') ), digits(z, lp) AS ( VALUES('1', 1) UNION ALL SELECT CAST(lp+1 AS TEXT) as z, lp+1 as lp FROM digits WHERE lp<9 ), x(s, ind) AS ( SELECT sud, instr(sud, '.') FROM input UNION ALL SELECT substr(s, 1, ind-1) || z || substr(s, ind+1), instr( substr(s, 1, ind-1) || z || substr(s, ind+1), '.' ) FROM x, digits AS z WHERE ind>0 AND NOT EXISTS ( SELECT 1 FROM digits AS lp WHERE z.z = substr(s, ((ind-1)/9)*9 + lp, 1) OR z.z = substr(s, ((ind-1)%9) + (lp-1)*9 + 1, 1) OR z.z = substr(s, (((ind-1)/3) % 3) * 3 + ((ind-1)/27) * 27 + lp + ((lp-1) / 3) * 6, 1) ) )SELECT s FROM x WHERE ind=0;"""fromdatafusionimportSessionContextctx=SessionContext()
ctx.sql(s)
I got it, in z.z, datafusion regards the first z as a column, not a table, following one is ok
WITH RECURSIVE
input(sud) AS (
VALUES('....754..........8.8.19....3....1.6........34....6817.2.4...6.39......2.53.2.....'),
('3.........5.7.3..8....28.7.7......43...........39.41.54..3..8..1...4....968...2..')
),
digits(z, lp) AS (
VALUES('1', 1)
UNION ALLSELECT
CAST(lp+1ASTEXT) as z, lp+1as lp FROM digits WHERE lp<9
),
x(s, ind) AS (
SELECT sud, instr(sud, '.') FROM input
UNION ALLSELECT
substr(s, 1, ind-1) || z || substr(s, ind+1),
instr( substr(s, 1, ind-1) || z || substr(s, ind+1), '.' )
FROM x, digits AS d
WHERE ind>0AND NOT EXISTS (
SELECT1FROM digits AS lp
WHEREd.z= substr(s, ((ind-1)/9)*9+ lp, 1)
ORd.z= substr(s, ((ind-1)%9) + (lp-1)*9+1, 1)
ORd.z= substr(s, (((ind-1)/3) % 3) *3+ ((ind-1)/27) *27+ lp
+ ((lp-1) /3) *6, 1)
)
)
SELECT s FROM x WHERE ind=0;
Activity
l1t1 commentedon Oct 16, 2026
I got it, in
z.z, datafusion regards the first z as a column, not a table, following one is ok